]> git.0d.be Git - jack_mixer.git/commitdiff
Serialize prefader button states
authorDaniel Sheeler <dsheeler@pobox.com>
Sun, 5 Jul 2020 09:49:59 +0000 (04:49 -0500)
committerDaniel Sheeler <dsheeler@pobox.com>
Sun, 5 Jul 2020 09:49:59 +0000 (04:49 -0500)
channel.py
jack_mixer.c
jack_mixer.h
jack_mixer_c.c

index cdb6781f76e214f5b30226ac89e632cf1f906ea6..297bbc4b403a4107563e4eb124a69aa183b34cc1 100644 (file)
@@ -618,6 +618,7 @@ class OutputChannel(Channel):
 
     _init_muted_channels = None
     _init_solo_channels = None
+    _init_prefader_channels = None
 
     def __init__(self, app, name, stereo, value = None):
         Channel.__init__(self, app, name, stereo, value)
@@ -708,8 +709,11 @@ class OutputChannel(Channel):
                 ctlgroup.mute.set_active(True)
             if self._init_solo_channels and input_channel.channel.name in self._init_solo_channels:
                 ctlgroup.solo.set_active(True)
+            if self._init_prefader_channels and input_channel.channel.name in self._init_prefader_channels:
+                ctlgroup.prefader.set_active(True)
         self._init_muted_channels = None
         self._init_solo_channels = None
+        self._init_prefader_channels = None
 
     channel_properties_dialog = None
     def on_channel_properties(self):
@@ -754,15 +758,20 @@ class OutputChannel(Channel):
             object_backend.add_property("solo_buttons", "true")
         muted_channels = []
         solo_channels = []
+        prefader_in_channels = []
         for input_channel in self.app.channels:
             if self.channel.is_muted(input_channel.channel):
                 muted_channels.append(input_channel)
             if self.channel.is_solo(input_channel.channel):
                 solo_channels.append(input_channel)
+            if self.channel.is_in_prefader(input_channel.channel):
+                prefader_in_channels.append(input_channel)
         if muted_channels:
             object_backend.add_property('muted_channels', '|'.join([x.channel.name for x in muted_channels]))
         if solo_channels:
             object_backend.add_property('solo_channels', '|'.join([x.channel.name for x in solo_channels]))
+        if prefader_in_channels:
+            object_backend.add_property('prefader_channels', '|'.join([x.channel.name for x in prefader_in_channels]))
         object_backend.add_property("color", self.color.to_string())
         Channel.serialize(self, object_backend)
 
@@ -787,6 +796,9 @@ class OutputChannel(Channel):
         if name == 'solo_channels':
             self._init_solo_channels = value.split('|')
             return True
+        if name == 'prefader_channels':
+            self._init_prefader_channels = value.split('|')
+            return True
         if name == 'color':
             c = Gdk.RGBA()
             c.parse(value)
@@ -1154,7 +1166,7 @@ class ControlGroup(Gtk.Alignment):
         pre.set_name("pre_fader")
         pre.set_tooltip_text("Pre (on) / Post (off) fader send")
         pre.connect("toggled", self.on_prefader_toggled)
-
+        self.prefader = pre
         self.buttons_box.pack_start(pre, True, True, button_padding)
         self.buttons_box.pack_start(mute, True, True, button_padding)
         if self.output_channel.display_solo_buttons:
index 533e166544de2b43cb094bb6a0db84a9a9d83c3c..de315e209a3a0bc8797f5b0cca4786ddf44e61ec 100644 (file)
@@ -1828,3 +1828,15 @@ output_channel_set_in_prefader(
     output_channel_ptr->prefader_channels = g_slist_remove(output_channel_ptr->prefader_channels, channel);
   }
 }
+
+bool
+output_channel_is_in_prefader(
+  jack_mixer_output_channel_t output_channel,
+  jack_mixer_channel_t channel)
+{
+  struct output_channel *output_channel_ptr = output_channel;
+
+  if (g_slist_find(output_channel_ptr->prefader_channels, channel) != NULL)
+    return true;
+  return false;
+}
index 5141fd26648036ec2b582c4adf9dcab654be44fc..cfb1cb8265256cee9ae21d4f0ab0cc1df76b14ef 100644 (file)
@@ -293,4 +293,9 @@ void output_channel_set_in_prefader(jack_mixer_output_channel_t output_channel,
   jack_mixer_channel_t input_channel,
   bool prefader_value);
 
+bool
+output_channel_is_in_prefader(
+  jack_mixer_output_channel_t output_channel,
+  jack_mixer_channel_t channel);
+
 #endif /* #ifndef JACK_MIXER_H__DAEB51D8_5861_40F2_92E4_24CA495A384D__INCLUDED */
index 17478780b457ef67e9d1f2ca76d9f0ba4f143502..3e93a7e55a1e0df0168c624b53ed376ade20cce2 100644 (file)
@@ -794,6 +794,26 @@ OutputChannel_set_in_prefader(OutputChannelObject *self, PyObject *args)
        Py_INCREF(Py_None);
        return Py_None;
 }
+
+static PyObject*
+OutputChannel_is_in_prefader(OutputChannelObject *self, PyObject *args)
+{
+       PyObject *channel;
+       PyObject *result;
+
+       if (! PyArg_ParseTuple(args, "O", &channel)) return NULL;
+
+       if (output_channel_is_in_prefader(self->output_channel,
+                       ((ChannelObject*)channel)->channel)) {
+               result = Py_True;
+       } else {
+               result = Py_False;
+       }
+
+       Py_INCREF(result);
+       return result;
+}
+
 static PyMethodDef output_channel_methods[] = {
        {"remove", (PyCFunction)OutputChannel_remove, METH_VARARGS, "Remove"},
        {"set_solo", (PyCFunction)OutputChannel_set_solo, METH_VARARGS, "Set a channel as solo"},
@@ -801,6 +821,7 @@ static PyMethodDef output_channel_methods[] = {
        {"is_solo", (PyCFunction)OutputChannel_is_solo, METH_VARARGS, "Is a channel set as solo"},
        {"is_muted", (PyCFunction)OutputChannel_is_muted, METH_VARARGS, "Is a channel set as muted"},
        {"set_in_prefader", (PyCFunction)OutputChannel_set_in_prefader, METH_VARARGS, "Set a channel as prefader"},
+       {"is_in_prefader", (PyCFunction)OutputChannel_is_in_prefader, METH_VARARGS, "Is a channel set as prefader"},
        {NULL}
 };