#include "evoral/types.hpp"
#include "midi++/types.h"
+#include "midi++/mmc.h"
#include "timecode/time.h"
MidiTimeoutList midi_timeouts;
bool mmc_step_timeout ();
+ void send_immediate_mmc (MIDI::MachineControlCommand);
MIDI::byte mtc_msg[16];
MIDI::byte mtc_timecode_bits; /* encoding of SMTPE type for MTC */
if (g_atomic_int_compare_and_exchange (&_record_status, rs, Recording)) {
_last_record_location = _transport_frame;
- _mmc->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdRecordStrobe));
+ send_immediate_mmc (MIDI::MachineControlCommand (MIDI::MachineControl::cmdRecordStrobe));
if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
set_track_monitor_input_status (true);
if ((!Config->get_latched_record_enable () && !play_loop) || force) {
g_atomic_int_set (&_record_status, Disabled);
- _mmc->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdRecordExit));
+ send_immediate_mmc (MIDI::MachineControlCommand (MIDI::MachineControl::cmdRecordExit));
} else {
if (rs == Recording) {
g_atomic_int_set (&_record_status, Enabled);
enable_record ();
}
} else {
- _mmc->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdRecordPause));
+ send_immediate_mmc (MIDI::MachineControlCommand (MIDI::MachineControl::cmdRecordPause));
RecordStateChanged (); /* EMIT SIGNAL */
}
#include "pbd/error.h"
#include "pbd/pthread_utils.h"
#include "pbd/timersub.h"
+#include "pbd/stacktrace.h"
#include "timecode/time.h"
// Send message at offset 0, sent time is for the start of this cycle
MidiBuffer& mb (_midi_ports->mtc_output_port()->get_midi_buffer (nframes));
- mb.push_back (0, sizeof (msg), msg);
+ mb.push_back (Port::port_offset(), sizeof (msg), msg);
_pframes_since_last_mtc = 0;
return 0;
OUTBOUND MMC STUFF
**********************************************************************/
+void
+Session::send_immediate_mmc (MachineControlCommand c)
+{
+ if (AudioEngine::instance()->in_process_thread()) {
+ _mmc->send (c, Port::port_offset());
+ } else {
+ _mmc->send (c, 0);
+ }
+
+}
bool
Session::mmc_step_timeout ()
// send_full_time_code (0);
_engine.transport_locate (0);
- _mmc->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdMmcReset));
- _mmc->send (MIDI::MachineControlCommand (Timecode::Time ()));
+ send_immediate_mmc (MIDI::MachineControlCommand (MIDI::MachineControl::cmdMmcReset));
+ send_immediate_mmc (MIDI::MachineControlCommand (Timecode::Time ()));
MIDI::Name::MidiPatchManager::instance().set_session (this);
_send_timecode_update = true;
if (!dynamic_cast<MTC_Slave*>(_slave)) {
- _mmc->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdStop));
+ send_immediate_mmc (MIDI::MachineControlCommand (MIDI::MachineControl::cmdStop));
/* This (::non_realtime_stop()) gets called by main
process thread, which will lead to confusion
Timecode::Time time;
timecode_time_subframes (_transport_frame, time);
if (!dynamic_cast<MTC_Slave*>(_slave)) {
- _mmc->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdDeferredPlay));
+ send_immediate_mmc (MIDI::MachineControlCommand (MIDI::MachineControl::cmdDeferredPlay));
}
}
if (!_engine.freewheeling()) {
Timecode::Time time;
timecode_time_subframes (t, time);
- _mmc->send (MIDI::MachineControlCommand (time));
+ send_immediate_mmc (MIDI::MachineControlCommand (time));
}
}