Add signals to indicate Punch/Loop constraints
This is in preparation for GUI sensitivity of Loop and Punch actions.
This commit is contained in:
parent
ef512d412d
commit
08559abc10
|
@ -775,6 +775,10 @@ public:
|
|||
|
||||
bool silent () { return _silent; }
|
||||
|
||||
bool punch_is_possible () const;
|
||||
bool loop_is_possible () const;
|
||||
PBD::Signal0<void> PunchLoopConstraintChange;
|
||||
|
||||
TempoMap& tempo_map() { return *_tempo_map; }
|
||||
const TempoMap& tempo_map() const { return *_tempo_map; }
|
||||
void maybe_update_tempo_from_midiclock_tempo (float bpm);
|
||||
|
@ -1702,11 +1706,9 @@ private:
|
|||
|
||||
volatile guint _punch_or_loop; // enum PunchLoopLock
|
||||
|
||||
bool punch_is_possible () const;
|
||||
bool loop_is_possible () const;
|
||||
|
||||
bool punch_active () const;
|
||||
void unset_punch ();
|
||||
void reset_punch_loop_constraint ();
|
||||
bool maybe_allow_only_loop (bool play_loop = false);
|
||||
bool maybe_allow_only_punch ();
|
||||
|
||||
|
|
|
@ -1428,12 +1428,25 @@ Session::loop_is_possible () const
|
|||
return g_atomic_int_get(&_punch_or_loop) != OnlyPunch;
|
||||
}
|
||||
|
||||
void
|
||||
Session::reset_punch_loop_constraint ()
|
||||
{
|
||||
if (g_atomic_int_get (&_punch_or_loop) == NoConstraint) {
|
||||
return;
|
||||
}
|
||||
g_atomic_int_set (&_punch_or_loop, NoConstraint);
|
||||
PunchLoopConstraintChange (); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
bool
|
||||
Session::maybe_allow_only_loop (bool play_loop) {
|
||||
if (!(get_play_loop () || play_loop)) {
|
||||
return false;
|
||||
}
|
||||
bool rv = g_atomic_int_compare_and_exchange (&_punch_or_loop, NoConstraint, OnlyLoop);
|
||||
if (rv) {
|
||||
PunchLoopConstraintChange (); /* EMIT SIGNAL */
|
||||
}
|
||||
if (rv || loop_is_possible ()) {
|
||||
unset_punch ();
|
||||
return true;
|
||||
|
@ -1447,6 +1460,9 @@ Session::maybe_allow_only_punch () {
|
|||
return false;
|
||||
}
|
||||
bool rv = g_atomic_int_compare_and_exchange (&_punch_or_loop, NoConstraint, OnlyPunch);
|
||||
if (rv) {
|
||||
PunchLoopConstraintChange (); /* EMIT SIGNAL */
|
||||
}
|
||||
return rv || punch_is_possible ();
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ Session::realtime_stop (bool abort, bool clear_state)
|
|||
|
||||
reset_slave_state ();
|
||||
|
||||
g_atomic_int_set (&_punch_or_loop, NoConstraint);
|
||||
reset_punch_loop_constraint ();
|
||||
|
||||
_transport_speed = 0;
|
||||
_target_transport_speed = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user