gobject.timeout_add_seconds(1, close_sense_timeout, window, entry)
def on_sense_midi_volume_clicked(self, *args):
+ self.mixer.last_midi_channel = int(self.entry_volume_cc.get_text())
self.sense_popup_dialog(self.entry_volume_cc)
def on_sense_midi_balance_clicked(self, *args):
+ self.mixer.last_midi_channel = int(self.entry_balance_cc.get_text())
self.sense_popup_dialog(self.entry_balance_cc)
def on_sense_midi_mute_clicked(self, *args):
+ self.mixer.last_midi_channel = int(self.entry_mute_cc.get_text())
self.sense_popup_dialog(self.entry_mute_cc)
def on_response_cb(self, dlg, response_id, *args):
jack_port_t * port_midi_in;
jack_port_t * port_midi_out;
- unsigned int last_midi_channel;
+ int last_midi_channel;
struct channel* midi_cc_map[128];
};
unsigned int
channel_set_balance_midi_cc(
jack_mixer_channel_t channel,
- unsigned int new_cc)
+ int new_cc)
{
- if (new_cc > 127) {
- return 2; /* error: over limit CC */
+ if (new_cc < 0 || new_cc > 127) {
+ return 2; /* error: outside limit CC */
}
if (channel_ptr->mixer_ptr->midi_cc_map[new_cc] != NULL) {
if (channel_ptr->mixer_ptr->midi_cc_map[new_cc]->midi_cc_volume_index == new_cc) {
unsigned int
channel_set_volume_midi_cc(
- jack_mixer_channel_t channel, unsigned int new_cc)
+ jack_mixer_channel_t channel, int new_cc)
{
- if (new_cc > 127) {
- return 2; /* error: over limit CC */
+ if (new_cc< 0 || new_cc > 127) {
+ return 2; /* error: outside limit CC */
}
if (channel_ptr->mixer_ptr->midi_cc_map[new_cc] != NULL) {
if (channel_ptr->mixer_ptr->midi_cc_map[new_cc]->midi_cc_volume_index == new_cc) {
unsigned int
channel_set_mute_midi_cc(
jack_mixer_channel_t channel,
- unsigned int new_cc)
+ int new_cc)
{
- if (new_cc > 127) {
- return 2; /* error: over limit CC */
+ if (new_cc < 0 || new_cc > 127) {
+ return 2; /* error: outside limit CC */
}
if (channel_ptr->mixer_ptr->midi_cc_map[new_cc] != NULL) {
if (channel_ptr->mixer_ptr->midi_cc_map[new_cc]->midi_cc_volume_index == new_cc) {
mixer_ptr->input_channels_list = NULL;
mixer_ptr->output_channels_list = NULL;
- mixer_ptr->last_midi_channel = 0;
+ mixer_ptr->last_midi_channel = -1;
for (i = 0 ; i < 128 ; i++)
{
return jack_get_client_name(mixer_ctx_ptr->jack_client);
}
-unsigned int
+int
get_last_midi_channel(
jack_mixer_t mixer)
{
return mixer_ctx_ptr->last_midi_channel;
}
+unsigned int
+set_last_midi_channel(
+ jack_mixer_t mixer,
+ int new_channel) {
+ mixer_ctx_ptr->last_midi_channel = new_channel;
+ return 0;
+}
+
jack_mixer_channel_t
add_channel(
jack_mixer_t mixer,
get_client_name(
jack_mixer_t mixer);
-unsigned int
+int
get_last_midi_channel(
jack_mixer_t mixer);
+unsigned int
+set_last_midi_channel(
+ jack_mixer_t mixer,
+ int new_channel);
+
jack_mixer_channel_t
add_channel(
jack_mixer_t mixer,
unsigned int
channel_set_balance_midi_cc(
jack_mixer_channel_t channel,
- unsigned int new_cc);
+ int new_cc);
int
channel_get_volume_midi_cc(
unsigned int
channel_set_volume_midi_cc(
jack_mixer_channel_t channel,
- unsigned int new_cc);
+ int new_cc);
int
channel_get_mute_midi_cc(
unsigned int
channel_set_mute_midi_cc(
jack_mixer_channel_t channel,
- unsigned int new_cc);
+ int new_cc);
void
channel_autoset_midi_cc(
static int
Channel_set_balance_midi_cc(ChannelObject *self, PyObject *value, void *closure)
{
- unsigned int new_cc;
+ int new_cc;
unsigned int result;
new_cc = PyInt_AsLong(value);
if (result == 0) {
return 0;
}
- if (result == 1) {
- PyErr_SetString(PyExc_RuntimeError, "value already in use");
- } else if (result == 2) {
+ if (result == 2) {
PyErr_SetString(PyExc_RuntimeError, "value out of range");
}
return -1;
static int
Channel_set_volume_midi_cc(ChannelObject *self, PyObject *value, void *closure)
{
- unsigned int new_cc;
+ int new_cc;
unsigned int result;
new_cc = PyInt_AsLong(value);
if (result == 0) {
return 0;
}
- if (result == 1) {
- PyErr_SetString(PyExc_RuntimeError, "value already in use");
- } else if (result == 2) {
+ if (result == 2) {
PyErr_SetString(PyExc_RuntimeError, "value out of range");
}
return -1;
static int
Channel_set_mute_midi_cc(ChannelObject *self, PyObject *value, void *closure)
{
- unsigned int new_cc;
+ int new_cc;
unsigned int result;
new_cc = PyInt_AsLong(value);
if (result == 0) {
return 0;
}
- if (result == 1) {
- PyErr_SetString(PyExc_RuntimeError, "value already in use");
- } else if (result == 2) {
+ if (result == 2) {
PyErr_SetString(PyExc_RuntimeError, "value out of range");
}
return -1;
return PyInt_FromLong(get_last_midi_channel(self->mixer));
}
+static int
+Mixer_set_last_midi_channel(MixerObject *self, PyObject *value, void *closure)
+{
+ int new_channel;
+ unsigned int result;
+
+ new_channel = PyInt_AsLong(value);
+ result = set_last_midi_channel(self->mixer, new_channel);
+ if (result == 0) {
+ return 0;
+ }
+ return -1;
+}
static PyGetSetDef Mixer_getseters[] = {
{"channels_count", (getter)Mixer_get_channels_count, NULL,
"channels count", NULL},
- {"last_midi_channel", (getter)Mixer_get_last_midi_channel, NULL,
+ {"last_midi_channel", (getter)Mixer_get_last_midi_channel, (setter)Mixer_set_last_midi_channel,
"last midi channel", NULL},
{NULL}
};