diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index a5d013c339..4876d925dc 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -211,12 +211,6 @@ class LIBARDOUR_API Session : public PBD::HistoryOwner, public Temporal::TimeDomainProvider { public: - enum RecordState { - Disabled = 0, - Enabled = 1, - Recording = 2 - }; - /* a new session might have non-empty mix_template, an existing session should always have an empty one. the bus profile can be null if no master out bus is required. */ diff --git a/libs/ardour/ardour/triggerbox.h b/libs/ardour/ardour/triggerbox.h index 0dda8164f9..94a133742a 100644 --- a/libs/ardour/ardour/triggerbox.h +++ b/libs/ardour/ardour/triggerbox.h @@ -799,7 +799,7 @@ class LIBARDOUR_API TriggerBox : public Processor, public std::enable_shared_fro static PBD::Signal0 CueRecordingChanged; void set_record_enabled (bool yn); - bool record_enabled() const { return _record_enabled; } + RecordState record_enabled() const { return _record_state; } PBD::Signal0 RecEnableChanged; void arm_from_another_thread (Trigger& slot, samplepos_t, uint32_t chans); @@ -955,7 +955,7 @@ class LIBARDOUR_API TriggerBox : public Processor, public std::enable_shared_fro bool _locate_armed; bool _cancel_locate_armed; bool _fast_forwarding; - bool _record_enabled; + RecordState _record_state; PBD::PCGRand _pcg; @@ -1019,8 +1019,6 @@ class LIBARDOUR_API TriggerBox : public Processor, public std::enable_shared_fro PBD::ScopedConnection stop_all_connection; std::atomic _arm_info; - static TriggerBox* currently_recording; - typedef std::map,std::pair > CustomMidiMap; static CustomMidiMap _custom_midi_map; diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 9da5a76443..05ce3cd7be 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -984,6 +984,13 @@ enum SelectionOperation { SelectionExtend /* UI only operation, not core */ }; +enum RecordState { + Disabled = 0, + Enabled = 1, + Recording = 2 +}; + + } // namespace ARDOUR /* for now, break the rules and use "using" to make this "global" */ diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index 1eeb7e0970..106d40c301 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -102,7 +102,7 @@ setup_enum_writer () SyncSource _SyncSource; TransportRequestType _TransportRequestType; ShuttleUnits _ShuttleUnits; - Session::RecordState _Session_RecordState; + RecordState _RecordState; SessionEvent::Type _SessionEvent_Type; SessionEvent::Action _SessionEvent_Action; TimecodeFormat _Session_TimecodeFormat; @@ -471,10 +471,10 @@ setup_enum_writer () REGISTER_ENUM (Semitones); REGISTER (_ShuttleUnits); - REGISTER_CLASS_ENUM (Session, Disabled); - REGISTER_CLASS_ENUM (Session, Enabled); - REGISTER_CLASS_ENUM (Session, Recording); - REGISTER (_Session_RecordState); + REGISTER_ENUM (Disabled); + REGISTER_ENUM (Enabled); + REGISTER_ENUM (Recording); + REGISTER (_RecordState); REGISTER_CLASS_ENUM (SessionEvent, SetTransportSpeed); REGISTER_CLASS_ENUM (SessionEvent, SetDefaultPlaySpeed); diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index d0003245f0..5b90afc00c 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -3162,9 +3162,9 @@ LuaBindings::common (lua_State* L) .beginNamespace ("Session") .beginNamespace ("RecordState") - .addConst ("Disabled", ARDOUR::Session::RecordState(Session::Disabled)) - .addConst ("Enabled", ARDOUR::Session::RecordState(Session::Enabled)) - .addConst ("Recording", ARDOUR::Session::RecordState(Session::Recording)) + .addConst ("Disabled", ARDOUR::RecordState(ARDOUR::Disabled)) + .addConst ("Enabled", ARDOUR::RecordState(ARDOUR::Enabled)) + .addConst ("Recording", ARDOUR::RecordState(ARDOUR::Recording)) .endNamespace () .endNamespace () // end Session enums diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index 0756e66ae3..da79ebaeb5 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -780,7 +780,7 @@ MidiTrack::MidiControl::actually_set_value (double val, PBD::Controllable::Group void MidiTrack::set_step_editing (bool yn) { - if (_session.record_status() != Session::Disabled) { + if (_session.record_status() != Disabled) { return; } diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index b5cf44cbc9..f6969a8cda 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -3433,7 +3433,6 @@ CueRecords TriggerBox::cue_records (256); std::atomic TriggerBox::_cue_recording (false); PBD::Signal0 TriggerBox::CueRecordingChanged; bool TriggerBox::roll_requested = false; -TriggerBox* TriggerBox::currently_recording (nullptr); bool TriggerBox::_learning = false; TriggerBox::CustomMidiMap TriggerBox::_custom_midi_map; std::pair TriggerBox::learning_for; @@ -3490,7 +3489,7 @@ TriggerBox::TriggerBox (Session& s, DataType dt) , _locate_armed (false) , _cancel_locate_armed (false) , _fast_forwarding (false) - , _record_enabled (false) + , _record_state (Disabled) , requests (1024) , _arm_info (nullptr) { @@ -3547,12 +3546,8 @@ TriggerBox::arm_from_another_thread (Trigger& slot, samplepos_t now, uint32_t ch ai->start = t_samples; - if (currently_recording) { - currently_recording->disarm (); - currently_recording = nullptr; - } - _arm_info = ai; + _record_state = Enabled; } void @@ -3567,7 +3562,7 @@ TriggerBox::finish_recording (BufferSet& bufs) assert (ai); ai->slot.captured (*ai, bufs); _arm_info = nullptr; - currently_recording = nullptr; + _record_state = Disabled; } void @@ -3584,7 +3579,7 @@ TriggerBox::maybe_capture (BufferSet& bufs, samplepos_t start_sample, samplepos_ pframes_t offset = 0; bool reached_end = false; - if (!ai->slot.armed() && (currently_recording == this)) { + if (!ai->slot.armed()) { if (!ai->end) { /* disarmed: compute end */ Beats start_b; @@ -3602,7 +3597,7 @@ TriggerBox::maybe_capture (BufferSet& bufs, samplepos_t start_sample, samplepos_ } } - if (speed == 0. && currently_recording == this) { + if (speed == 0.) { /* We stopped the transport, so just stop immediately (no quantization) */ finish_recording (bufs); return; @@ -3626,7 +3621,7 @@ TriggerBox::maybe_capture (BufferSet& bufs, samplepos_t start_sample, samplepos_ /* Let's get going */ offset = ai->start.samples() - start_sample; nframes -= offset; - currently_recording = this; + _record_state = Recording; } if ((ai->end.samples() != 0) && (start_sample <= ai->end.samples() && ai->end.samples() < end_sample)) { @@ -3691,7 +3686,7 @@ TriggerBox::maybe_capture (BufferSet& bufs, samplepos_t start_sample, samplepos_ void TriggerBox::set_record_enabled (bool yn) { - _record_enabled = yn; + _record_state = yn ? Enabled : Disabled; RecEnableChanged (); /* EMIT SIGNAL */ } diff --git a/libs/ctrl-interface/control_protocol/basic_ui.cc b/libs/ctrl-interface/control_protocol/basic_ui.cc index 40a6fc15ec..61d16395e3 100644 --- a/libs/ctrl-interface/control_protocol/basic_ui.cc +++ b/libs/ctrl-interface/control_protocol/basic_ui.cc @@ -369,7 +369,7 @@ void BasicUI::rec_enable_toggle () { switch (session->record_status()) { - case Session::Disabled: + case Disabled: if (session->ntracks() == 0) { // string txt = _("Please create 1 or more track\nbefore trying to record.\nCheck the Session menu."); // MessageDialog msg (*editor, txt); @@ -378,8 +378,8 @@ BasicUI::rec_enable_toggle () } session->maybe_enable_record (); break; - case Session::Recording: - case Session::Enabled: + case Recording: + case Enabled: session->disable_record (false, true); } } diff --git a/libs/surfaces/cc121/cc121.cc b/libs/surfaces/cc121/cc121.cc index f5360f5007..9f4b7d2edb 100644 --- a/libs/surfaces/cc121/cc121.cc +++ b/libs/surfaces/cc121/cc121.cc @@ -631,13 +631,13 @@ CC121::map_recenable_state () bool onoff; switch (session->record_status()) { - case Session::Disabled: + case Disabled: onoff = false; break; - case Session::Enabled: + case Enabled: onoff = blink_state; break; - case Session::Recording: + case Recording: if (session->have_rec_enabled_track ()) { onoff = true; } else { diff --git a/libs/surfaces/faderport/faderport.cc b/libs/surfaces/faderport/faderport.cc index c58c686115..e03ba53f29 100644 --- a/libs/surfaces/faderport/faderport.cc +++ b/libs/surfaces/faderport/faderport.cc @@ -505,13 +505,13 @@ FaderPort::map_recenable_state () bool onoff; switch (session->record_status()) { - case Session::Disabled: + case Disabled: onoff = false; break; - case Session::Enabled: + case Enabled: onoff = blink_state; break; - case Session::Recording: + case Recording: if (session->have_rec_enabled_track ()) { onoff = true; } else { diff --git a/libs/surfaces/faderport8/callbacks.cc b/libs/surfaces/faderport8/callbacks.cc index 9431689c3b..1c440758c9 100644 --- a/libs/surfaces/faderport8/callbacks.cc +++ b/libs/surfaces/faderport8/callbacks.cc @@ -149,15 +149,15 @@ void FaderPort8::notify_record_state_changed () { switch (session->record_status ()) { - case Session::Disabled: + case Disabled: _ctrls.button (FP8Controls::BtnRecord).set_active (0); _ctrls.button (FP8Controls::BtnRecord).set_blinking (false); break; - case Session::Enabled: + case Enabled: _ctrls.button (FP8Controls::BtnRecord).set_active (true); _ctrls.button (FP8Controls::BtnRecord).set_blinking (true); break; - case Session::Recording: + case Recording: _ctrls.button (FP8Controls::BtnRecord).set_active (true); _ctrls.button (FP8Controls::BtnRecord).set_blinking (false); break; diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index d372da6265..97dd94f955 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -1413,15 +1413,15 @@ MackieControlProtocol::notify_record_state_changed () LedState ls; switch (session->record_status()) { - case Session::Disabled: + case Disabled: DEBUG_TRACE (DEBUG::MackieControl, "record state changed to disabled, LED off\n"); ls = off; break; - case Session::Recording: + case Recording: DEBUG_TRACE (DEBUG::MackieControl, "record state changed to recording, LED on\n"); ls = on; break; - case Session::Enabled: + case Enabled: if(_device_info.is_qcon()){ // For qcon the rec button is two state only (on/off) diff --git a/libs/surfaces/maschine2/callbacks.cc b/libs/surfaces/maschine2/callbacks.cc index 99a38f7bd5..e6da938ea6 100644 --- a/libs/surfaces/maschine2/callbacks.cc +++ b/libs/surfaces/maschine2/callbacks.cc @@ -109,15 +109,15 @@ void Maschine2::notify_record_state_changed () { switch (session->record_status ()) { - case Session::Disabled: + case Disabled: _ctrl->button (M2Contols::Rec)->set_color (0); _ctrl->button (M2Contols::Rec)->set_blinking (false); break; - case Session::Enabled: + case Enabled: _ctrl->button (M2Contols::Rec)->set_color (COLOR_WHITE); _ctrl->button (M2Contols::Rec)->set_blinking (true); break; - case Session::Recording: + case Recording: _ctrl->button (M2Contols::Rec)->set_color (COLOR_WHITE); _ctrl->button (M2Contols::Rec)->set_blinking (false); break; diff --git a/libs/surfaces/push2/push2.cc b/libs/surfaces/push2/push2.cc index dda35d97a2..c7f45fc1ff 100644 --- a/libs/surfaces/push2/push2.cc +++ b/libs/surfaces/push2/push2.cc @@ -736,15 +736,15 @@ Push2::notify_record_state_changed () } switch (session->record_status ()) { - case Session::Disabled: + case Disabled: b->second->set_color (LED::White); b->second->set_state (LED::NoTransition); break; - case Session::Enabled: + case Enabled: b->second->set_color (LED::Red); b->second->set_state (LED::Blinking4th); break; - case Session::Recording: + case Recording: b->second->set_color (LED::Red); b->second->set_state (LED::OneShot24th); break; diff --git a/libs/surfaces/us2400/us2400_control_protocol.cc b/libs/surfaces/us2400/us2400_control_protocol.cc index 101b41bd3d..9d5e61b201 100644 --- a/libs/surfaces/us2400/us2400_control_protocol.cc +++ b/libs/surfaces/us2400/us2400_control_protocol.cc @@ -1131,15 +1131,15 @@ US2400Protocol::notify_record_state_changed () LedState ls; switch (session->record_status()) { - case Session::Disabled: + case Disabled: DEBUG_TRACE (DEBUG::US2400, "record state changed to disabled, LED off\n"); ls = off; break; - case Session::Recording: + case Recording: DEBUG_TRACE (DEBUG::US2400, "record state changed to recording, LED on\n"); ls = on; break; - case Session::Enabled: + case Enabled: DEBUG_TRACE (DEBUG::US2400, "record state changed to enabled, LED flashing\n"); ls = flashing; break;