Skip to content

Commit

Permalink
show engine's midi_chan when we-re on engine page
Browse files Browse the repository at this point in the history
  • Loading branch information
notmart committed Jul 23, 2021
1 parent 24811cf commit eab0b04
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
4 changes: 3 additions & 1 deletion qml-ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ Kirigami.AbstractApplicationWindow {
highlighted: zynthian.current_screen_id === 'main'
}
ZComponentsPrivate.BreadcrumbButton {
text: zynthian.layer.selector_path_element + "ˬ"
text: screensLayer.layers.depth > 1 && zynthian.engine.midi_channel !== null && zynthian.current_screen_id === 'engine'
? (zynthian.engine.midi_channel + 1) + ""
: zynthian.layer.selector_path_element + "ˬ"
onClicked: layersMenu.visible = true
highlighted: zynthian.current_screen_id === 'layer'
ZComponentsPrivate.ActionsMenu {
Expand Down
19 changes: 16 additions & 3 deletions zynqtgui/zynthian_gui_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
from . import zynthian_gui_config
from . import zynthian_gui_selector

from PySide2.QtCore import Qt, QObject, Slot, Signal, Property

#------------------------------------------------------------------------------
# Zynthian Engine Selection GUI Class
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -90,22 +92,28 @@ def __init__(self, parent = None):
self.only_categories = False
self.single_category = None

def set_midi_channel(self, chan):
self.midi_chan = chan
self.midi_channel_changed.emit()

def get_midi_channel(self):
return self.midi_chan

def set_engine_type(self, etype):
self.engine_type = etype
self.midi_chan = None
self.set_midi_channel(None)
self.reset_index = True


def set_fxchain_mode(self, midi_chan):
self.engine_type = "Audio Effect"
self.midi_chan = midi_chan
self.set_midi_channel(midi_chan)
self.reset_index = True


def set_midichain_mode(self, midi_chan):
self.engine_type = "MIDI Tool"
self.midi_chan = midi_chan
self.set_midi_channel(midi_chan)
self.reset_index = True
self.init_engine_info()

Expand Down Expand Up @@ -230,4 +238,9 @@ def set_select_path(self):
self.select_path_element = "Engine"
super().set_select_path()


midi_channel_changed = Signal()

midi_channel = Property(int, get_midi_channel, set_midi_channel, notify = midi_channel_changed)

#------------------------------------------------------------------------------
2 changes: 1 addition & 1 deletion zynqtgui/zynthian_gui_fixed_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def select_action(self, i, t='S'):
self.layer_chain_parallel = False
self.zyngui.screens['engine'].set_engine_type("MIDI Synth")
self.layer_index_replace_engine = self.index
self.zyngui.screens['engine'].midi_chan = self.index
self.zyngui.screens['engine'].set_midi_channel(self.index)
self.zyngui.show_modal('engine')


Expand Down
4 changes: 2 additions & 2 deletions zynqtgui/zynthian_gui_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def activate_midican_layer(self, midi_chan):
self.replace_layer_index = None
self.layer_chain_parallel = False
self.zyngui.screens['engine'].set_engine_type("MIDI Synth")
self.zyngui.screens['engine'].midi_chan = midi_chan
self.zyngui.screens['engine'].set_midi_channel(midi_chan)
self.layer_index_replace_engine = None
self.zyngui.show_modal('engine')

Expand Down Expand Up @@ -298,7 +298,7 @@ def select_engine(self):
self.layer_chain_parallel = False
self.zyngui.screens['engine'].set_engine_type("MIDI Synth")
self.layer_index_replace_engine = self.index
self.zyngui.screens['engine'].midi_chan = self.layers[self.index].midi_chan
self.zyngui.screens['engine'].set_midi_channel(self.layers[self.index].midi_chan)
self.zyngui.show_modal('engine')


Expand Down

0 comments on commit eab0b04

Please sign in to comment.