13
0

Prepare record with count-in action

This commit is contained in:
Robin Gareus 2017-02-13 22:59:20 +01:00
parent 0f485ffd6b
commit 7946967270
3 changed files with 23 additions and 1 deletions

View File

@ -1003,6 +1003,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void request_preroll_record_punch (framepos_t start, framecnt_t preroll); void request_preroll_record_punch (framepos_t start, framecnt_t preroll);
void request_preroll_record_trim (framepos_t start, framecnt_t preroll); void request_preroll_record_trim (framepos_t start, framecnt_t preroll);
void request_count_in_record ();
framepos_t preroll_record_punch_pos () const { return _preroll_record_punch_pos; } framepos_t preroll_record_punch_pos () const { return _preroll_record_punch_pos; }
bool preroll_record_punch_enabled () const { return _preroll_record_punch_pos >= 0; } bool preroll_record_punch_enabled () const { return _preroll_record_punch_pos >= 0; }
@ -1930,6 +1931,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
framepos_t _preroll_record_punch_pos; framepos_t _preroll_record_punch_pos;
framecnt_t _preroll_record_trim_len; framecnt_t _preroll_record_trim_len;
bool _count_in_once;
/* main outs */ /* main outs */
uint32_t main_outs; uint32_t main_outs;

View File

@ -306,6 +306,7 @@ Session::Session (AudioEngine &eng,
, _object_selection (-1,-1) , _object_selection (-1,-1)
, _preroll_record_punch_pos (-1) , _preroll_record_punch_pos (-1)
, _preroll_record_trim_len (0) , _preroll_record_trim_len (0)
, _count_in_once (false)
, main_outs (0) , main_outs (0)
, first_file_data_format_reset (true) , first_file_data_format_reset (true)
, first_file_header_format_reset (true) , first_file_header_format_reset (true)

View File

@ -217,6 +217,20 @@ Session::request_preroll_record_trim (framepos_t rec_in, framecnt_t preroll)
set_requested_return_frame (rec_in); set_requested_return_frame (rec_in);
} }
void
Session::request_count_in_record ()
{
if (actively_recording ()) {
return;
}
if (transport_rolling()) {
return;
}
maybe_enable_record ();
_count_in_once = true;
request_transport_speed (1.0, true);
}
void void
Session::request_play_loop (bool yn, bool change_transport_roll) Session::request_play_loop (bool yn, bool change_transport_roll)
{ {
@ -1406,6 +1420,7 @@ Session::set_transport_speed (double speed, framepos_t destination_frame, bool a
take care of it. take care of it.
*/ */
_play_range = false; _play_range = false;
_count_in_once = false;
unset_play_loop (); unset_play_loop ();
} }
_engine.transport_stop (); _engine.transport_stop ();
@ -1451,6 +1466,7 @@ Session::set_transport_speed (double speed, framepos_t destination_frame, bool a
if (synced_to_engine()) { if (synced_to_engine()) {
_engine.transport_start (); _engine.transport_start ();
_count_in_once = false;
} else { } else {
start_transport (); start_transport ();
} }
@ -1543,6 +1559,7 @@ Session::set_transport_speed (double speed, framepos_t destination_frame, bool a
void void
Session::stop_transport (bool abort, bool clear_state) Session::stop_transport (bool abort, bool clear_state)
{ {
_count_in_once = false;
if (_transport_speed == 0.0f) { if (_transport_speed == 0.0f) {
return; return;
} }
@ -1676,7 +1693,8 @@ Session::start_transport ()
send_immediate_mmc (MIDI::MachineControlCommand (MIDI::MachineControl::cmdDeferredPlay)); send_immediate_mmc (MIDI::MachineControlCommand (MIDI::MachineControl::cmdDeferredPlay));
} }
if (actively_recording() && click_data && config.get_count_in ()) { if (actively_recording() && click_data && (config.get_count_in () || _count_in_once)) {
_count_in_once = false;
/* calculate count-in duration (in audio samples) /* calculate count-in duration (in audio samples)
* - use [fixed] tempo/meter at _transport_frame * - use [fixed] tempo/meter at _transport_frame
* - calc duration of 1 bar + time-to-beat before or at transport_frame * - calc duration of 1 bar + time-to-beat before or at transport_frame
@ -1737,6 +1755,7 @@ Session::post_transport ()
if (ptw & PostTransportLocate) { if (ptw & PostTransportLocate) {
if (((!config.get_external_sync() && (auto_play_legal && config.get_auto_play())) && !_exporting) || (ptw & PostTransportRoll)) { if (((!config.get_external_sync() && (auto_play_legal && config.get_auto_play())) && !_exporting) || (ptw & PostTransportRoll)) {
_count_in_once = false;
start_transport (); start_transport ();
} else { } else {
transport_sub_state = 0; transport_sub_state = 0;