diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-04-28 19:58:24 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-04-28 19:58:24 -0400 |
commit | 2cf411e4be0b10e6ecf47d2070963299b6a810e7 (patch) | |
tree | c6dfb7e7fcd71d5ee2d4a7c2ba490fb882dde3ca /libs/midi++2 | |
parent | b945cda5582d6565ef2ce4fa8cbafee8fd8e5db0 (diff) |
merge (squash) with scenechange topic branch to provide MIDI-driven scene change markers
Diffstat (limited to 'libs/midi++2')
-rw-r--r-- | libs/midi++2/channel.cc | 19 | ||||
-rw-r--r-- | libs/midi++2/midi++/channel.h | 4 | ||||
-rw-r--r-- | libs/midi++2/midi++/parser.h | 5 |
3 files changed, 17 insertions, 11 deletions
diff --git a/libs/midi++2/channel.cc b/libs/midi++2/channel.cc index ed8f4da5bc..190ea18568 100644 --- a/libs/midi++2/channel.cc +++ b/libs/midi++2/channel.cc @@ -115,7 +115,7 @@ Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) all changes *are* atomic. */ - if (tb->controller_number <= 31) { /* unsigned: no test for >= 0 */ + if (tb->controller_number < 32) { /* unsigned: no test for >= 0 */ /* if this controller is already known to use 14 bits, then treat this value as the MSB, and combine it @@ -128,7 +128,7 @@ Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) cv = (unsigned short) _controller_val[tb->controller_number]; if (_controller_14bit[tb->controller_number]) { - cv = ((tb->value << 7) | (cv & 0x7f)); + cv = ((tb->value & 0x7f) << 7) | (cv & 0x7f); } else { cv = tb->value; } @@ -160,8 +160,14 @@ Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) cv = (cv & 0x3f80) | (tb->value & 0x7f); } - _controller_val[tb->controller_number] = - (controller_value_t) cv; + /* update the 14 bit value */ + _controller_val[cn] = (controller_value_t) cv; + + /* also store the "raw" 7 bit value in the incoming controller + value store + */ + _controller_val[tb->controller_number] = (controller_value_t) tb->value; + } else { /* controller can only take 7 bit values */ @@ -173,12 +179,11 @@ Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) /* bank numbers are special, in that they have their own signal */ - if (tb->controller_number == 0) { - _bank_number = (unsigned short) _controller_val[0]; + if (tb->controller_number == 0 || tb->controller_number == 0x20) { + _bank_number = _controller_val[0]; _port.parser()->bank_change (*_port.parser(), _bank_number); _port.parser()->channel_bank_change[_channel_number] (*_port.parser(), _bank_number); } - } void diff --git a/libs/midi++2/midi++/channel.h b/libs/midi++2/midi++/channel.h index 02c16e6729..f3ec434ca5 100644 --- a/libs/midi++2/midi++/channel.h +++ b/libs/midi++2/midi++/channel.h @@ -42,7 +42,7 @@ class LIBMIDIPP_API Channel : public PBD::ScopedConnectionList { Port &midi_port() { return _port; } byte channel() { return _channel_number; } byte program() { return _program_number; } - byte bank() { return _bank_number; } + unsigned short bank() { return _bank_number; } byte pressure () { return _chanpress; } byte poly_pressure (byte n) { return _polypress[n]; } @@ -117,7 +117,7 @@ class LIBMIDIPP_API Channel : public PBD::ScopedConnectionList { /* Current channel values */ byte _channel_number; - byte _bank_number; + unsigned short _bank_number; byte _program_number; byte _rpn_msb; byte _rpn_lsb; diff --git a/libs/midi++2/midi++/parser.h b/libs/midi++2/midi++/parser.h index e4126b210b..420e7fcb7b 100644 --- a/libs/midi++2/midi++/parser.h +++ b/libs/midi++2/midi++/parser.h @@ -34,6 +34,7 @@ class Port; class Parser; typedef PBD::Signal1<void,Parser&> ZeroByteSignal; +typedef PBD::Signal2<void,Parser&,unsigned short> BankSignal; typedef PBD::Signal2<void,Parser&,framecnt_t> TimestampedSignal; typedef PBD::Signal2<void,Parser&, byte> OneByteSignal; typedef PBD::Signal2<void,Parser &, EventTwoBytes *> TwoByteSignal; @@ -55,7 +56,7 @@ class LIBMIDIPP_API Parser { /* signals that anyone can connect to */ - OneByteSignal bank_change; + BankSignal bank_change; TwoByteSignal note_on; TwoByteSignal note_off; TwoByteSignal poly_pressure; @@ -64,7 +65,7 @@ class LIBMIDIPP_API Parser { PitchBendSignal pitchbend; TwoByteSignal controller; - OneByteSignal channel_bank_change[16]; + BankSignal channel_bank_change[16]; TwoByteSignal channel_note_on[16]; TwoByteSignal channel_note_off[16]; TwoByteSignal channel_poly_pressure[16]; |