mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-12 03:10:17 +01:00
ModulationReceiverPlugin that allows plugin to receive when the modulation slots A-D (1-4) value changes... with quick hack to WJSendPlugin to wiggle some parameters in response
This commit is contained in:
@@ -221,6 +221,14 @@ class DisplayPlugin(Plugin):
|
|||||||
#display_text.insert(END, 'test from DisplayPlugin')
|
#display_text.insert(END, 'test from DisplayPlugin')
|
||||||
display.display_text.insert(END, '{} \n'.format(display.body_title))
|
display.display_text.insert(END, '{} \n'.format(display.body_title))
|
||||||
|
|
||||||
|
class ModulationReceiverPlugin(Plugin):
|
||||||
|
def __init__(self, plugin_collection):
|
||||||
|
super().__init__(plugin_collection)
|
||||||
|
|
||||||
|
def set_modulation_value(self, param, value):
|
||||||
|
print("||||||set_modulation_value dummy!")
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
# adapted from https://github.com/gdiepen/python_plugin_example
|
# adapted from https://github.com/gdiepen/python_plugin_example
|
||||||
class PluginCollection(object):
|
class PluginCollection(object):
|
||||||
@@ -295,7 +303,7 @@ class PluginCollection(object):
|
|||||||
for (_, c) in clsmembers:
|
for (_, c) in clsmembers:
|
||||||
# Only add classes that are a sub class of Plugin, but NOT Plugin itself
|
# Only add classes that are a sub class of Plugin, but NOT Plugin itself
|
||||||
# or one of the base classes
|
# or one of the base classes
|
||||||
ignore_list = [ Plugin, ActionsPlugin, SequencePlugin, MidiFeedbackPlugin, DisplayPlugin ]
|
ignore_list = [ Plugin, ActionsPlugin, SequencePlugin, MidiFeedbackPlugin, DisplayPlugin, ModulationReceiverPlugin ]
|
||||||
if issubclass(c, Plugin) & (c not in ignore_list):
|
if issubclass(c, Plugin) & (c not in ignore_list):
|
||||||
print(' Found plugin class: %s.%s' % (c.__module__,c.__name__))
|
print(' Found plugin class: %s.%s' % (c.__module__,c.__name__))
|
||||||
self.plugins.append(c(self))
|
self.plugins.append(c(self))
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import serial
|
import serial
|
||||||
from serial import Serial
|
from serial import Serial
|
||||||
import data_centre.plugin_collection
|
import data_centre.plugin_collection
|
||||||
from data_centre.plugin_collection import ActionsPlugin, SequencePlugin, DisplayPlugin
|
from data_centre.plugin_collection import ActionsPlugin, SequencePlugin, DisplayPlugin, ModulationReceiverPlugin
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
class WJSendPlugin(ActionsPlugin,SequencePlugin,DisplayPlugin):
|
class WJSendPlugin(ActionsPlugin,SequencePlugin,DisplayPlugin,ModulationReceiverPlugin):
|
||||||
disabled = False#True
|
disabled = False#True
|
||||||
ser = None
|
ser = None
|
||||||
# from http://depot.univ-nc.nc/sources/boxtream-0.9999/boxtream/switchers/panasonic.py
|
# from http://depot.univ-nc.nc/sources/boxtream-0.9999/boxtream/switchers/panasonic.py
|
||||||
@@ -30,6 +30,19 @@ class WJSendPlugin(ActionsPlugin,SequencePlugin,DisplayPlugin):
|
|||||||
self.pc.actions.tk.after(500, self.refresh)
|
self.pc.actions.tk.after(500, self.refresh)
|
||||||
#tk.after(500, self.refresh)
|
#tk.after(500, self.refresh)
|
||||||
|
|
||||||
|
def set_modulation_value(self, param, value):
|
||||||
|
# take modulation value and throw it to local parameter
|
||||||
|
print("||||| wjsend set_modulation_value!")
|
||||||
|
if param==0:
|
||||||
|
self.set_mix((0.5+value)/2)
|
||||||
|
elif param==1:
|
||||||
|
self.set_colour('T', 'x', 0.5+value)
|
||||||
|
elif param==2:
|
||||||
|
self.set_colour('T', 'y', 0.5+value)
|
||||||
|
elif param==3:
|
||||||
|
self.set_back_colour('x', 0.5+value)
|
||||||
|
else:
|
||||||
|
print("unknown param %s!" % param)
|
||||||
|
|
||||||
def open_serial(self, port='/dev/ttyUSB0', baudrate=9600):
|
def open_serial(self, port='/dev/ttyUSB0', baudrate=9600):
|
||||||
if self.ser is not None:
|
if self.ser is not None:
|
||||||
@@ -98,9 +111,12 @@ class WJSendPlugin(ActionsPlugin,SequencePlugin,DisplayPlugin):
|
|||||||
if not self.ser or self.ser is None:
|
if not self.ser or self.ser is None:
|
||||||
self.open_serial()
|
self.open_serial()
|
||||||
|
|
||||||
for queue, command in self.queue.items():
|
try:
|
||||||
self.send_buffered(queue, command)
|
for queue, command in self.queue.items():
|
||||||
self.queue.clear()
|
self.send_buffered(queue, command)
|
||||||
|
self.queue.clear()
|
||||||
|
except:
|
||||||
|
print ("!!! CAUGHT EXCEPTION running queue !!!")
|
||||||
|
|
||||||
if self.ser is not None:
|
if self.ser is not None:
|
||||||
self.pc.shaders.root.after(self.THROTTLE, self.refresh)
|
self.pc.shaders.root.after(self.THROTTLE, self.refresh)
|
||||||
|
|||||||
@@ -117,8 +117,11 @@ class MidiInput(object):
|
|||||||
#if self.data.function_on and "FN_%s"%self.data.control_mode in this_mapping:
|
#if self.data.function_on and "FN_%s"%self.data.control_mode in this_mapping:
|
||||||
# mode = "FN_%s"%self.data.control_mode
|
# mode = "FN_%s"%self.data.control_mode
|
||||||
#el
|
#el
|
||||||
|
#print ("got mapping %s" % this_mapping)
|
||||||
if self.data.control_mode in this_mapping:
|
if self.data.control_mode in this_mapping:
|
||||||
mode = self.data.control_mode
|
mode = self.data.control_mode
|
||||||
|
elif self.data.display_mode in this_mapping:
|
||||||
|
mode = self.data.display_mode
|
||||||
#elif self.data.function_on and "FN_DEFAULT" in this_mapping:
|
#elif self.data.function_on and "FN_DEFAULT" in this_mapping:
|
||||||
# mode = "FN_DEFAULT"
|
# mode = "FN_DEFAULT"
|
||||||
elif 'DEFAULT' in this_mapping:
|
elif 'DEFAULT' in this_mapping:
|
||||||
@@ -130,7 +133,8 @@ class MidiInput(object):
|
|||||||
else:
|
else:
|
||||||
method_name = this_mapping[mode][0]
|
method_name = this_mapping[mode][0]
|
||||||
|
|
||||||
print('the action being called is {}'.format(method_name))
|
print('[][][][][ in mode {}, the action being called is {} from message_name {} in control_mode {}'
|
||||||
|
.format(mode, method_name, message_name, self.data.control_mode))
|
||||||
if mapped_message_value is not None:
|
if mapped_message_value is not None:
|
||||||
norm_message_value = mapped_message_value/127
|
norm_message_value = mapped_message_value/127
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import display_centre.menu as menu
|
import display_centre.menu as menu
|
||||||
import os
|
import os
|
||||||
from statistics import mean
|
from statistics import mean
|
||||||
|
from data_centre.plugin_collection import ModulationReceiverPlugin
|
||||||
|
|
||||||
class Shaders(object):
|
class Shaders(object):
|
||||||
MENU_HEIGHT = 10
|
MENU_HEIGHT = 10
|
||||||
@@ -230,6 +231,8 @@ class Shaders(object):
|
|||||||
|
|
||||||
def modulate_param_to_amount(self, param, value):
|
def modulate_param_to_amount(self, param, value):
|
||||||
self.modulation_value[param] = (value-0.5)*2
|
self.modulation_value[param] = (value-0.5)*2
|
||||||
|
for plugin in self.data.plugins.get_plugins(ModulationReceiverPlugin):
|
||||||
|
plugin.set_modulation_value(param, self.modulation_value[param])
|
||||||
for layer,params in enumerate(self.selected_param_list):
|
for layer,params in enumerate(self.selected_param_list):
|
||||||
for ip,p in enumerate(params):
|
for ip,p in enumerate(params):
|
||||||
for p2,v in enumerate(self.selected_modulation_level[layer][ip]):
|
for p2,v in enumerate(self.selected_modulation_level[layer][ip]):
|
||||||
|
|||||||
Reference in New Issue
Block a user