/// the number of frames processed since start() was called
framecnt_t _processed_frames;
bool _freewheeling;
+ bool _pre_freewheel_mmc_enabled;
int _usecs_per_cycle;
bool port_remove_in_progress;
int jack_sync_callback (jack_transport_state_t, jack_position_t*);
int jack_bufsize_callback (pframes_t);
int jack_sample_rate_callback (pframes_t);
+ void freewheel_callback (int);
void set_jack_callbacks ();
int pre_export ();
int stop_audio_export ();
void finalize_audio_export ();
+ bool _pre_export_mmc_enabled;
PBD::ScopedConnection export_freewheel_connection;
_frame_rate = 0;
_buffer_size = 0;
_freewheeling = false;
+ _pre_freewheel_mmc_enabled = false;
_main_thread = 0;
port_remove_in_progress = false;
void
AudioEngine::_freewheel_callback (int onoff, void *arg)
{
- static_cast<AudioEngine*>(arg)->_freewheeling = onoff;
+ static_cast<AudioEngine*>(arg)->freewheel_callback (onoff);
+}
+
+void
+AudioEngine::freewheel_callback (int onoff)
+{
+ _freewheeling = onoff;
+
+ if (onoff) {
+ _pre_freewheel_mmc_enabled = MIDI::Manager::instance()->mmc()->send_enabled ();
+ MIDI::Manager::instance()->mmc()->enable_send (false);
+ } else {
+ MIDI::Manager::instance()->mmc()->enable_send (_pre_freewheel_mmc_enabled);
+ }
}
void
#include "pbd/error.h"
#include <glibmm/thread.h>
+#include <midi++/manager.h>
+#include <midi++/mmc.h>
+
#include "ardour/audioengine.h"
#include "ardour/butler.h"
#include "ardour/export_failed.h"
export_status->running = true;
export_status->Aborting.connect_same_thread (*this, boost::bind (&Session::stop_audio_export, this));
export_status->Finished.connect_same_thread (*this, boost::bind (&Session::finalize_audio_export, this));
+
+ /* disable MMC output early */
+
+ _pre_export_mmc_enabled = MIDI::Manager::instance()->mmc()->send_enabled ();
+ MIDI::Manager::instance()->mmc()->enable_send (false);
return 0;
}
_engine.freewheel (false);
export_freewheel_connection.disconnect();
+ MIDI::Manager::instance()->mmc()->enable_send (_pre_export_mmc_enabled);
+
/* maybe write CUE/TOC */
export_handler.reset();
_send_timecode_update = false;
- if (!Config->get_send_mtc() || _slave) {
+ if (_engine.freewheeling() || !Config->get_send_mtc() || _slave) {
return 0;
}
int
Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_frame, pframes_t nframes)
{
- if (_slave || !_send_qf_mtc || transmitting_timecode_time.negative || (next_quarter_frame_to_send < 0)) {
+ if (_engine.freewheeling() || _slave || !_send_qf_mtc || transmitting_timecode_time.negative || (next_quarter_frame_to_send < 0)) {
// cerr << "(MTC) Not sending MTC\n";
return 0;
}
*/
try {
- if (Config->get_send_midi_clock() && transport_speed() == 1.0f && midi_clock->has_midi_port()) {
+ if (!_engine.freewheeling() && Config->get_send_midi_clock() && transport_speed() == 1.0f && midi_clock->has_midi_port()) {
midi_clock->tick (transport_at_start);
}
} catch (...) {
_speakers.reset (new Speakers);
_clicks_cleared = 0;
ignore_route_processor_changes = false;
+ _pre_export_mmc_enabled = false;
AudioDiskstream::allocate_working_buffers();
have_looped = false;
- send_full_time_code (_transport_frame);
-
- if (!dynamic_cast<MTC_Slave*>(_slave)) {
- MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdStop));
- send_mmc_locate (_transport_frame);
+ if (!_engine.freewheeling()) {
+ send_full_time_code (_transport_frame);
+
+ if (!dynamic_cast<MTC_Slave*>(_slave)) {
+ MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdStop));
+ send_mmc_locate (_transport_frame);
+ }
}
if ((ptw & PostTransportLocate) && get_record_enabled()) {
(*i)->automation_snapshot (_transport_frame, true);
}
- Timecode::Time time;
- timecode_time_subframes (_transport_frame, time);
- if (!dynamic_cast<MTC_Slave*>(_slave)) {
- MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdDeferredPlay));
+ if (!_engine.freewheeling()) {
+ Timecode::Time time;
+ timecode_time_subframes (_transport_frame, time);
+ if (!dynamic_cast<MTC_Slave*>(_slave)) {
+ MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdDeferredPlay));
+ }
}
TransportStateChange (); /* EMIT SIGNAL */
void
Session::send_mmc_locate (framepos_t t)
{
- Timecode::Time time;
- timecode_time_subframes (t, time);
- MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (time));
+ if (!_engine.freewheeling()) {
+ Timecode::Time time;
+ timecode_time_subframes (t, time);
+ MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (time));
+ }
}
/** Ask the transport to not send timecode until further notice. The suspension
byte receive_device_id () const { return _receive_device_id; }
byte send_device_id () const { return _send_device_id; }
void enable_send (bool);
+ bool send_enabled () const { return _enable_send; }
void send (MachineControlCommand const &);
static bool is_mmc (byte *sysex_buf, size_t len);