summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-02-06 17:09:53 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-02-06 17:09:53 +0000
commit009c7a9e44d65184d6b6c613569decc9d93fb490 (patch)
tree48a6d2eb194c9b4871016042bd213a62d36fa1c9 /libs/ardour
parentf4f2a9a111c32d4761308eb94a8c7cfa214b7116 (diff)
attempt to stop sending MMC/MTC while exporting or freewheeling for any reason
git-svn-id: svn://localhost/ardour2/branches/3.0@11457 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/audioengine.h2
-rw-r--r--libs/ardour/ardour/session.h1
-rw-r--r--libs/ardour/audioengine.cc16
-rw-r--r--libs/ardour/session_export.cc10
-rw-r--r--libs/ardour/session_midi.cc4
-rw-r--r--libs/ardour/session_process.cc2
-rw-r--r--libs/ardour/session_state.cc1
-rw-r--r--libs/ardour/session_transport.cc30
8 files changed, 50 insertions, 16 deletions
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index 7b4ba2d15d..fdaf864a0d 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -280,6 +280,7 @@ private:
/// 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;
@@ -314,6 +315,7 @@ private:
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 ();
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 973374ab32..a0e1b5a0fd 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -983,6 +983,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
int pre_export ();
int stop_audio_export ();
void finalize_audio_export ();
+ bool _pre_export_mmc_enabled;
PBD::ScopedConnection export_freewheel_connection;
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index abf4999e7f..9cec374716 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -84,6 +84,7 @@ AudioEngine::AudioEngine (string client_name, string session_uuid)
_frame_rate = 0;
_buffer_size = 0;
_freewheeling = false;
+ _pre_freewheel_mmc_enabled = false;
_main_thread = 0;
port_remove_in_progress = false;
@@ -344,7 +345,20 @@ AudioEngine::_process_thread (void *arg)
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
diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc
index 4f46535a97..4d2944aad5 100644
--- a/libs/ardour/session_export.cc
+++ b/libs/ardour/session_export.cc
@@ -21,6 +21,9 @@
#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"
@@ -89,6 +92,11 @@ Session::pre_export ()
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;
}
@@ -223,6 +231,8 @@ Session::finalize_audio_export ()
_engine.freewheel (false);
export_freewheel_connection.disconnect();
+ MIDI::Manager::instance()->mmc()->enable_send (_pre_export_mmc_enabled);
+
/* maybe write CUE/TOC */
export_handler.reset();
diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc
index 3fe6925186..453718c024 100644
--- a/libs/ardour/session_midi.cc
+++ b/libs/ardour/session_midi.cc
@@ -361,7 +361,7 @@ Session::send_full_time_code (framepos_t const t)
_send_timecode_update = false;
- if (!Config->get_send_mtc() || _slave) {
+ if (_engine.freewheeling() || !Config->get_send_mtc() || _slave) {
return 0;
}
@@ -415,7 +415,7 @@ Session::send_full_time_code (framepos_t const t)
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;
}
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index cd3c023f3e..60cb6ecee1 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -88,7 +88,7 @@ Session::process (pframes_t nframes)
*/
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 (...) {
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 30590e3665..3c7ec0f780 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -226,6 +226,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
_speakers.reset (new Speakers);
_clicks_cleared = 0;
ignore_route_processor_changes = false;
+ _pre_export_mmc_enabled = false;
AudioDiskstream::allocate_working_buffers();
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index 6347c553a9..ffcb7e8d24 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -616,11 +616,13 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
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()) {
@@ -1187,10 +1189,12 @@ Session::start_transport ()
(*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 */
@@ -1551,9 +1555,11 @@ Session::maybe_stop (framepos_t limit)
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