13
0

Stop QF messages when transport speed is out of range, and re-start them properly.

git-svn-id: svn://localhost/ardour2/branches/3.0@8423 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-01-03 23:55:00 +00:00
parent b3fe29af41
commit d795980546
6 changed files with 36 additions and 11 deletions

View File

@ -1307,6 +1307,15 @@ RCOptionEditor::RCOptionEditor ()
sigc::mem_fun (*_rc_config, &RCConfiguration::set_send_mtc)
));
add_option (_("MIDI control"),
new SpinOption<int> (
"mtc-qf-speed-tolerance",
_("Percentage either side of normal transport speed to transmit MTC"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_mtc_qf_speed_tolerance),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_mtc_qf_speed_tolerance),
0, 20, 1, 5
));
add_option (_("MIDI control"),
new BoolOption (
"mmc-control",
@ -1315,7 +1324,6 @@ RCOptionEditor::RCOptionEditor ()
sigc::mem_fun (*_rc_config, &RCConfiguration::set_mmc_control)
));
add_option (_("MIDI control"),
new BoolOption (
"send-mmc",

View File

@ -35,6 +35,7 @@ CONFIG_VARIABLE (bool, midi_feedback, "midi-feedback", false)
CONFIG_VARIABLE (uint8_t, mmc_receive_device_id, "mmc-receive-device-id", 0x7f)
CONFIG_VARIABLE (uint8_t, mmc_send_device_id, "mmc-send-device-id", 0)
CONFIG_VARIABLE (int32_t, initial_program_change, "initial-program-change", -1)
CONFIG_VARIABLE (int, mtc_qf_speed_tolerance, "mtc_qf_speed_tolerance", 5)
/* control surfaces */

View File

@ -959,7 +959,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
std::string _path;
std::string _name;
bool _is_new;
bool session_send_mtc;
bool _send_qf_mtc;
bool session_midi_feedback;
bool play_loop;
bool loop_changing;

View File

@ -360,7 +360,7 @@ Session::send_full_time_code (framepos_t const t)
_send_timecode_update = false;
if (!session_send_mtc || _slave) {
if (!Config->get_send_mtc() || _slave) {
return 0;
}
@ -413,7 +413,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 || !session_send_mtc || transmitting_timecode_time.negative || (next_quarter_frame_to_send < 0)) {
if (_slave || !_send_qf_mtc || transmitting_timecode_time.negative || (next_quarter_frame_to_send < 0)) {
// cerr << "(MTC) Not sending MTC\n";
return 0;
}
@ -462,7 +462,6 @@ Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_f
}
const framepos_t msg_time = outbound_mtc_timecode_frame + (quarter_frame_duration * next_quarter_frame_to_send);
cout << " " << msg_time << "\n";
// This message must fall within this block or something is broken
assert (msg_time >= start_frame);

View File

@ -265,9 +265,27 @@ Session::process_with_events (pframes_t nframes)
process_event (ev);
}
/* Events caused a transport change, send an MTC Full Frame (Timecode) message.
* This is sent whether rolling or not, to give slaves an idea of ardour time
* on locates (and allow slow slaves to position and prepare for rolling)
/* Decide on what to do with quarter-frame MTC during this cycle */
bool const was_sending_qf_mtc = _send_qf_mtc;
double const tolerance = Config->get_mtc_qf_speed_tolerance() / 100.0;
_send_qf_mtc = (
Config->get_send_mtc () &&
_transport_speed >= (1 - tolerance) &&
_transport_speed <= (1 + tolerance)
);
if (_send_qf_mtc && !was_sending_qf_mtc) {
/* we will re-start quarter-frame MTC this cycle, so send a full update to set things up */
_send_timecode_update = true;
}
/* Events caused a transport change (or we re-started sending
* MTC), so send an MTC Full Frame (Timecode) message. This
* is sent whether rolling or not, to give slaves an idea of
* ardour time on locates (and allow slow slaves to position
* and prepare for rolling)
*/
if (_send_timecode_update) {
send_full_time_code (_transport_frame);

View File

@ -206,7 +206,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
_state_of_the_state = StateOfTheState(CannotSave|InitialConnecting|Loading);
_was_seamless = Config->get_seamless_loop ();
_slave = 0;
session_send_mtc = false;
_send_qf_mtc = false;
g_atomic_int_set (&_playback_load, 100);
g_atomic_int_set (&_capture_load, 100);
_play_range = false;
@ -3358,8 +3358,7 @@ Session::config_changed (std::string p, bool ours)
} else if (p == "send-mtc") {
session_send_mtc = Config->get_send_mtc();
if (session_send_mtc) {
if (Config->get_send_mtc ()) {
/* mark us ready to send */
next_quarter_frame_to_send = 0;
}