X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fmidi%2B%2B2%2Fchannel.cc;h=66ce5ed71ca6ad99f407d7f23f01d94b0ac8cca6;hb=b8b8384a261a547696a0e4400353fceffcb5d284;hp=bf71b0579c617760f61174f1f7c129984803e727;hpb=aae367b63c9b619db1e40f27dc334c6987219481;p=ardour.git diff --git a/libs/midi++2/channel.cc b/libs/midi++2/channel.cc index bf71b0579c..66ce5ed71c 100644 --- a/libs/midi++2/channel.cc +++ b/libs/midi++2/channel.cc @@ -25,7 +25,8 @@ using namespace MIDI; -Channel::Channel (byte channelnum, Port &p) : _port (p) +Channel::Channel (byte channelnum, Port &p) + : _port (p) { _channel_number = channelnum; @@ -33,36 +34,21 @@ Channel::Channel (byte channelnum, Port &p) : _port (p) } void -Channel::connect_input_signals () +Channel::connect_signals () { - _port.input()->channel_pressure[_channel_number].connect (*this, boost::bind (&Channel::process_chanpress, this, _1, _2)); - _port.input()->channel_note_on[_channel_number].connect (*this, boost::bind (&Channel::process_note_on, this, _1, _2)); - _port.input()->channel_note_off[_channel_number].connect (*this, boost::bind (&Channel::process_note_off, this, _1, _2)); - _port.input()->channel_poly_pressure[_channel_number].connect (*this, boost::bind (&Channel::process_polypress, this, _1, _2)); - _port.input()->channel_program_change[_channel_number].connect (*this, boost::bind (&Channel::process_program_change, this, _1, _2)); - _port.input()->channel_controller[_channel_number].connect (*this, boost::bind (&Channel::process_controller, this, _1, _2)); - _port.input()->channel_pitchbend[_channel_number].connect (*this, boost::bind (&Channel::process_pitchbend, this, _1, _2)); - - _port.input()->reset.connect (*this, boost::bind (&Channel::process_reset, this, _1)); + _port.parser()->channel_pressure[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_chanpress, this, _1, _2)); + _port.parser()->channel_note_on[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_note_on, this, _1, _2)); + _port.parser()->channel_note_off[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_note_off, this, _1, _2)); + _port.parser()->channel_poly_pressure[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_polypress, this, _1, _2)); + _port.parser()->channel_program_change[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_program_change, this, _1, _2)); + _port.parser()->channel_controller[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_controller, this, _1, _2)); + _port.parser()->channel_pitchbend[_channel_number].connect_same_thread (*this, boost::bind (&Channel::process_pitchbend, this, _1, _2)); + + _port.parser()->reset.connect_same_thread (*this, boost::bind (&Channel::process_reset, this, _1)); } void -Channel::connect_output_signals () - -{ - _port.output()->channel_pressure[_channel_number].connect (*this, boost::bind (&Channel::process_chanpress, this, _1, _2)); - _port.output()->channel_note_on[_channel_number].connect (*this, boost::bind (&Channel::process_note_on, this, _1, _2)); - _port.output()->channel_note_off[_channel_number].connect (*this, boost::bind (&Channel::process_note_off, this, _1, _2)); - _port.output()->channel_poly_pressure[_channel_number].connect (*this, boost::bind (&Channel::process_polypress, this, _1, _2)); - _port.output()->channel_program_change[_channel_number].connect (*this, boost::bind (&Channel::process_program_change, this, _1, _2)); - _port.output()->channel_controller[_channel_number].connect (*this, boost::bind (&Channel::process_controller, this, _1, _2)); - _port.output()->channel_pitchbend[_channel_number].connect (*this, boost::bind (&Channel::process_pitchbend, this, _1, _2)); - - _port.output()->reset.connect (*this, boost::bind (&Channel::process_reset, this, _1)); -} - -void -Channel::reset (timestamp_t timestamp, nframes_t /*nframes*/, bool notes_off) +Channel::reset (timestamp_t timestamp, framecnt_t /*nframes*/, bool notes_off) { _program_number = _channel_number; _bank_number = 0; @@ -189,11 +175,8 @@ Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) if (tb->controller_number == 0) { _bank_number = (unsigned short) _controller_val[0]; - if (_port.input()) { - _port.input()->bank_change (*_port.input(), _bank_number); - _port.input()->channel_bank_change[_channel_number] - (*_port.input(), _bank_number); - } + _port.parser()->bank_change (*_port.parser(), _bank_number); + _port.parser()->channel_bank_change[_channel_number] (*_port.parser(), _bank_number); } }