fix assumption that Session::_mmc != 0

git-svn-id: svn://localhost/ardour2/branches/3.0@7349 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2010-07-01 15:03:49 +00:00
parent d4db53e554
commit 601dc846da
5 changed files with 45 additions and 26 deletions

View File

@@ -230,26 +230,26 @@ Session::set_trace_midi_input (bool yn, MIDI::Port* port)
}
} else {
if (_mmc->port()) {
if (_mmc && _mmc->port()) {
if ((input_parser = _mmc->port()->input()) != 0) {
input_parser->trace (yn, &cout, "input: ");
}
}
if (_mtc_port && _mtc_port != _mmc->port()) {
if (_mtc_port && (!_mmc || (_mtc_port != _mmc->port()))) {
if ((input_parser = _mtc_port->input()) != 0) {
input_parser->trace (yn, &cout, "input: ");
}
}
if (_midi_port && _midi_port != _mmc->port() && _midi_port != _mtc_port ) {
if (_midi_port && (!_mmc || (_midi_port != _mmc->port())) && _midi_port != _mtc_port ) {
if ((input_parser = _midi_port->input()) != 0) {
input_parser->trace (yn, &cout, "input: ");
}
}
if (_midi_clock_port
&& _midi_clock_port != _mmc->port()
&& (!_mmc || (_midi_clock_port != _mmc->port()))
&& _midi_clock_port != _mtc_port
&& _midi_clock_port != _midi_port) {
if ((input_parser = _midi_clock_port->input()) != 0) {
@@ -271,7 +271,7 @@ Session::set_trace_midi_output (bool yn, MIDI::Port* port)
output_parser->trace (yn, &cout, "output: ");
}
} else {
if (_mmc->port()) {
if (_mmc && _mmc->port()) {
if ((output_parser = _mmc->port()->output()) != 0) {
output_parser->trace (yn, &cout, "output: ");
}
@@ -283,7 +283,7 @@ Session::set_trace_midi_output (bool yn, MIDI::Port* port)
}
}
if (_midi_port && _midi_port != _mmc->port() && _midi_port != _mtc_port ) {
if (_midi_port && (!_mmc || (_midi_port != _mmc->port())) && _midi_port != _mtc_port ) {
if ((output_parser = _midi_port->output()) != 0) {
output_parser->trace (yn, &cout, "output: ");
}
@@ -304,7 +304,7 @@ Session::get_trace_midi_input(MIDI::Port *port)
}
}
else {
if (_mmc->port()) {
if (_mmc && _mmc->port()) {
if ((input_parser = _mmc->port()->input()) != 0) {
return input_parser->tracing();
}
@@ -336,7 +336,7 @@ Session::get_trace_midi_output(MIDI::Port *port)
}
}
else {
if (_mmc->port()) {
if (_mmc && _mmc->port()) {
if ((output_parser = _mmc->port()->output()) != 0) {
return output_parser->tracing();
}

View File

@@ -69,7 +69,9 @@ Session::process (nframes_t nframes)
}
}
_mmc->flush_pending ();
if (_mmc) {
_mmc->flush_pending ();
}
_engine.main_thread()->get_buffers ();

View File

@@ -352,8 +352,11 @@ Session::second_stage_init ()
send_full_time_code (0);
_engine.transport_locate (0);
_mmc->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdMmcReset));
_mmc->send (MIDI::MachineControlCommand (Timecode::Time ()));
if (_mmc) {
_mmc->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdMmcReset));
_mmc->send (MIDI::MachineControlCommand (Timecode::Time ()));
}
MidiClockTicker::instance().set_session (this);
MIDI::Name::MidiPatchManager::instance().set_session (this);
@@ -3191,11 +3194,15 @@ Session::config_changed (std::string p, bool ours)
} else if (p == "mmc-device-id" || p == "mmc-receive-id") {
_mmc->set_receive_device_id (Config->get_mmc_receive_device_id());
if (_mmc) {
_mmc->set_receive_device_id (Config->get_mmc_receive_device_id());
}
} else if (p == "mmc-send-id") {
_mmc->set_send_device_id (Config->get_mmc_send_device_id());
if (_mmc) {
_mmc->set_send_device_id (Config->get_mmc_send_device_id());
}
} else if (p == "midi-control") {
@@ -3261,7 +3268,9 @@ Session::config_changed (std::string p, bool ours)
} else if (p == "send-mmc") {
_mmc->enable_send (Config->get_send_mmc ());
if (_mmc) {
_mmc->enable_send (Config->get_send_mmc ());
}
} else if (p == "midi-feedback") {
@@ -3309,7 +3318,7 @@ Session::config_changed (std::string p, bool ours)
sync_order_keys ("session");
} else if (p == "initial-program-change") {
if (_mmc->port() && Config->get_initial_program_change() >= 0) {
if (_mmc && _mmc->port() && Config->get_initial_program_change() >= 0) {
MIDI::byte buf[2];
buf[0] = MIDI::program; // channel zero by default
@@ -3318,8 +3327,8 @@ Session::config_changed (std::string p, bool ours)
_mmc->port()->midimsg (buf, sizeof (buf), 0);
}
} else if (p == "initial-program-change") {
if (_mmc->port() && Config->get_initial_program_change() >= 0) {
if (_mmc && _mmc->port() && Config->get_initial_program_change() >= 0) {
MIDI::byte* buf = new MIDI::byte[2];
buf[0] = MIDI::program; // channel zero by default
@@ -3377,6 +3386,10 @@ Session::load_diskstreams_2X (XMLNode const & node, int)
void
Session::setup_midi_machine_control ()
{
if (!default_mmc_port) {
return;
}
_mmc = new MIDI::MachineControl;
_mmc->set_port (default_mmc_port);

View File

@@ -183,10 +183,13 @@ Session::realtime_stop (bool abort, bool clear_state)
// FIXME: where should this really be? [DR]
//send_full_time_code();
_mmc->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdStop));
Timecode::Time time;
timecode_time_subframes (_transport_frame, time);
_mmc->send (MIDI::MachineControlCommand (time));
if (_mmc) {
Timecode::Time time;
timecode_time_subframes (_transport_frame, time);
_mmc->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdStop));
_mmc->send (MIDI::MachineControlCommand (time));
}
if (_transport_speed < 0.0f) {
todo = (PostTransportWork (todo | PostTransportStop | PostTransportReverse));
@@ -893,7 +896,7 @@ Session::locate (nframes64_t target_frame, bool with_roll, bool with_flush, bool
_send_timecode_update = true;
if (with_mmc) {
if (with_mmc && _mmc) {
Timecode::Time time;
timecode_time_subframes (_transport_frame, time);
_mmc->send (MIDI::MachineControlCommand (time));
@@ -1133,9 +1136,11 @@ Session::start_transport ()
}
}
Timecode::Time time;
timecode_time_subframes (_transport_frame, time);
_mmc->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdDeferredPlay));
if (_mmc) {
Timecode::Time time;
timecode_time_subframes (_transport_frame, time);
_mmc->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdDeferredPlay));
}
TransportStateChange (); /* EMIT SIGNAL */
}

View File

@@ -384,7 +384,6 @@ SMFSource::mark_streaming_write_completed ()
MidiSource::mark_streaming_write_completed();
if (!writable()) {
cerr << "\n\n\n[[[[[[[[[ This SMFS is not writable! ]]]]]]]]]]]\n\n\n";
return;
}