mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-05 16:00:06 +01:00
refactoring settings menu
This commit is contained in:
56
actions.py
56
actions.py
@@ -32,7 +32,7 @@ class Actions(object):
|
||||
self.server = self.setup_osc_server()
|
||||
|
||||
def set_capture_object(self, value):
|
||||
if self.data.settings['other']['USE_OF_CAPTURE']['value'] == 'yes':
|
||||
if self.data.settings['captur']['USE_OF_CAPTURE']['value'] == 'yes':
|
||||
self.python_capture.close_capture()
|
||||
self.capture = self.of_capture
|
||||
else:
|
||||
@@ -85,7 +85,7 @@ class Actions(object):
|
||||
|
||||
def _load_this_slot_into_next_player(self, slot):
|
||||
### load next player for seamless type otherwise respect player mode
|
||||
if self.data.settings['sampler']['LOOP_TYPE']['value'] == 'seamless':
|
||||
if self.data.settings['recur']['LOOP_TYPE']['value'] == 'seamless':
|
||||
if self.data.update_next_slot_number(slot):
|
||||
self.video_driver.reload_next_player()
|
||||
else:
|
||||
@@ -129,7 +129,7 @@ class Actions(object):
|
||||
self._load_this_slot_into_next_player(9)
|
||||
|
||||
def switch_to_next_player(self):
|
||||
if self.data.settings['sampler']['LOOP_TYPE']['value'] == 'seamless':
|
||||
if self.data.settings['recur']['LOOP_TYPE']['value'] == 'seamless':
|
||||
self.video_driver.switch_players_and_start_video()
|
||||
else:
|
||||
self.video_driver.current_player.toggle_show()
|
||||
@@ -138,7 +138,7 @@ class Actions(object):
|
||||
|
||||
|
||||
def cycle_display_mode(self):
|
||||
if self.data.settings['other']['VIDEO_BACKEND']['value'] == 'openframeworks':
|
||||
if self.data.settings['conjur']['VIDEO_BACKEND']['value'] == 'openframeworks':
|
||||
display_modes = [["SETTINGS",'NAV_SETTINGS'],[ "SAMPLER",'PLAYER'],["BROWSER",'NAV_BROWSER'],["SHADERS",'NAV_SHADERS']]
|
||||
else:
|
||||
display_modes = [["BROWSER",'NAV_BROWSER'],["SETTINGS",'NAV_SETTINGS'],[ "SAMPLER",'PLAYER']]
|
||||
@@ -150,8 +150,8 @@ class Actions(object):
|
||||
|
||||
|
||||
def toggle_action_on_player(self):
|
||||
play = 'play' in self.data.settings['sampler']['ON_ACTION']['value']
|
||||
show = 'show' in self.data.settings['sampler']['ON_ACTION']['value']
|
||||
play = 'play' in self.data.settings['recur']['ON_ACTION']['value']
|
||||
show = 'show' in self.data.settings['recur']['ON_ACTION']['value']
|
||||
if play:
|
||||
self.toggle_play_on_player()
|
||||
if show:
|
||||
@@ -170,24 +170,24 @@ class Actions(object):
|
||||
self.video_driver.next_player.toggle_show()
|
||||
|
||||
def increase_seek_time(self):
|
||||
options = self.data.settings['sampler']['SEEK_TIME']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['sampler']['SEEK_TIME']['value'] ][0]
|
||||
self.data.settings['sampler']['SEEK_TIME']['value'] = options[(current_index + 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Seek Time is now ' + str(self.data.settings['sampler']['SEEK_TIME']['value']) + 's')
|
||||
options = self.data.settings['recur']['SEEK_TIME']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['recur']['SEEK_TIME']['value'] ][0]
|
||||
self.data.settings['recur']['SEEK_TIME']['value'] = options[(current_index + 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Seek Time is now ' + str(self.data.settings['recur']['SEEK_TIME']['value']) + 's')
|
||||
|
||||
|
||||
def decrease_seek_time(self):
|
||||
options = self.data.settings['sampler']['SEEK_TIME']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['sampler']['SEEK_TIME']['value'] ][0]
|
||||
self.data.settings['sampler']['SEEK_TIME']['value'] = options[(current_index - 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Seek Time is now ' + str(self.data.settings['sampler']['SEEK_TIME']['value']) + 's')
|
||||
options = self.data.settings['recur']['SEEK_TIME']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['recur']['SEEK_TIME']['value'] ][0]
|
||||
self.data.settings['recur']['SEEK_TIME']['value'] = options[(current_index - 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Seek Time is now ' + str(self.data.settings['recur']['SEEK_TIME']['value']) + 's')
|
||||
|
||||
|
||||
def seek_forward_on_player(self):
|
||||
self.video_driver.current_player.seek(self.data.settings['sampler']['SEEK_TIME']['value'])
|
||||
self.video_driver.current_player.seek(self.data.settings['recur']['SEEK_TIME']['value'])
|
||||
|
||||
def seek_back_on_player(self):
|
||||
self.video_driver.current_player.seek(-(self.data.settings['sampler']['SEEK_TIME']['value']))
|
||||
self.video_driver.current_player.seek(-(self.data.settings['recur']['SEEK_TIME']['value']))
|
||||
|
||||
def toggle_function(self):
|
||||
self.data.function_on = not self.data.function_on
|
||||
@@ -324,7 +324,7 @@ class Actions(object):
|
||||
self.capture.update_capture_settings()
|
||||
|
||||
def change_piCapture_input(self, setting_value):
|
||||
if self.data.settings['capture']['TYPE']['value'] == 'piCaptureSd1':
|
||||
if self.data.settings['captur']['TYPE']['value'] == 'piCaptureSd1':
|
||||
subprocess.call(['pivideo', '-s', setting_value])
|
||||
|
||||
def change_output_mode(self, setting_value):
|
||||
@@ -366,7 +366,7 @@ class Actions(object):
|
||||
self.data.update_setting_value('other','DEV_MODE_RESET', 'off')
|
||||
|
||||
def check_if_should_start_openframeworks(self):
|
||||
if self.data.settings['other']['VIDEO_BACKEND']['value'] == 'openframeworks':
|
||||
if self.data.settings['conjur']['VIDEO_BACKEND']['value'] == 'openframeworks':
|
||||
self.openframeworks_process = subprocess.Popen(['/home/pi/openFrameworks/apps/myApps/c_o_n_j_u_r/bin/c_o_n_j_u_r'])
|
||||
print('conjur pid is {}'.format(self.openframeworks_process.pid))
|
||||
|
||||
@@ -485,10 +485,10 @@ class Actions(object):
|
||||
self.shaders.focused_param = 0
|
||||
|
||||
def increase_this_param(self):
|
||||
self.shaders.increase_this_param(self.data.settings['other']['SHADER_PARAM']['value'])
|
||||
self.shaders.increase_this_param(self.data.settings['conjur']['SHADER_PARAM']['value'])
|
||||
|
||||
def decrease_this_param(self):
|
||||
self.shaders.decrease_this_param(self.data.settings['other']['SHADER_PARAM']['value'])
|
||||
self.shaders.decrease_this_param(self.data.settings['conjur']['SHADER_PARAM']['value'])
|
||||
|
||||
def increase_param_focus(self):
|
||||
self.shaders.focused_param = (self.shaders.focused_param + 1)%self.shaders.selected_shader['param_number']
|
||||
@@ -497,16 +497,16 @@ class Actions(object):
|
||||
self.shaders.focused_param = (self.shaders.focused_param - 1)%self.shaders.selected_shader['param_number']
|
||||
|
||||
def increase_shader_param(self):
|
||||
options = self.data.settings['other']['SHADER_PARAM']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['other']['SHADER_PARAM']['value'] ][0]
|
||||
self.data.settings['other']['SHADER_PARAM']['value'] = options[(current_index + 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Param amountis now ' + str(self.data.settings['other']['SHADER_PARAM']['value']))
|
||||
options = self.data.settings['conjur']['SHADER_PARAM']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['conjur']['SHADER_PARAM']['value'] ][0]
|
||||
self.data.settings['conjur']['SHADER_PARAM']['value'] = options[(current_index + 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Param amountis now ' + str(self.data.settings['conjur']['SHADER_PARAM']['value']))
|
||||
|
||||
def decrease_shader_param(self):
|
||||
options = self.data.settings['other']['SHADER_PARAM']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['other']['SHADER_PARAM']['value'] ][0]
|
||||
self.data.settings['other']['SHADER_PARAM']['value'] = options[(current_index - 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Param amountis now ' + str(self.data.settings['other']['SHADER_PARAM']['value']))
|
||||
options = self.data.settings['conjur']['SHADER_PARAM']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['conjur']['SHADER_PARAM']['value'] ][0]
|
||||
self.data.settings['conjur']['SHADER_PARAM']['value'] = options[(current_index - 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Param amountis now ' + str(self.data.settings['conjur']['SHADER_PARAM']['value']))
|
||||
|
||||
|
||||
def set_fixed_length(self, value):
|
||||
|
||||
@@ -178,10 +178,10 @@ class Data(object):
|
||||
return context
|
||||
|
||||
def _overwrite_values_with_sampler_settings(self, start, end, length):
|
||||
use_rand_start = self.settings['sampler']['RAND_START_MODE']['value'] == 'on'
|
||||
use_fixed_length = self.settings['sampler']['FIXED_LENGTH_MODE']['value'] == 'on'
|
||||
fixed_length_value = self.settings['sampler']['FIXED_LENGTH']['value']
|
||||
fixed_length_multiply = self.settings['sampler']['FIXED_LENGTH_MULTIPLY']['value']
|
||||
use_rand_start = self.settings['recur']['RAND_START_MODE']['value'] == 'on'
|
||||
use_fixed_length = self.settings['recur']['FIXED_LENGTH_MODE']['value'] == 'on'
|
||||
fixed_length_value = self.settings['recur']['FIXED_LENGTH']['value']
|
||||
fixed_length_multiply = self.settings['recur']['FIXED_LENGTH_MULTIPLY']['value']
|
||||
total_fixed_length = fixed_length_value * fixed_length_multiply
|
||||
if start == -1:
|
||||
start = 0
|
||||
@@ -205,7 +205,7 @@ class Data(object):
|
||||
return new_start, new_end
|
||||
|
||||
def _update_next_bankslot_value(self, slot_num, is_current=False):
|
||||
next_setting = self.settings['sampler']['LOAD_NEXT']['value']
|
||||
next_setting = self.settings['recur']['LOAD_NEXT']['value']
|
||||
loaded_slots = self._get_list_of_loaded_slots_in_current_bank()
|
||||
if loaded_slots:
|
||||
if next_setting == 'random':
|
||||
|
||||
@@ -115,7 +115,7 @@ class BrowserMenu(Menu):
|
||||
|
||||
class SettingsMenu(Menu):
|
||||
|
||||
FOLDER_ORDER = ['sampler', 'video', 'midi', 'capture', 'other' ]
|
||||
FOLDER_ORDER = ['recur', 'video', 'incur', 'captur', 'conjur', 'detour', 'other' ]
|
||||
SAMPLER_ORDER = ['LOAD_NEXT', 'RAND_START_MODE', 'FIXED_LENGTH_MODE', 'FIXED_LENGTH' ]
|
||||
VIDEO_ORDER = ['OUTPUT', 'SCREEN_MODE']
|
||||
MIDI_ORDER = ['INPUT', 'STATUS']
|
||||
|
||||
@@ -51,7 +51,7 @@ reading from the a2d can be enabled with the ANALOG_INPUT option in the OTHER su
|
||||
|
||||
din-midi input over serial is now also an option. in the MIDI subsetting the INPUT option now cycles through usb , serial and disabled. again i would only have these listening if midi was being used.
|
||||
|
||||
another new MIDI option is called CYCLE_PORT - this is kind of vague, but i noticed when attaching a midi controller over usb (a broken Edirol PCR50 for what its worth..) that three midi ports were created but only one was receiving the data from controller , and it wasnt the port recur listened to by default. if you are trying to use a usb-midi device thats connecting but not working , it is worth trying CYCLE_PORT and see if that helps ....
|
||||
another new MIDI option is called CYCLE_MIDI_PORT - this is kind of vague, but i noticed when attaching a midi controller over usb (a broken Edirol PCR50 for what its worth..) that three midi ports were created but only one was receiving the data from controller , and it wasnt the port recur listened to by default. if you are trying to use a usb-midi device thats connecting but not working , it is worth trying CYCLE_MIDI_PORT and see if that helps ....
|
||||
|
||||
## c_o_n_j_u_r
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"capture": {
|
||||
"captur": {
|
||||
"TYPE": {
|
||||
"action": "update_capture_settings",
|
||||
"options": [
|
||||
@@ -67,10 +67,18 @@
|
||||
"max"
|
||||
],
|
||||
"value": "auto"
|
||||
}
|
||||
},
|
||||
"USE_OF_CAPTURE": {
|
||||
"action": "set_capture_object",
|
||||
"options": [
|
||||
"yes",
|
||||
"no"
|
||||
],
|
||||
"value": "no"
|
||||
},
|
||||
},
|
||||
"midi": {
|
||||
"CHANNEL": {
|
||||
"incur": {
|
||||
"MIDI_CHANNEL": {
|
||||
"action": null,
|
||||
"options": [
|
||||
1,
|
||||
@@ -92,7 +100,7 @@
|
||||
],
|
||||
"value": 1
|
||||
},
|
||||
"INPUT": {
|
||||
"MIDI_INPUT": {
|
||||
"action": null,
|
||||
"options": [
|
||||
"usb",
|
||||
@@ -101,16 +109,24 @@
|
||||
],
|
||||
"value": "disabled"
|
||||
},
|
||||
"STATUS": {
|
||||
"MIDI_STATUS": {
|
||||
"action": "get_midi_status",
|
||||
"options": [],
|
||||
"value": null
|
||||
},
|
||||
"CYCLE_PORT": {
|
||||
"CYCLE_MIDI_PORT": {
|
||||
"action": "cycle_midi_port_index",
|
||||
"options": [],
|
||||
"value": null
|
||||
}
|
||||
},
|
||||
"ANALOG_INPUT": {
|
||||
"action": null,
|
||||
"options": [
|
||||
"enabled",
|
||||
"disabled"
|
||||
],
|
||||
"value": "disabled"
|
||||
},
|
||||
},
|
||||
"other": {
|
||||
"UPDATE_CODE": {
|
||||
@@ -140,23 +156,14 @@
|
||||
"action": "shutdown_pi",
|
||||
"options": [],
|
||||
"value": null
|
||||
},
|
||||
"OF_SCREEN_SIZE": {
|
||||
"action": "toggle_of_screen_size",
|
||||
"options": [
|
||||
"full",
|
||||
"dev"
|
||||
],
|
||||
"value": "dev"
|
||||
},
|
||||
"USE_OF_CAPTURE": {
|
||||
"action": "set_capture_object",
|
||||
"options": [
|
||||
"yes",
|
||||
"no"
|
||||
],
|
||||
"value": "no"
|
||||
},
|
||||
},
|
||||
"RESTART_OPENFRAMEWORKS": {
|
||||
"action": "restart_openframeworks",
|
||||
"options": [],
|
||||
"value": null
|
||||
}
|
||||
},
|
||||
"conjur": {
|
||||
"VIDEO_BACKEND": {
|
||||
"action": "switch_video_backend",
|
||||
"options": [
|
||||
@@ -179,22 +186,23 @@
|
||||
],
|
||||
"value": 0.10
|
||||
},
|
||||
"ANALOG_INPUT": {
|
||||
"action": null,
|
||||
"options": [
|
||||
"enabled",
|
||||
"disabled"
|
||||
],
|
||||
"value": "disabled"
|
||||
},
|
||||
|
||||
"RESTART_OPENFRAMEWORKS": {
|
||||
"action": "restart_openframeworks",
|
||||
"options": [],
|
||||
"value": null
|
||||
}
|
||||
},
|
||||
"sampler": {
|
||||
"detour": {
|
||||
"TRY_DEMO": {
|
||||
"action": null,
|
||||
"options": [
|
||||
"enabled",
|
||||
"disabled"
|
||||
],
|
||||
"value": "disabled"
|
||||
}
|
||||
},
|
||||
"recur": {
|
||||
"ACTION_GATED": {
|
||||
"action": null,
|
||||
"options": [
|
||||
|
||||
@@ -16,7 +16,7 @@ class AnalogInput(object):
|
||||
|
||||
|
||||
def check_if_listening_enabled(self):
|
||||
if self.data.settings['other']['ANALOG_INPUT']['value'] == 'enabled':
|
||||
if self.data.settings['incur']ANALOG_INPUT']['value'] == 'enabled':
|
||||
if not self.analog_input:
|
||||
try:
|
||||
## note - using software spi for now although on the same pins as the hardware spi described below because hardware spi wasnt working with lcd display
|
||||
@@ -36,7 +36,7 @@ class AnalogInput(object):
|
||||
self.root.after(1000, self.check_if_listening_enabled)
|
||||
|
||||
def poll_analog_inputs(self):
|
||||
if self.data.settings['other']['ANALOG_INPUT']['value'] == 'enabled':
|
||||
if self.data.settings['incur']ANALOG_INPUT']['value'] == 'enabled':
|
||||
|
||||
for i in range(0,8):
|
||||
if str(i) in self.analog_mappings:
|
||||
|
||||
@@ -19,7 +19,7 @@ class MidiInput(object):
|
||||
|
||||
def try_open_port(self):
|
||||
#self.data.midi_status = 'disconnected'
|
||||
self.midi_setting = self.data.settings['midi']['INPUT']['value']
|
||||
self.midi_setting = self.data.settings['incur']['MIDI_INPUT']['value']
|
||||
self.port_index = self.data.midi_port_index
|
||||
#print('try open port : midi setting is {}'.format(midi_setting))
|
||||
if self.midi_setting == 'usb':
|
||||
@@ -52,7 +52,7 @@ class MidiInput(object):
|
||||
for message in self.midi_device.iter_pending():
|
||||
i = i + 1
|
||||
message_dict = message.dict()
|
||||
midi_channel = midi_setting = self.data.settings['midi']['CHANNEL']['value'] - 1
|
||||
midi_channel = midi_setting = self.data.settings['incur']['MIDI_CHANNEL']['value'] - 1
|
||||
|
||||
if not message_dict.get('channel', None) == midi_channel:
|
||||
pass
|
||||
@@ -82,7 +82,7 @@ class MidiInput(object):
|
||||
if i > 0:
|
||||
pass
|
||||
#print('the number processed {}'.format(i))
|
||||
if self.data.settings['midi']['INPUT']['value'] == self.midi_setting and self.data.midi_port_index == self.port_index:
|
||||
if self.data.settings['incur']['MIDI_INPUT']['value'] == self.midi_setting and self.data.midi_port_index == self.port_index:
|
||||
self.root.after(self.midi_delay, self.poll_midi_input)
|
||||
else:
|
||||
self.data.midi_status = 'disconnected'
|
||||
|
||||
@@ -44,7 +44,7 @@ class NumpadInput(object):
|
||||
if self.data.function_on and len(this_mapping[mode]) > 1:
|
||||
print('the action being called is {}'.format(this_mapping[mode][1]))
|
||||
getattr(self.actions, this_mapping[mode][1])()
|
||||
if self.data.settings['sampler']['FUNC_GATED']['value'] == 'off':
|
||||
if self.data.settings['recur']['FUNC_GATED']['value'] == 'off':
|
||||
self.data.function_on = False
|
||||
else:
|
||||
print('the action being called is {}'.format(this_mapping[mode][0]))
|
||||
@@ -57,12 +57,12 @@ class NumpadInput(object):
|
||||
def check_key_release_settings(self, key):
|
||||
|
||||
this_mapping = self.key_mappings[key]
|
||||
if self.data.settings['sampler']['ACTION_GATED']['value'] == 'on':
|
||||
if self.data.settings['recur']['ACTION_GATED']['value'] == 'on':
|
||||
if self.data.control_mode == 'PLAYER' and 'PLAYER' in this_mapping:
|
||||
if this_mapping['PLAYER'][0] == 'toggle_action_on_player' and not self.data.function_on:
|
||||
print('released action key')
|
||||
self.run_action_for_mapped_key(key)
|
||||
if self.data.settings['sampler']['FUNC_GATED']['value'] == 'on':
|
||||
if self.data.settings['recur']['FUNC_GATED']['value'] == 'on':
|
||||
if 'DEFAULT' in this_mapping:
|
||||
if this_mapping['DEFAULT'][0] == 'toggle_function':
|
||||
self.run_action_for_mapped_key(key)
|
||||
|
||||
@@ -51,7 +51,7 @@ class AltVideoPlayer:
|
||||
self.start = 0
|
||||
self.client.send_message("/player/{}/load".format(self.name[0]), [self.location, self.start / self.total_length, self.end / self.total_length, self.rate])
|
||||
self.crop_length = self.end - self.start
|
||||
if 'show' in self.data.settings['sampler']['ON_LOAD']['value']:
|
||||
if 'show' in self.data.settings['recur']['ON_LOAD']['value']:
|
||||
self.set_alpha_value(255)
|
||||
else:
|
||||
pass
|
||||
@@ -63,12 +63,12 @@ class AltVideoPlayer:
|
||||
#return False
|
||||
|
||||
def start_video(self):
|
||||
if 'play' in self.data.settings['sampler']['ON_START']['value']:
|
||||
if 'play' in self.data.settings['recur']['ON_START']['value']:
|
||||
self.status = 'PLAYING'
|
||||
self.client.send_message("/player/{}/play".format(self.name[0]), True)
|
||||
else:
|
||||
self.status = 'START'
|
||||
if 'show' in self.data.settings['sampler']['ON_START']['value']:
|
||||
if 'show' in self.data.settings['recur']['ON_START']['value']:
|
||||
self.set_alpha_value(255)
|
||||
else:
|
||||
self.set_alpha_value(0)
|
||||
|
||||
@@ -33,7 +33,7 @@ class Capture(object):
|
||||
return True
|
||||
except picamera.exc.PiCameraError as e:
|
||||
self.use_capture = False
|
||||
self.data.settings['capture']['DEVICE']['value'] = 'disabled'
|
||||
self.data.settings['captur']['DEVICE']['value'] = 'disabled'
|
||||
print('camera exception is {}'.format(e))
|
||||
self.message_handler.set_message('INFO', 'no capture device attached')
|
||||
return False
|
||||
@@ -41,7 +41,7 @@ class Capture(object):
|
||||
def piCapture_with_no_source(self):
|
||||
is_piCapture = subprocess.check_output(['pivideo', '--query', 'ready'])
|
||||
if 'Video Processor was not found' not in str(is_piCapture):
|
||||
self.data.settings['capture']['TYPE']['value'] = "piCaptureSd1"
|
||||
self.data.settings['captur']['TYPE']['value'] = "piCaptureSd1"
|
||||
is_source = subprocess.check_output(['pivideo', '--query', 'lock'])
|
||||
if 'No active video detected' in str(is_source):
|
||||
self.message_handler.set_message('INFO', 'piCapture detected w no input source')
|
||||
@@ -50,18 +50,18 @@ class Capture(object):
|
||||
|
||||
def update_capture_settings(self):
|
||||
##setting class variables
|
||||
self.use_capture = self.data.settings['capture']['DEVICE']['value'] == 'enabled'
|
||||
self.resolution = self.convert_resolution_value(self.data.settings['capture']['RESOLUTION']['value'])
|
||||
self.framerate = self.convert_framerate_value(self.data.settings['capture']['FRAMERATE']['value'])
|
||||
self.capture_type = self.data.settings['capture']['TYPE']['value']
|
||||
self.use_capture = self.data.settings['captur']['DEVICE']['value'] == 'enabled'
|
||||
self.resolution = self.convert_resolution_value(self.data.settings['captur']['RESOLUTION']['value'])
|
||||
self.framerate = self.convert_framerate_value(self.data.settings['captur']['FRAMERATE']['value'])
|
||||
self.capture_type = self.data.settings['captur']['TYPE']['value']
|
||||
if self.capture_type == "piCaptureSd1":
|
||||
self.sensor_mode = 6
|
||||
else:
|
||||
self.sensor_mode = 0
|
||||
##update current instance (device) if in use
|
||||
if self.device and not self.device.closed:
|
||||
self.device.image_effect = self.data.settings['capture']['IMAGE_EFFECT']['value']
|
||||
self.device.shutter_speed = self.convert_shutter_value(self.data.settings['capture']['SHUTTER']['value'])
|
||||
self.device.image_effect = self.data.settings['captur']['IMAGE_EFFECT']['value']
|
||||
self.device.shutter_speed = self.convert_shutter_value(self.data.settings['captur']['SHUTTER']['value'])
|
||||
## can only update resolution and framerate if not recording
|
||||
if not self.is_recording:
|
||||
self.device.framerate = self.framerate
|
||||
|
||||
@@ -36,7 +36,7 @@ class OfCapture(object):
|
||||
def piCapture_with_no_source(self):
|
||||
is_piCapture = subprocess.check_output(['pivideo', '--query', 'ready'])
|
||||
if 'Video Processor was not found' not in str(is_piCapture):
|
||||
self.data.settings['capture']['TYPE']['value'] = "piCaptureSd1"
|
||||
self.data.settings['captur']['TYPE']['value'] = "piCaptureSd1"
|
||||
is_source = subprocess.check_output(['pivideo', '--query', 'lock'])
|
||||
if 'No active video detected' in str(is_source):
|
||||
self.message_handler.set_message('INFO', 'piCapture detected w no input source')
|
||||
@@ -45,17 +45,17 @@ class OfCapture(object):
|
||||
|
||||
def update_capture_settings(self):
|
||||
##setting class variables
|
||||
self.use_capture = self.data.settings['capture']['DEVICE']['value'] == 'enabled'
|
||||
self.resolution = self.convert_resolution_value(self.data.settings['capture']['RESOLUTION']['value'])
|
||||
self.framerate = self.convert_framerate_value(self.data.settings['capture']['FRAMERATE']['value'])
|
||||
self.capture_type = self.data.settings['capture']['TYPE']['value']
|
||||
self.use_capture = self.data.settings['captur']['DEVICE']['value'] == 'enabled'
|
||||
self.resolution = self.convert_resolution_value(self.data.settings['captur']['RESOLUTION']['value'])
|
||||
self.framerate = self.convert_framerate_value(self.data.settings['captur']['FRAMERATE']['value'])
|
||||
self.capture_type = self.data.settings['captur']['TYPE']['value']
|
||||
if self.capture_type == "piCaptureSd1":
|
||||
self.sensor_mode = 6
|
||||
else:
|
||||
self.sensor_mode = 0
|
||||
|
||||
#self.device.image_effect = self.data.settings['capture']['IMAGE_EFFECT']['value']
|
||||
#self.device.shutter_speed = self.convert_shutter_value(self.data.settings['capture']['SHUTTER']['value'])
|
||||
#self.device.image_effect = self.data.settings['captur']['IMAGE_EFFECT']['value']
|
||||
#self.device.shutter_speed = self.convert_shutter_value(self.data.settings['captur']['SHUTTER']['value'])
|
||||
|
||||
#self.device.framerate = self.framerate
|
||||
#self.device.resolution = self.resolution
|
||||
@@ -68,7 +68,7 @@ class OfCapture(object):
|
||||
return True
|
||||
except picamera.exc.PiCameraError as e:
|
||||
self.use_capture = False
|
||||
self.data.settings['capture']['DEVICE']['value'] = 'disabled'
|
||||
self.data.settings['captur']['DEVICE']['value'] = 'disabled'
|
||||
print('camera exception is {}'.format(e))
|
||||
self.message_handler.set_message('INFO', 'no capture device attached')
|
||||
return False
|
||||
|
||||
@@ -34,8 +34,8 @@ class VideoDriver(object):
|
||||
|
||||
|
||||
def update_video_settings(self):
|
||||
self.switch_on_finish = self.data.settings['sampler']['ON_FINISH']['value'] == 'switch'
|
||||
self.loop_parallel = self.data.settings['sampler']['LOOP_TYPE']['value'] == 'parallel'
|
||||
self.switch_on_finish = self.data.settings['recur']['ON_FINISH']['value'] == 'switch'
|
||||
self.loop_parallel = self.data.settings['recur']['LOOP_TYPE']['value'] == 'parallel'
|
||||
|
||||
def get_next_layer_value(self):
|
||||
if self.layer > 0:
|
||||
@@ -136,7 +136,7 @@ class VideoDriver(object):
|
||||
def reset_all_players(self):
|
||||
self.exit_all_players()
|
||||
|
||||
if(self.data.settings['other']['VIDEO_BACKEND']['value'] == 'openframeworks'):
|
||||
if(self.data.settings['conjur']['VIDEO_BACKEND']['value'] == 'openframeworks'):
|
||||
self.last_player = AltVideoPlayer(self.root, self.message_handler, self.data, self.osc_client, 'a.a')
|
||||
self.current_player = AltVideoPlayer(self.root,self.message_handler, self.data, self.osc_client, 'b.b')
|
||||
self.next_player = AltVideoPlayer(self.root, self.message_handler, self.data, self.osc_client, 'c.c')
|
||||
|
||||
@@ -58,7 +58,7 @@ class VideoPlayer:
|
||||
print('{}: the duration is {}'.format(self.name, self.total_length))
|
||||
if self.start > 0.9:
|
||||
self.set_position(self.start - 0.9)
|
||||
if 'show' in self.data.settings['sampler']['ON_LOAD']['value']:
|
||||
if 'show' in self.data.settings['recur']['ON_LOAD']['value']:
|
||||
self.set_alpha_value(255)
|
||||
else:
|
||||
self.set_alpha_value(0)
|
||||
@@ -80,11 +80,11 @@ class VideoPlayer:
|
||||
self.root.after(5, self.pause_at_start)
|
||||
|
||||
def start_video(self):
|
||||
if 'show' in self.data.settings['sampler']['ON_START']['value']:
|
||||
if 'show' in self.data.settings['recur']['ON_START']['value']:
|
||||
self.set_alpha_value(255)
|
||||
else:
|
||||
self.set_alpha_value(0)
|
||||
if 'play' in self.data.settings['sampler']['ON_START']['value']:
|
||||
if 'play' in self.data.settings['recur']['ON_START']['value']:
|
||||
self.status = 'PLAYING'
|
||||
self.omx_player.play()
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user