summaryrefslogtreecommitdiff
path: root/libs/surfaces/generic_midi/midicontrollable.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/surfaces/generic_midi/midicontrollable.cc')
-rw-r--r--libs/surfaces/generic_midi/midicontrollable.cc52
1 files changed, 26 insertions, 26 deletions
diff --git a/libs/surfaces/generic_midi/midicontrollable.cc b/libs/surfaces/generic_midi/midicontrollable.cc
index 8275d0849c..c16a0bdefd 100644
--- a/libs/surfaces/generic_midi/midicontrollable.cc
+++ b/libs/surfaces/generic_midi/midicontrollable.cc
@@ -1,6 +1,6 @@
/*
Copyright (C) 1998-2006 Paul Davis
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -42,7 +42,7 @@ MIDIControllable::MIDIControllable (Port& p, Controllable& c, bool is_bistate)
control_additional = (byte) -1;
connections = 0;
feedback = true; // for now
-
+
/* use channel 0 ("1") as the initial channel */
midi_rebind (0);
@@ -59,18 +59,18 @@ MIDIControllable::midi_forget ()
/* stop listening for incoming messages, but retain
our existing event + type information.
*/
-
+
if (connections > 0) {
midi_sense_connection[0].disconnect ();
- }
-
+ }
+
if (connections > 1) {
midi_sense_connection[1].disconnect ();
}
-
+
connections = 0;
midi_learn_connection.disconnect ();
-
+
}
void
@@ -101,7 +101,7 @@ MIDIControllable::drop_external_control ()
{
if (connections > 0) {
midi_sense_connection[0].disconnect ();
- }
+ }
if (connections > 1) {
midi_sense_connection[1].disconnect ();
}
@@ -147,14 +147,14 @@ MIDIControllable::midi_to_control(float val)
return val / midi_range * control_range + control_min;
}
-void
-MIDIControllable::midi_sense_note_on (Parser &p, EventTwoBytes *tb)
+void
+MIDIControllable::midi_sense_note_on (Parser &p, EventTwoBytes *tb)
{
midi_sense_note (p, tb, true);
}
-void
-MIDIControllable::midi_sense_note_off (Parser &p, EventTwoBytes *tb)
+void
+MIDIControllable::midi_sense_note_off (Parser &p, EventTwoBytes *tb)
{
midi_sense_note (p, tb, false);
}
@@ -168,7 +168,7 @@ MIDIControllable::midi_sense_note (Parser &, EventTwoBytes *msg, bool is_on)
/* Note: parser handles the use of zero velocity to
mean note off. if we get called with is_on=true, then we
- got a *real* note on.
+ got a *real* note on.
*/
if (msg->note_number == control_additional) {
@@ -209,7 +209,7 @@ MIDIControllable::midi_sense_program_change (Parser &, byte msg)
if (!bistate) {
controllable.set_value (msg/127.0);
last_value = (MIDI::byte) (controllable.get_value() * 127.0); // to prevent feedback fights
- }
+ }
}
void
@@ -221,7 +221,7 @@ MIDIControllable::midi_sense_pitchbend (Parser &, pitchbend_t pb)
controllable.set_value ((pb/(float) SHRT_MAX));
last_value = (MIDI::byte) (controllable.get_value() * 127.0); // to prevent feedback fights
-}
+}
void
MIDIControllable::midi_receiver (Parser &, byte *msg, size_t /*len*/)
@@ -257,7 +257,7 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional)
if (_port.input() == 0) {
return;
}
-
+
Parser& p = *_port.input();
int chn_i = chn;
@@ -284,7 +284,7 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional)
midi_sense_connection[0] = p.channel_note_on[chn_i].connect
(mem_fun (*this, &MIDIControllable::midi_sense_note_on));
if (bistate) {
- midi_sense_connection[1] = p.channel_note_off[chn_i].connect
+ midi_sense_connection[1] = p.channel_note_off[chn_i].connect
(mem_fun (*this, &MIDIControllable::midi_sense_note_off));
connections = 2;
} else {
@@ -294,7 +294,7 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional)
break;
case MIDI::controller:
- midi_sense_connection[0] = p.channel_controller[chn_i].connect
+ midi_sense_connection[0] = p.channel_controller[chn_i].connect
(mem_fun (*this, &MIDIControllable::midi_sense_controller));
connections = 1;
snprintf (buf, sizeof (buf), "MIDI control: Controller %d", control_additional);
@@ -304,7 +304,7 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional)
case MIDI::program:
if (!bistate) {
midi_sense_connection[0] = p.channel_program_change[chn_i].connect
- (mem_fun (*this,
+ (mem_fun (*this,
&MIDIControllable::midi_sense_program_change));
connections = 1;
_control_description = "MIDI control: ProgramChange";
@@ -334,7 +334,7 @@ MIDIControllable::send_feedback ()
return;
}
- msg[0] = (control_type & 0xF0) | (control_channel & 0xF);
+ msg[0] = (control_type & 0xF0) | (control_channel & 0xF);
msg[1] = control_additional;
msg[2] = (byte) (control_to_midi(controllable.get_value()));
@@ -345,9 +345,9 @@ MIDI::byte*
MIDIControllable::write_feedback (MIDI::byte* buf, int32_t& bufsize, bool /*force*/)
{
if (control_type != none && feedback && bufsize > 2) {
-
+
MIDI::byte gm = (MIDI::byte) (control_to_midi(controllable.get_value()));
-
+
if (gm != last_value) {
*buf++ = (0xF0 & control_type) | (0xF & control_channel);
*buf++ = control_additional; /* controller number */
@@ -356,12 +356,12 @@ MIDIControllable::write_feedback (MIDI::byte* buf, int32_t& bufsize, bool /*forc
bufsize -= 3;
}
}
-
+
return buf;
}
-int
-MIDIControllable::set_state (const XMLNode& node, int version)
+int
+MIDIControllable::set_state (const XMLNode& node, int /*version*/)
{
const XMLProperty* prop;
int xx;
@@ -394,7 +394,7 @@ MIDIControllable::set_state (const XMLNode& node, int version)
}
bind_midi (control_channel, control_type, control_additional);
-
+
return 0;
}