mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-30 17:03:06 +01:00
fix delivery of MMC events under split process cycle conditions
This commit is contained in:
parent
e32a8e8260
commit
679356c5ee
5 changed files with 22 additions and 9 deletions
|
|
@ -48,6 +48,7 @@
|
|||
#include "evoral/types.hpp"
|
||||
|
||||
#include "midi++/types.h"
|
||||
#include "midi++/mmc.h"
|
||||
|
||||
#include "timecode/time.h"
|
||||
|
||||
|
|
@ -1248,6 +1249,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
|
|||
|
||||
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 */
|
||||
|
|
|
|||
|
|
@ -1380,7 +1380,7 @@ Session::enable_record ()
|
|||
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);
|
||||
|
|
@ -1401,7 +1401,7 @@ Session::disable_record (bool rt_context, bool force)
|
|||
|
||||
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);
|
||||
|
|
@ -1455,7 +1455,7 @@ Session::maybe_enable_record ()
|
|||
enable_record ();
|
||||
}
|
||||
} else {
|
||||
_mmc->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdRecordPause));
|
||||
send_immediate_mmc (MIDI::MachineControlCommand (MIDI::MachineControl::cmdRecordPause));
|
||||
RecordStateChanged (); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "pbd/error.h"
|
||||
#include "pbd/pthread_utils.h"
|
||||
#include "pbd/timersub.h"
|
||||
#include "pbd/stacktrace.h"
|
||||
|
||||
#include "timecode/time.h"
|
||||
|
||||
|
|
@ -425,7 +426,7 @@ Session::send_full_time_code (framepos_t const t, MIDI::pframes_t nframes)
|
|||
// 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;
|
||||
|
|
@ -551,6 +552,16 @@ Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_f
|
|||
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 ()
|
||||
|
|
|
|||
|
|
@ -334,8 +334,8 @@ Session::post_engine_init ()
|
|||
// 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);
|
||||
|
||||
|
|
|
|||
|
|
@ -656,7 +656,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
|
|||
_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
|
||||
|
|
@ -1371,7 +1371,7 @@ Session::start_transport ()
|
|||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1759,7 +1759,7 @@ Session::send_mmc_locate (framepos_t t)
|
|||
if (!_engine.freewheeling()) {
|
||||
Timecode::Time time;
|
||||
timecode_time_subframes (t, time);
|
||||
_mmc->send (MIDI::MachineControlCommand (time));
|
||||
send_immediate_mmc (MIDI::MachineControlCommand (time));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue