13
0

triggerbox: basics of scene triggering

This commit is contained in:
Paul Davis 2021-11-01 09:14:02 -06:00
parent 437840dced
commit b65f18a56e
2 changed files with 36 additions and 0 deletions

View File

@ -381,6 +381,11 @@ class LIBARDOUR_API TriggerBox : public Processor
static int first_midi_note() { return _first_midi_note; }
static void set_first_midi_note (int n);
static void maybe_find_scene_bang ();
static void clear_scene_bang ();
static void scene_bang (uint32_t scene_number);
static void scene_unbang (uint32_t scene_number);
private:
static Temporal::BBT_Offset _assumed_trigger_duration;
@ -421,6 +426,8 @@ class LIBARDOUR_API TriggerBox : public Processor
static const uint64_t default_triggers_per_box;
static int _first_midi_note;
static TriggerMidiMapMode _midi_map_mode;
static std::atomic<int32_t> _pending_scene;
static std::atomic<int32_t> _active_scene;
};
namespace Properties {

View File

@ -1322,6 +1322,8 @@ Temporal::BBT_Offset TriggerBox::_assumed_trigger_duration (4, 0, 0);
//TriggerBox::TriggerMidiMapMode TriggerBox::_midi_map_mode (TriggerBox::AbletonPush);
TriggerBox::TriggerMidiMapMode TriggerBox::_midi_map_mode (TriggerBox::SequentialNote);
int TriggerBox::_first_midi_note = 60;
std::atomic<int32_t> TriggerBox::_pending_scene (-1);
std::atomic<int32_t> TriggerBox::_active_scene (-1);
TriggerBox::TriggerBox (Session& s, DataType dt)
: Processor (s, _("TriggerBox"), Temporal::BeatTime)
@ -1352,6 +1354,33 @@ TriggerBox::TriggerBox (Session& s, DataType dt)
Config->ParameterChanged.connect_same_thread (*this, boost::bind (&TriggerBox::parameter_changed, this, _1));
}
void
TriggerBox::scene_bang (uint32_t n)
{
_pending_scene = n;
}
void
TriggerBox::scene_unbang (uint32_t n)
{
}
void
TriggerBox::maybe_find_scene_bang ()
{
uint32_t pending = _pending_scene.exchange (-1);
if (pending >= 0) {
_active_scene = pending;
}
}
void
TriggerBox::clear_scene_bang ()
{
(void) _active_scene.exchange (-1);
}
void
TriggerBox::clear_implicit ()
{