13
0

move RecordState enum from ARDOUR::Session to ARDOUR so we can use it in TriggerBox (libs)

This commit is contained in:
Paul Davis 2024-09-30 16:04:12 -06:00
parent 90858279bc
commit d7d208dc34
15 changed files with 49 additions and 55 deletions

View File

@ -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.
*/

View File

@ -799,7 +799,7 @@ class LIBARDOUR_API TriggerBox : public Processor, public std::enable_shared_fro
static PBD::Signal0<void> CueRecordingChanged;
void set_record_enabled (bool yn);
bool record_enabled() const { return _record_enabled; }
RecordState record_enabled() const { return _record_state; }
PBD::Signal0<void> 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<SlotArmInfo*> _arm_info;
static TriggerBox* currently_recording;
typedef std::map<std::vector<uint8_t>,std::pair<int,int> > CustomMidiMap;
static CustomMidiMap _custom_midi_map;

View File

@ -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" */

View File

@ -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);

View File

@ -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

View File

@ -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;
}

View File

@ -3433,7 +3433,6 @@ CueRecords TriggerBox::cue_records (256);
std::atomic<bool> TriggerBox::_cue_recording (false);
PBD::Signal0<void> TriggerBox::CueRecordingChanged;
bool TriggerBox::roll_requested = false;
TriggerBox* TriggerBox::currently_recording (nullptr);
bool TriggerBox::_learning = false;
TriggerBox::CustomMidiMap TriggerBox::_custom_midi_map;
std::pair<int,int> 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 */
}

View File

@ -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);
}
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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;