adding strobe feature

This commit is contained in:
langolierz
2019-12-03 19:40:42 +00:00
parent 4313c4b060
commit 2e133df8c3
5 changed files with 56 additions and 21 deletions

View File

@@ -486,6 +486,24 @@ class Actions(object):
def set_the_shader_param_3_layer_offset_2_continuous(self, amount):
self.shaders.set_param_to_amount(3, amount, layer_offset=2)
def set_the_shader_param_0_layer_offset_3_continuous(self, amount):
self.shaders.set_param_to_amount(0, amount, layer_offset=2)
def set_the_shader_param_1_layer_offset_3_continuous(self, amount):
self.shaders.set_param_to_amount(1, amount, layer_offset=2)
def set_the_shader_param_2_layer_offset_3_continuous(self, amount):
self.shaders.set_param_to_amount(2, amount, layer_offset=2)
def set_the_shader_param_3_layer_offset_3_continuous(self, amount):
self.shaders.set_param_to_amount(3, amount, layer_offset=2)
def set_strobe_amount_continuous(self, amount):
scaled_amount = int(amount * 10)
if self.data.settings['shader']['STROBE_AMOUNT']['value'] != scaled_amount:
print(scaled_amount)
self.video_driver.osc_client.send_message("/set_strobe", scaled_amount)
self.data.settings['shader']['STROBE_AMOUNT']['value'] = scaled_amount
def get_midi_status(self):
self.message_handler.set_message('INFO', 'midi status is {}'.format(self.data.midi_status))
@@ -835,18 +853,14 @@ class Actions(object):
if current_recur_hash != new_recur_hash or current_conjur_hash != new_conjur_hash or current_ofxVideoArtTools_hash != new_ofxVideoArtTools_hash :
#something has changed!
os.remove('/home/pi/r_e_c_u_r/json_objects/settings.json')
if current_conjur_hash != new_conjur_hash or current_ofxVideoArtTools_hash != new_ofxVideoArtTools_hash :
self.message_handler.set_message('INFO', 'compiling OF pls wait')
self.tk.after(100,self.complie_openframeworks)
else:
self.restart_the_program()
else:
self.message_handler.set_message('INFO', 'up to date !')
def complie_openframeworks(self):
subprocess.call(['make', '--directory=' + self.data.PATH_TO_OPENFRAMEWORKS + 'apps/myApps/c_o_n_j_u_r' ])
self.message_handler.set_message('INFO', 'finished compiling!')
self.restart_the_program()
# def complie_openframeworks(self):
# subprocess.call(['make', '--directory=' + self.data.PATH_TO_OPENFRAMEWORKS + 'apps/myApps/c_o_n_j_u_r' ])
# self.message_handler.set_message('INFO', 'finished compiling!')
# self.restart_the_program()
def shutdown_pi(self):
subprocess.call(['sudo', 'shutdown', '-h', 'now'])

View File

@@ -37,7 +37,10 @@
"DEFAULT": ["set_the_shader_param_2_layer_offset_2_continuous"]
},
"control_change 11": {
"DEFAULT": ["set_the_shader_param_0_layer_offset_3_continuous"]
"DEFAULT": ["set_the_shader_param_3_layer_offset_2_continuous"]
},
"control_change 12": {
"DEFAULT": ["set_strobe_amount_continuous"]
},
"note_on 72": {
"NAV_BROWSER": ["move_browser_selection_up"],

View File

@@ -186,6 +186,23 @@
],
"value": "disabled"
},
"STROBE_AMOUNT": {
"action": null,
"options": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10
],
"value": 0
},
"X3_AS_SPEED": {
"action": null,
"options": [

View File

@@ -65,19 +65,17 @@
}
],
[
{
"name": "add_mix.frag",
"param_number": 4,
"path": "/home/pi/r_e_c_u_r/Shaders/2-input/add_mix.frag",
"shad_type": "-",
"slot": 0
},
{
"name": "hsv_control.frag",
"param_number": 4,
"path": "/home/pi/r_e_c_u_r/Shaders/1-input/hsv_control.frag",
"shad_type": "-",
"slot": 1
"shad_type": "-"
},
{
"name": "",
"param_number": 4,
"path": "",
"shad_type": "-"
},
{
"name": "",

View File

@@ -148,10 +148,13 @@ class Shaders(object):
else:
return current + change
def set_param_to_amount(self, param, amount, layer_offset=0):
def set_param_to_amount(self, param, amount, layer_offset=None):
start_layer = self.data.shader_layer
if self.data.settings['shader']['FIX_PARAM_OFFSET_LAYER']['value'] == 'enabled':
start_layer = 0
if layer_offset is None:
start_layer = self.data.shader_layer
layer_offset = 0
layer = start_layer + layer_offset % 4
if self.data.settings['shader']['X3_AS_SPEED']['value'] == 'enabled' and param == 3:
self.set_speed_to_amount(amount, layout_offset=layout_offset)