Ardour  8.7-15-gadf511264b
triggerbox.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Paul Davis <paul@linuxaudiosystems.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __ardour_triggerbox_h__
20 #define __ardour_triggerbox_h__
21 
22 #include <pthread.h>
23 
24 #include <atomic>
25 #include <map>
26 #include <vector>
27 #include <string>
28 #include <exception>
29 
30 #include <glibmm/threads.h>
31 
32 #include "pbd/crossthread.h"
33 #include "pbd/pcg_rand.h"
34 #include "pbd/pool.h"
35 #include "pbd/properties.h"
36 #include "pbd/ringbuffer.h"
37 #include "pbd/stateful.h"
38 
39 #include "midi++/types.h"
40 
41 #include "temporal/beats.h"
42 #include "temporal/bbt_time.h"
43 #include "temporal/tempo.h"
44 
45 #include "evoral/PatchChange.h"
46 #include "evoral/SMF.h"
47 
48 #include "ardour/midi_model.h"
50 #include "ardour/processor.h"
52 #include "ardour/types.h"
53 #include "ardour/types_convert.h"
54 
56 
57 class XMLNode;
58 
59 namespace RubberBand {
60  class RubberBandStretcher;
61 }
62 
63 namespace MIDI {
64  class Parser;
65 }
66 
67 namespace ARDOUR {
68 
69 class Session;
70 class AudioRegion;
71 class MidiRegion;
72 class TriggerBox;
73 class SideChain;
74 class MidiPort;
75 
76 typedef uint32_t color_t;
77 
78 LIBARDOUR_API std::string cue_marker_name (int32_t);
79 
80 class Trigger;
81 
82 typedef std::shared_ptr<Trigger> TriggerPtr;
83 
85  public:
86  enum State {
87  /* This is the initial state for a Trigger, and means that it is not
88  * doing anything at all
89  */
91  /* A Trigger in this state has been chosen by its parent TriggerBox
92  * (e.g. because of a bang() call that put it in the queue), a Trigger in
93  * this state is waiting for the next occurence of its quantization to
94  * occur before transitioning to Running
95  */
97  /* a Trigger in this state is going to deliver data during calls
98  * to its ::run() method.
99  */
101  /* a Trigger in this state was running, has been re-triggered e.g. by a
102  * ::bang() call with LaunchStyle set to Repeat, and is waiting for the
103  * next occurence of its quantization to occur before transitioning
104  * back to Running.
105  */
107  /* a Trigger in this state is delivering data during calls to ::run(), but
108  * is waiting for the next occurence of its quantization to occur when it will
109  * transition to Stopping and then Stopped.
110  */
112  /* a Trigger in this state is delivering data during calls to ::run(), but
113  * is waiting for the next occurence of another Trigger's quantization to occur when it will
114  * transition to Stopping and then Stopped (and be followed by
115  * the other Trigger.
116  */
118  /* a Trigger in this state was Running but noticed that it should stop
119  * during the current call to ::run(). By the end of that call, it will
120  * have transitioned to Stopped.
121  */
123  };
124 
125  enum LaunchStyle {
126  OneShot, /* mouse down/NoteOn starts; mouse up/NoteOff ignored */
127  ReTrigger, /* mouse down/NoteOn starts or retriggers; mouse up/NoteOff */
128  Gate, /* runs till mouse up/note off then to next quantization */
129  Toggle, /* runs till next mouse down/NoteOn */
130  Repeat, /* plays only quantization extent until mouse up/note off */
131  };
132 
133  enum StretchMode { /* currently mapped to the matching RubberBand::RubberBandStretcher::Option */
137  };
138 
139  Trigger (uint32_t index, TriggerBox&);
140  virtual ~Trigger() {}
141 
142  static void make_property_quarks ();
143 
144  protected:
145  /* properties controllable by the user */
146 
162 
163  /* Properties that are not CAS-updated at retrigger */
164 
167 
168  public:
169  /* this is positioned here so that we can easily keep it in sync
170  with the properties list above.
171  */
172  struct UIState {
173  std::atomic<unsigned int> generation; /* used for CAS */
174 
179  uint32_t follow_count = 1;
182  bool use_follow_length = false;
183  bool legato = false;
184  gain_t gain = 1.0;
185  float velocity_effect = 0;
186  bool stretchable = true;
187  bool cue_isolated = false;
188  bool allow_patch_changes = true;
190 
193 
194  std::string name = "";
195  color_t color = 0xBEBEBEFF;
196  double tempo = 0; //unset
197 
198  UIState() : generation (0) {}
199 
200  UIState& operator= (UIState const & other) {
201 
202  /* we do not copy generation */
203 
204  generation = 0;
205 
206  launch_style = other.launch_style;
210  follow_count = other.follow_count;
211  quantization = other.quantization;
214  legato = other.legato;
215  gain = other.gain;
217  stretchable = other.stretchable;
218  cue_isolated = other.cue_isolated;
220  stretch_mode = other.stretch_mode;
222 
223  for (int i = 0; i<16; i++) {
224  if (other.patch_change[i].is_set()) {
225  patch_change[i] = other.patch_change[i];
226  }
227  }
228 
229  name = other.name;
230  color = other.color;
231  tempo = other.tempo;
232 
233  return *this;
234  }
235  };
236 
237 #define TRIGGERBOX_PROPERTY_DECL(name,type) void set_ ## name (type); type name () const;
238 #define TRIGGERBOX_PROPERTY_DECL_CONST_REF(name,type) void set_ ## name (type const &); type name () const
239 
257 
258 #undef TRIGGERBOX_PROPERTY_DECL
259 #undef TRIGGERBOX_PROPERTY_DECL_CONST_REF
260 
261  /* Calling ::bang() will cause this Trigger to be placed in its owning
262  TriggerBox's queue.
263  */
264  void bang (float velocity = 1.0f);
265 
266  /* Calling ::unbang() is equivalent to a mouse-up or note-off
267  ... it MIGHT cause a clip to stop, but more likely has no effect, depending on the slot's launch-style.
268  */
269  void unbang ();
270 
271  /* Calling ::request_stop() to stop a Trigger at the earliest possible
272  * opportunity, rather than at the next quantization point.
273  */
274  void request_stop ();
275 
276  /* Call ::stop_quantized() to stop a Trigger at the next quantization point.
277  */
278  void stop_quantized ();
279 
280  virtual void tempo_map_changed() {}
281 
282  virtual pframes_t run (BufferSet&, samplepos_t start_sample, samplepos_t end_sample,
283  Temporal::Beats const & start, Temporal::Beats const & end,
284  pframes_t nframes, pframes_t offset, double bpm, pframes_t& quantize_offset) = 0;
285  virtual void set_start (timepos_t const &) = 0;
286  virtual void set_end (timepos_t const &) = 0;
287  virtual void set_length (timecnt_t const &) = 0;
288  virtual void reload (BufferSet&, void*) = 0;
289  virtual void io_change () {}
290  virtual void set_legato_offset (timepos_t const & offset) = 0;
291 
293  double position_as_fraction() const;
294 
297  virtual void start_and_roll_to (samplepos_t start, samplepos_t position, uint32_t cnt) = 0;
298 
299  /* because follow actions involve probability is it easier to code the will-not-follow case */
300 
301  bool will_not_follow() const;
302  bool will_follow() const { return !will_not_follow(); }
303 
304  /* assumes that this is currently playing but does not enforce it */
305  bool cue_launched() const { return _cue_launched; }
306 
307  virtual bool probably_oneshot () const = 0;
308 
309  virtual timepos_t start_offset () const = 0; /* offset from start of data */
310  virtual timepos_t current_length() const = 0; /* offset from start() */
311  virtual timepos_t natural_length() const = 0; /* offset from start() */
312 
313  void process_state_requests (BufferSet& bufs, pframes_t dest_offset);
314 
315  bool active() const { return _state >= Running; }
316  State state() const { return _state; }
317 
318  void set_region (std::shared_ptr<Region>, bool use_thread = true);
319  void clear_region ();
320  virtual int set_region_in_worker_thread (std::shared_ptr<Region>) = 0;
321  std::shared_ptr<Region> region() const { return _region; }
322 
323  uint32_t index() const { return _index; }
324 
325  /* Managed by TriggerBox, these record the time that the trigger is
326  * scheduled to start or stop at. Computed in
327  * Trigger::maybe_compute_next_transition().
328  */
332 
333  XMLNode& get_state () const;
334  int set_state (const XMLNode&, int version);
335 
336  void maybe_compute_next_transition (samplepos_t start_sample, Temporal::Beats const & start, Temporal::Beats const & end, pframes_t& nframes, pframes_t& dest_offset);
337 
338 
340  Temporal::BBT_Argument& t_bbt, Temporal::Beats& t_beats, samplepos_t& t_samples,
341  Temporal::TempoMap::SharedPtr const & tmap, Temporal::BBT_Offset const & q);
342 
344  Temporal::BBT_Argument& t_bbt, Temporal::Beats& t_beats, samplepos_t& t_samples,
345  Temporal::TempoMap::SharedPtr const & tmap);
346 
347 
348  template<typename TriggerType>
349  void start_and_roll_to (samplepos_t start_pos, samplepos_t end_position, TriggerType& trigger,
350  pframes_t (TriggerType::*run_method) (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample,
351  Temporal::Beats const & start_beats, Temporal::Beats const & end_beats,
352  pframes_t nframes, pframes_t dest_offset, double bpm, pframes_t&), uint32_t cnt);
353  void set_next_trigger (int n);
354  int next_trigger() const { return _next_trigger; }
355 
356  /* any non-zero value will work for the default argument, and means
357  "use your own launch quantization". BBT_Offset (0, 0, 0) means what
358  it says: start immediately
359  */
360  void startup (BufferSet&, pframes_t dest_offset, Temporal::BBT_Offset const & start_quantization = Temporal::BBT_Offset (9, 3,0));
361  void startup_from_ffwd (BufferSet&, uint32_t loop_cnt);
363  virtual void shutdown (BufferSet& bufs, pframes_t dest_offset);
364  virtual void jump_start ();
365  virtual void jump_stop (BufferSet& bufs, pframes_t dest_offset);
366  void begin_stop (bool explicit_stop = false);
368 
369  bool explicitly_stopped() const { return _explicitly_stopped; }
370 
371  uint32_t loop_count() const { return _loop_cnt; }
372 
373  void set_ui (void*);
374  void* ui () const { return _ui; }
375 
376  TriggerBox& box() const { return _box; }
377 
378  double estimated_tempo() const { return _estimated_tempo; }
379 
380  /* the following functions deal with audio- or midi-specific SegmentDescriptor properties, provided as virtuals so we don't have to do lots of dynamic_casting */
381  /* segment_tempo is currently a no-op for MIDI, but may be implemented later */
382  virtual double segment_tempo() const = 0;
383  virtual void set_segment_tempo (double t) = 0;
384 
385  /* used_channels is a no-op for audio */
388 
389  /* patch changes are a no-op for audio */
392  virtual void unset_patch_change (uint8_t channel) {}
393  virtual void unset_all_patch_changes () {}
394  virtual bool patch_change_set (uint8_t channel) const { return false; }
395 
396  virtual void setup_stretcher () = 0;
397 
398  Temporal::Meter meter() const { return _meter; }
399 
400  void set_velocity_gain (gain_t g) {_pending_velocity_gain=g;}
401 
404 
406 
408 
410 
411  static void request_trigger_delete (Trigger* t);
412 
413  /* these operations are provided to get/set all the "user visible" trigger properties at once */
414  /* examples: drag+dropping from slot to slot, or "Range->Bounce to Slot", where a single operation sets many */
415  void get_ui_state (UIState &state) const;
416  void set_ui_state (UIState &state);
417 
418  static PBD::Signal2<void,PBD::PropertyChange,Trigger*> TriggerPropertyChange;
419 
420  protected:
421  struct UIRequests {
422  std::atomic<bool> stop;
423  UIRequests() : stop (false) {}
424  };
425 
426  std::shared_ptr<Region> _region;
428  samplepos_t final_processed_sample; /* where we stop playing, in process time, compare with process_index */
433  bool _playout;
434  std::atomic<int> _bang;
435  std::atomic<int> _unbang;
436  uint32_t _index;
438  uint32_t _loop_cnt; /* how many times in a row has this played */
439  void* _ui;
444 
445  /* these are only used by midi triggers but the ui_state API needs them */
448  std::vector<int> _channel_map;
449 
451 
452 
453  /* computed from data */
454 
455  double _estimated_tempo; //TODO: this should come from the MIDI file
456  double _segment_tempo; //TODO: this will likely get stored in the SegmentDescriptor for audio triggers
457 
458  /* basic process is :
459  1) when a file is loaded, we infer its bpm either by minibpm's estimate, a flag in the filename, metadata (TBD) or other means
460  2) we assume the clip must have an integer number of beats in it (simplest case is a one-bar loop with 4 beats in it)
461  3) ...so we round to the nearest beat length, and set the tempo to *exactly* fit the sample-length into the assumed beat-length
462  4) the user may recognize a problem: "this was a 3/4 beat, which was rounded to 4 beats but it should have been 3"
463  5) if the user changes the beat-length, then the tempo is recalculated for use during stretching
464  6) someday, we will also allow the sample start and length to be adjusted in a trimmer, and that will also adjust the tempo
465  7) in all cases the user should be in final control; but our "internal" value for stretching are just sample-start and BPM, end of story
466  */
467  double _beatcnt;
469 
473  std::atomic<Trigger*> _pending;
474  std::atomic<unsigned int> last_property_generation;
475 
476  void when_stopped_during_run (BufferSet& bufs, pframes_t dest_offset);
477  void set_region_internal (std::shared_ptr<Region>);
478  virtual void retrigger();
479  virtual void _startup (BufferSet&, pframes_t dest_offset, Temporal::BBT_Offset const &);
480 
483 };
484 
486  public:
487  AudioTrigger (uint32_t index, TriggerBox&);
489 
490  template<bool actually_run> pframes_t audio_run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample,
491  Temporal::Beats const & start, Temporal::Beats const & end,
492  pframes_t nframes, pframes_t dest_offset, double bpm, pframes_t& quantize_offset);
493 
494  pframes_t run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, Temporal::Beats const & start, Temporal::Beats const & end, pframes_t nframes, pframes_t dest_offset, double bpm, pframes_t& quantize_offset) {
495  return audio_run<true> (bufs, start_sample, end_sample, start, end, nframes, dest_offset, bpm, quantize_offset);
496  }
497 
498  StretchMode stretch_mode() const { return _stretch_mode; }
500 
501  double segment_tempo() const { return _segment_tempo; }
502  void set_segment_tempo (double t);
503 
504  double segment_beatcnt () { return _beatcnt; }
505  void set_segment_beatcnt (double count);
506 
507  void set_start (timepos_t const &);
508  void set_end (timepos_t const &);
509  void set_legato_offset (timepos_t const &);
510  void set_length (timecnt_t const &);
511  timepos_t start_offset () const; /* offset from start of data */
512  timepos_t current_length() const; /* offset from start of data */
513  timepos_t natural_length() const; /* offset from start of data */
514  void reload (BufferSet&, void*);
515  void io_change ();
516  bool probably_oneshot () const;
517 
518  int set_region_in_worker_thread (std::shared_ptr<Region>);
519  void jump_start ();
520  void jump_stop (BufferSet& bufs, pframes_t dest_offset);
521 
522  XMLNode& get_state () const;
523  int set_state (const XMLNode&, int version);
524 
525  RubberBand::RubberBandStretcher* stretcher() { return (_stretcher); }
526 
530 
531  bool stretching () const;
532 
533  protected:
534  void retrigger ();
535 
536  private:
537  struct Data : std::vector<Sample*> {
539 
540  Data () : length (0) {}
541  };
542 
544  RubberBand::RubberBandStretcher* _stretcher;
546 
547 
548  /* computed during run */
549 
551  samplepos_t last_readable_sample; /* where the data runs out, relative to the start of the data, compare with read_index */
557 
558  virtual void setup_stretcher ();
559 
560  void drop_data ();
561  int load_data (std::shared_ptr<AudioRegion>);
562  void estimate_tempo ();
564  void _startup (BufferSet&, pframes_t dest_offset, Temporal::BBT_Offset const &);
565 };
566 
567 
569  public:
570  MIDITrigger (uint32_t index, TriggerBox&);
572 
573  template<bool actually_run> pframes_t midi_run (BufferSet&, samplepos_t start_sample, samplepos_t end_sample,
574  Temporal::Beats const & start_beats, Temporal::Beats const & end_beats, pframes_t nframes, pframes_t offset, double bpm, pframes_t& quantize_offset);
575 
576  pframes_t run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, Temporal::Beats const & start, Temporal::Beats const & end, pframes_t nframes, pframes_t dest_offset, double bpm, pframes_t& quantize_offset) {
577  return midi_run<true> (bufs, start_sample, end_sample, start, end, nframes, dest_offset, bpm, quantize_offset);
578  }
579 
580  void set_start (timepos_t const &);
581  void set_end (timepos_t const &);
582  void set_legato_offset (timepos_t const &);
583  void set_length (timecnt_t const &);
585  timepos_t end() const; /* offset from start of data */
586  timepos_t current_length() const; /* offset from start of data */
587  timepos_t natural_length() const; /* offset from start of data */
588  void reload (BufferSet&, void*);
589  bool probably_oneshot () const;
590 
593 
594  int set_region_in_worker_thread (std::shared_ptr<Region>);
595  void jump_start ();
596  void shutdown (BufferSet& bufs, pframes_t dest_offset);
597  void jump_stop (BufferSet& bufs, pframes_t dest_offset);
598 
599  XMLNode& get_state () const;
600  int set_state (const XMLNode&, int version);
601 
605 
608  void unset_patch_change (uint8_t channel);
610  bool patch_change_set (uint8_t channel) const;
611 
612  /* It's possible that a portion of a midi file would use a subset of the total channels used, so store that info in the segment descriptor */
613  Evoral::SMF::UsedChannels used_channels() const { return ui_state.used_channels; }
615 
616  /* theoretically, MIDI files can have a dedicated tempo outside the session tempo map (*un-stretched*) but this is currently unimplemented */
617  /* boilerplate tempo functions are provided here so we don't have to do constant dynamic_cast checks to use the tempo+stretch APIs */
618  virtual double segment_tempo() const {return 120.0;}
619  virtual void set_segment_tempo (double t) {}
620  virtual void setup_stretcher () {}
621 
622  void set_channel_map (int channel, int target);
623  void unset_channel_map (int channel);
624  int channel_map (int channel);
625  std::vector<int> const & channel_map() const { return _channel_map; }
626 
627  protected:
628  void retrigger ();
629 
630  private:
633 
635 
636  Temporal::DoubleableBeats data_length; /* using timestamps from data */
639 
642 
643  std::shared_ptr<MidiModel> model;
646 
647  int load_data (std::shared_ptr<MidiRegion>);
649  void _startup (BufferSet&, pframes_t dest_offset, Temporal::BBT_Offset const &);
650 };
651 
653 {
654  public:
657 
658  static void init_request_pool() { Request::init_pool(); }
659 
660  void set_region (TriggerBox&, uint32_t slot, std::shared_ptr<Region>);
662 
663  void summon();
664  void stop();
666 
667  private:
668  static void* _thread_work(void *arg);
669  void* thread_work();
670 
671  enum RequestType {
674  DeleteTrigger
675  };
676 
677  struct Request {
678 
679  Request (RequestType t) : type (t) {}
680 
682  /* for set region */
684  uint32_t slot;
685  std::shared_ptr<Region> region;
686  /* for DeleteTrigger */
688 
689  void* operator new (size_t);
690  void operator delete (void* ptr, size_t);
691 
693  static void init_pool ();
694  };
695 
696  pthread_t thread;
698 
702 };
703 
704 struct CueRecord {
705  int32_t cue_number;
707 
708  CueRecord (int32_t cn, samplepos_t t): cue_number (cn), when (t) {}
709  CueRecord () : cue_number (0), when (0) {}
710 
711  static const int32_t stop_all = INT32_MAX;
712 };
713 
715 
717 {
718  public:
719 
720 #ifdef MIXBUS
721  static const int32_t default_triggers_per_box = 8;
722 #else
723  static const int32_t default_triggers_per_box = 16;
724 #endif
725 
728 
730  static bool cue_recording () { return _cue_recording; }
731  static void set_cue_recording (bool yn);
732  static PBD::Signal0<void> CueRecordingChanged;
733 
734  void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool result_required);
735  void run_cycle (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes);
738 
739  bool empty() const { return _active_slots == 0; }
740  PBD::Signal0<void> EmptyStatusChanged;
741 
742  int32_t order() const { return _order; }
743  void set_order(int32_t n);
744 
745  typedef std::vector<TriggerPtr> Triggers;
746 
747  TriggerPtr trigger (Triggers::size_type);
748 
749  void bang_trigger_at (Triggers::size_type row, float velocity = 1.0f);
750  void unbang_trigger_at (Triggers::size_type row);
751 
753 
754  void fast_forward (CueEvents const &, samplepos_t transport_postiion);
755  bool fast_forwarding() const { return _fast_forwarding; }
756 
757  void set_pending (uint32_t slot, Trigger*);
758 
759  XMLNode& get_state () const;
760  int set_state (const XMLNode&, int version);
761 
762  void deep_sources (std::set<std::shared_ptr<Source>>&);
763  void used_regions (std::set<std::shared_ptr<Region>>&);
764 
765  void set_from_path (uint32_t slot, std::string const & path);
766  void set_from_selection (uint32_t slot, std::shared_ptr<Region>);
767 
768  DataType data_type() const { return _data_type; }
769 
772 
773  TriggerPtr currently_playing() const { return _currently_playing; }
774 
776 
778  void clear_cue (int cue);
779  void set_all_follow_action (ARDOUR::FollowAction const &, uint32_t n=0);
782  void set_all_probability (int zero_to_a_hundred);
783 
784  /* Returns a negative value is there is no active Trigger, or a value between 0
785  * and 1.0 if there is, corresponding to the value of position_as_fraction() for
786  * the active Trigger.
787  */
788  double position_as_fraction() const;
789 
790  void queue_explict (uint32_t);
793 
794  void request_reload (int32_t slot, void*);
795  void set_region (uint32_t slot, std::shared_ptr<Region> region);
796 
800 
801  void enqueue_trigger_state_for_region (std::shared_ptr<Region>, std::shared_ptr<Trigger::UIState>);
802 
804 
805  /* valid only within the ::run() call tree */
806  int32_t active_scene() const { return _active_scene; }
807 
808  PBD::Signal1<void,uint32_t> TriggerSwapped;
809 
815  };
816 
817  /* This is null for TriggerBoxen constructed with DataType::AUDIO */
819 
820  static bool lookup_custom_midi_binding (std::vector<uint8_t> const &, int& x, int& y);
821  static void add_custom_midi_binding (std::vector<uint8_t> const &, int x, int y);
822  static void remove_custom_midi_binding (int x, int y);
824  static int save_custom_midi_bindings (std::string const & path);
825  static int load_custom_midi_bindings (XMLNode const &);
827 
828  void begin_midi_learn (int index);
829  void midi_unlearn (int index);
831 
832  static Temporal::BBT_Offset assumed_trigger_duration () { return _assumed_trigger_duration; }
834 
835  static TriggerMidiMapMode midi_map_mode () { return _midi_map_mode; }
837 
838  static int first_midi_note() { return _first_midi_note; }
839  static void set_first_midi_note (int n);
840 
841  static void init ();
842  static void static_init (Session&);
843  static void begin_process_cycle ();
844 
846 
848 
850 
852  static PBD::Signal2<void,PBD::PropertyChange,int> TriggerBoxPropertyChange;
853 
854  void dump (std::ostream &) const;
855 
856  private:
857  struct Requests {
858  std::atomic<bool> stop_all;
859 
860  Requests () : stop_all (false) {}
861  };
862 
864 
866  int32_t _order;
867  mutable Glib::Threads::RWLock trigger_lock; /* protects all_triggers */
869 
870  typedef std::vector<Trigger*> PendingTriggers;
872 
873  PBD::RingBuffer<uint32_t> explicit_queue; /* user queued triggers */
876  bool _stop_all;
877  int32_t _active_scene;
878  int32_t _active_slots;
882 
884 
885  /* These four are accessed (read/write) only from process() context */
886 
887  void drop_triggers ();
890  int determine_next_trigger (uint32_t n);
891  void stop_all ();
892 
893  void maybe_swap_pending (uint32_t);
894 
895  void parameter_changed (std::string const &);
896  static void static_parameter_changed (std::string const &);
897 
898  static int _first_midi_note;
900 
901  struct Request {
902  enum Type {
905  };
906 
908 
909  /* cannot use a union here because we need Request to have a
910  * "trivial" constructor.
911  */
912 
914  void* ptr;
915  int32_t slot;
916 
917  Request (Type t) : type (t) {}
918 
920  static void init_pool();
921 
922  void* operator new (size_t);
923  void operator delete (void* ptr, size_t);
924  };
925 
928 
931 
932  void reload (BufferSet& bufs, int32_t slot, void* ptr);
933 
936  int handle_stopped_trigger (BufferSet& bufs, pframes_t dest_offset);
937 
939 
940  typedef std::map<std::vector<uint8_t>,std::pair<int,int> > CustomMidiMap;
942 
944  static std::shared_ptr<MIDI::Parser> input_parser;
946  static void input_port_check ();
948  static std::shared_ptr<MidiPort> current_input;
949 
950  static bool _learning;
951  static std::pair<int,int> learning_for;
952  static PBD::Signal0<void> TriggerMIDILearned;
953 
954  static void init_pool();
955 
956  static std::atomic<int> active_trigger_boxes;
957  static std::atomic<bool> _cue_recording;
958  static bool roll_requested;
959  static void maybe_request_roll (Session&);
960 };
961 
963 {
964 public:
965  TriggerReference () : box (0), slot (0) {}
966  TriggerReference (ARDOUR::TriggerBox& b, uint32_t s) : box (&b), slot (s) {}
967 
968  std::shared_ptr<ARDOUR::Trigger> trigger() const { assert (box); return box->trigger (slot); }
969 
971  uint32_t slot;
972 };
973 
974 namespace Properties {
993  LIBARDOUR_API extern PBD::PropertyDescriptor<bool> patch_change; /* type not important */
994  LIBARDOUR_API extern PBD::PropertyDescriptor<bool> channel_map; /* type not important */
995  LIBARDOUR_API extern PBD::PropertyDescriptor<bool> used_channels; /* type not important */
996 
997  LIBARDOUR_API extern PBD::PropertyDescriptor<bool> tempo_meter; /* only used to transmit changes, not storage */
998 }
999 
1000 
1001 } // namespace ARDOUR
1002 
1003 namespace PBD {
1007 } /* namespace PBD */
1008 
1009 
1010 #endif /* __ardour_triggerbox_h__ */
samplecnt_t to_pad
Definition: triggerbox.h:555
RubberBand::RubberBandStretcher * _stretcher
Definition: triggerbox.h:544
samplepos_t _legato_offset
Definition: triggerbox.h:552
bool stretching() const
SegmentDescriptor get_segment_descriptor() const
samplepos_t last_readable_sample
Definition: triggerbox.h:551
void set_segment_tempo(double t)
void set_end(timepos_t const &)
timepos_t current_length() const
void set_start(timepos_t const &)
timepos_t compute_end(Temporal::TempoMap::SharedPtr const &, Temporal::BBT_Time const &, samplepos_t, Temporal::Beats &)
timepos_t natural_length() const
samplecnt_t read_index
Definition: triggerbox.h:550
samplecnt_t to_drop
Definition: triggerbox.h:556
XMLNode & get_state() const
void reload(BufferSet &, void *)
AudioTrigger(uint32_t index, TriggerBox &)
double segment_tempo() const
Definition: triggerbox.h:501
RubberBand::RubberBandStretcher * stretcher()
Definition: triggerbox.h:525
void set_length(timecnt_t const &)
int set_state(const XMLNode &, int version)
int set_region_in_worker_thread(std::shared_ptr< Region >)
double segment_beatcnt()
Definition: triggerbox.h:504
virtual void setup_stretcher()
samplepos_t _start_offset
Definition: triggerbox.h:545
void _startup(BufferSet &, pframes_t dest_offset, Temporal::BBT_Offset const &)
void set_legato_offset(timepos_t const &)
void set_segment_beatcnt(double count)
StretchMode stretch_mode() const
Definition: triggerbox.h:498
int load_data(std::shared_ptr< AudioRegion >)
void set_stretch_mode(StretchMode)
samplecnt_t retrieved
Definition: triggerbox.h:553
samplecnt_t got_stretcher_padding
Definition: triggerbox.h:554
bool probably_oneshot() const
timepos_t start_offset() const
pframes_t audio_run(BufferSet &bufs, samplepos_t start_sample, samplepos_t end_sample, Temporal::Beats const &start, Temporal::Beats const &end, pframes_t nframes, pframes_t dest_offset, double bpm, pframes_t &quantize_offset)
pframes_t run(BufferSet &bufs, samplepos_t start_sample, samplepos_t end_sample, Temporal::Beats const &start, Temporal::Beats const &end, pframes_t nframes, pframes_t dest_offset, double bpm, pframes_t &quantize_offset)
Definition: triggerbox.h:494
void start_and_roll_to(samplepos_t start, samplepos_t position, uint32_t cnt)
void jump_stop(BufferSet &bufs, pframes_t dest_offset)
void set_legato_offset(timepos_t const &)
samplepos_t last_event_samples
Definition: triggerbox.h:638
MidiModel::const_iterator iter
Definition: triggerbox.h:644
void shutdown(BufferSet &bufs, pframes_t dest_offset)
timepos_t current_length() const
void _startup(BufferSet &, pframes_t dest_offset, Temporal::BBT_Offset const &)
XMLNode & get_state() const
void set_used_channels(Evoral::SMF::UsedChannels)
void compute_and_set_length()
void estimate_midi_patches()
void reload(BufferSet &, void *)
virtual double segment_tempo() const
Definition: triggerbox.h:618
Temporal::DoubleableBeats last_event_beats
Definition: triggerbox.h:637
void unset_all_patch_changes()
timepos_t compute_end(Temporal::TempoMap::SharedPtr const &, Temporal::BBT_Time const &, samplepos_t, Temporal::Beats &)
bool patch_change_set(uint8_t channel) const
void unset_channel_map(int channel)
timepos_t natural_length() const
Temporal::Beats final_beat
Definition: triggerbox.h:634
pframes_t midi_run(BufferSet &, samplepos_t start_sample, samplepos_t end_sample, Temporal::Beats const &start_beats, Temporal::Beats const &end_beats, pframes_t nframes, pframes_t offset, double bpm, pframes_t &quantize_offset)
void unset_patch_change(uint8_t channel)
void set_patch_change(Evoral::PatchChange< MidiBuffer::TimeType > const &)
int set_state(const XMLNode &, int version)
MIDITrigger(uint32_t index, TriggerBox &)
pframes_t run(BufferSet &bufs, samplepos_t start_sample, samplepos_t end_sample, Temporal::Beats const &start, Temporal::Beats const &end, pframes_t nframes, pframes_t dest_offset, double bpm, pframes_t &quantize_offset)
Definition: triggerbox.h:576
timepos_t end() const
std::vector< int > const & channel_map() const
Definition: triggerbox.h:625
std::shared_ptr< MidiModel > model
Definition: triggerbox.h:643
Evoral::SMF::UsedChannels used_channels() const
Definition: triggerbox.h:613
bool probably_oneshot() const
virtual void setup_stretcher()
Definition: triggerbox.h:620
Temporal::BBT_Offset _legato_offset
Definition: triggerbox.h:641
void set_length(timecnt_t const &)
void jump_stop(BufferSet &bufs, pframes_t dest_offset)
virtual void set_segment_tempo(double t)
Definition: triggerbox.h:619
int channel_map(int channel)
SegmentDescriptor get_segment_descriptor() const
void set_channel_map(int channel, int target)
Evoral::PatchChange< MidiBuffer::TimeType > const patch_change(uint8_t) const
void set_start(timepos_t const &)
int set_region_in_worker_thread(std::shared_ptr< Region >)
timepos_t start_offset() const
PBD::ScopedConnection content_connection
Definition: triggerbox.h:632
int load_data(std::shared_ptr< MidiRegion >)
Temporal::DoubleableBeats data_length
Definition: triggerbox.h:636
void start_and_roll_to(samplepos_t start, samplepos_t position, uint32_t cnt)
void set_end(timepos_t const &)
Temporal::BBT_Offset _start_offset
Definition: triggerbox.h:640
CrossThreadChannel _xthread
Definition: triggerbox.h:699
void set_region(TriggerBox &, uint32_t slot, std::shared_ptr< Region >)
void queue_request(Request *)
static void init_request_pool()
Definition: triggerbox.h:658
void delete_trigger(Trigger *)
void request_delete_trigger(Trigger *t)
PBD::RingBuffer< Request * > requests
Definition: triggerbox.h:697
static void * _thread_work(void *arg)
static TriggerBoxThread * worker
Definition: triggerbox.h:845
static void static_parameter_changed(std::string const &)
void used_regions(std::set< std::shared_ptr< Region >> &)
int32_t active_scene() const
Definition: triggerbox.h:806
static TriggerMidiMapMode _midi_map_mode
Definition: triggerbox.h:899
static void init()
static PBD::ScopedConnectionList static_connections
Definition: triggerbox.h:947
void process_ui_trigger_requests()
TriggerBox(Session &, DataType dt)
double position_as_fraction() const
void process_request(BufferSet &, Request *)
bool configure_io(ChanCount in, ChanCount out)
DataType _data_type
Definition: triggerbox.h:865
PendingTriggers pending
Definition: triggerbox.h:871
RequestBuffer requests
Definition: triggerbox.h:927
PBD::ScopedConnection stop_all_connection
Definition: triggerbox.h:938
void fast_forward_nothing_to_do()
void process_requests(BufferSet &)
TriggerPtr get_next_trigger()
int32_t _active_scene
Definition: triggerbox.h:877
static void static_init(Session &)
void maybe_swap_pending(uint32_t)
Triggers all_triggers
Definition: triggerbox.h:868
static PBD::Signal0< void > TriggerMIDILearned
Definition: triggerbox.h:952
void set_all_quantization(Temporal::BBT_Offset const &)
static TriggerMidiMapMode midi_map_mode()
Definition: triggerbox.h:835
void deep_sources(std::set< std::shared_ptr< Source >> &)
void cancel_locate_armed()
int set_state(const XMLNode &, int version)
static void maybe_request_roll(Session &)
void set_from_selection(uint32_t slot, std::shared_ptr< Region >)
XMLNode & get_state() const
int handle_stopped_trigger(BufferSet &bufs, pframes_t dest_offset)
static void set_first_midi_note(int n)
static void add_custom_midi_binding(std::vector< uint8_t > const &, int x, int y)
void fast_forward(CueEvents const &, samplepos_t transport_postiion)
void dump(std::ostream &) const
static bool _learning
Definition: triggerbox.h:950
TriggerPtr trigger(Triggers::size_type)
int32_t order() const
Definition: triggerbox.h:742
static void init_pool()
static CueRecords cue_records
Definition: triggerbox.h:729
int determine_next_trigger(uint32_t n)
void non_realtime_transport_stop(samplepos_t now, bool flush)
TriggerPtr peek_next_trigger()
static void midi_input_handler(MIDI::Parser &, MIDI::byte *, size_t, samplecnt_t)
static void set_midi_map_mode(TriggerMidiMapMode m)
static PBD::ScopedConnection midi_input_connection
Definition: triggerbox.h:945
DataType data_type() const
Definition: triggerbox.h:768
void begin_midi_learn(int index)
static void clear_custom_midi_bindings()
static std::pair< int, int > learning_for
Definition: triggerbox.h:951
PBD::RingBuffer< Request * > RequestBuffer
Definition: triggerbox.h:926
static Temporal::BBT_Offset assumed_trigger_duration()
Definition: triggerbox.h:832
void midi_unlearn(int index)
static void begin_process_cycle()
bool can_support_io_configuration(const ChanCount &in, ChanCount &out)
void non_realtime_locate(samplepos_t now)
void set_all_launch_style(ARDOUR::Trigger::LaunchStyle)
static bool lookup_custom_midi_binding(std::vector< uint8_t > const &, int &x, int &y)
static std::atomic< int > active_trigger_boxes
Definition: triggerbox.h:956
static void set_cue_recording(bool yn)
void set_all_follow_action(ARDOUR::FollowAction const &, uint32_t n=0)
std::map< std::vector< uint8_t >, std::pair< int, int > > CustomMidiMap
Definition: triggerbox.h:940
static std::shared_ptr< MidiPort > current_input
Definition: triggerbox.h:948
void set_pending(uint32_t slot, Trigger *)
static int first_midi_note()
Definition: triggerbox.h:838
static CustomMidiMap _custom_midi_map
Definition: triggerbox.h:941
void set_order(int32_t n)
void clear_cue(int cue)
void parameter_changed(std::string const &)
void request_reload(int32_t slot, void *)
static Temporal::BBT_Offset _assumed_trigger_duration
Definition: triggerbox.h:863
void bang_trigger_at(Triggers::size_type row, float velocity=1.0f)
static void remove_custom_midi_binding(int x, int y)
static bool roll_requested
Definition: triggerbox.h:958
std::vector< Trigger * > PendingTriggers
Definition: triggerbox.h:870
static int save_custom_midi_bindings(std::string const &path)
PBD::Signal1< void, uint32_t > TriggerSwapped
Definition: triggerbox.h:808
PBD::PCGRand _pcg
Definition: triggerbox.h:883
std::vector< TriggerPtr > Triggers
Definition: triggerbox.h:745
Requests _requests
Definition: triggerbox.h:875
PBD::RingBuffer< uint32_t > explicit_queue
Definition: triggerbox.h:873
void queue_explict(uint32_t)
static std::atomic< bool > _cue_recording
Definition: triggerbox.h:957
static void set_assumed_trigger_duration(Temporal::BBT_Offset const &)
void reload(BufferSet &bufs, int32_t slot, void *ptr)
void realtime_handle_transport_stopped()
void unbang_trigger_at(Triggers::size_type row)
static PBD::PropertyChange all_trigger_props()
void process_midi_trigger_requests(BufferSet &)
static void start_transport_stop(Session &)
bool fast_forwarding() const
Definition: triggerbox.h:755
static XMLNode * get_custom_midi_binding_state()
bool empty() const
Definition: triggerbox.h:739
TriggerPtr currently_playing() const
Definition: triggerbox.h:773
static int load_custom_midi_bindings(XMLNode const &)
void add_trigger(TriggerPtr)
void run(BufferSet &bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool result_required)
PBD::Signal0< void > EmptyStatusChanged
Definition: triggerbox.h:740
static bool cue_recording()
Definition: triggerbox.h:730
void send_property_change(PBD::PropertyChange pc)
void enqueue_trigger_state_for_region(std::shared_ptr< Region >, std::shared_ptr< Trigger::UIState >)
static int _first_midi_note
Definition: triggerbox.h:898
void run_cycle(BufferSet &bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes)
static void input_port_check()
void set_region(uint32_t slot, std::shared_ptr< Region > region)
void set_from_path(uint32_t slot, std::string const &path)
Glib::Threads::RWLock trigger_lock
Definition: triggerbox.h:867
static PBD::Signal0< void > CueRecordingChanged
Definition: triggerbox.h:732
void set_all_probability(int zero_to_a_hundred)
void stop_all_immediately()
MidiStateTracker * tracker
Definition: triggerbox.h:818
TriggerPtr trigger_by_id(PBD::ID)
static std::shared_ptr< MIDI::Parser > input_parser
Definition: triggerbox.h:944
TriggerPtr _currently_playing
Definition: triggerbox.h:874
static PBD::Signal2< void, PBD::PropertyChange, int > TriggerBoxPropertyChange
Definition: triggerbox.h:852
int32_t _active_slots
Definition: triggerbox.h:878
ARDOUR::TriggerBox * box
Definition: triggerbox.h:970
std::shared_ptr< ARDOUR::Trigger > trigger() const
Definition: triggerbox.h:968
TriggerReference(ARDOUR::TriggerBox &b, uint32_t s)
Definition: triggerbox.h:966
uint32_t loop_count() const
Definition: triggerbox.h:371
void process_state_requests(BufferSet &bufs, pframes_t dest_offset)
double _estimated_tempo
Definition: triggerbox.h:455
Temporal::Meter meter() const
Definition: triggerbox.h:398
virtual void shutdown(BufferSet &bufs, pframes_t dest_offset)
bool will_not_follow() const
samplecnt_t process_index
Definition: triggerbox.h:427
PBD::Property< bool > _cue_isolated
Definition: triggerbox.h:159
virtual void set_patch_change(Evoral::PatchChange< MidiBuffer::TimeType > const &)
Definition: triggerbox.h:390
uint32_t _loop_cnt
Definition: triggerbox.h:438
std::vector< int > _channel_map
Definition: triggerbox.h:448
PBD::Property< LaunchStyle > _launch_style
Definition: triggerbox.h:147
virtual Evoral::SMF::UsedChannels used_channels() const
Definition: triggerbox.h:386
virtual Evoral::PatchChange< MidiBuffer::TimeType > const patch_change(uint8_t) const
Definition: triggerbox.h:391
PBD::Property< Temporal::BBT_Offset > _quantization
Definition: triggerbox.h:152
virtual timepos_t current_length() const =0
Temporal::BBT_Offset _start_quantization
Definition: triggerbox.h:471
PBD::Property< FollowAction > _follow_action0
Definition: triggerbox.h:148
void set_ui(void *)
TriggerBox & box() const
Definition: triggerbox.h:376
pframes_t compute_next_transition(samplepos_t start_sample, Temporal::Beats const &start, Temporal::Beats const &end, pframes_t nframes, Temporal::BBT_Argument &t_bbt, Temporal::Beats &t_beats, samplepos_t &t_samples, Temporal::TempoMap::SharedPtr const &tmap)
PBD::Property< FollowAction > _follow_action1
Definition: triggerbox.h:149
std::atomic< int > _bang
Definition: triggerbox.h:434
virtual bool patch_change_set(uint8_t channel) const
Definition: triggerbox.h:394
void begin_stop(bool explicit_stop=false)
PBD::Property< float > _velocity_effect
Definition: triggerbox.h:157
Temporal::Meter _meter
Definition: triggerbox.h:468
PBD::Property< bool > _stretchable
Definition: triggerbox.h:158
samplepos_t transition_samples
Definition: triggerbox.h:329
void set_region_internal(std::shared_ptr< Region >)
double position_as_fraction() const
int next_trigger() const
Definition: triggerbox.h:354
virtual void io_change()
Definition: triggerbox.h:289
samplepos_t final_processed_sample
Definition: triggerbox.h:428
static void request_trigger_delete(Trigger *t)
static Trigger *const MagicClearPointerValue
Definition: triggerbox.h:407
virtual void set_end(timepos_t const &)=0
PBD::Property< int > _follow_action_probability
Definition: triggerbox.h:150
virtual void jump_stop(BufferSet &bufs, pframes_t dest_offset)
virtual int set_region_in_worker_thread(std::shared_ptr< Region >)=0
virtual void unset_patch_change(uint8_t channel)
Definition: triggerbox.h:392
virtual timepos_t compute_end(Temporal::TempoMap::SharedPtr const &, Temporal::BBT_Time const &, samplepos_t, Temporal::Beats &)=0
virtual void jump_start()
virtual void start_and_roll_to(samplepos_t start, samplepos_t position, uint32_t cnt)=0
void when_stopped_during_run(BufferSet &bufs, pframes_t dest_offset)
std::atomic< int > _unbang
Definition: triggerbox.h:435
bool will_follow() const
Definition: triggerbox.h:302
virtual timepos_t start_offset() const =0
int set_state(const XMLNode &, int version)
State state() const
Definition: triggerbox.h:316
PBD::Property< std::string > _name
Definition: triggerbox.h:165
virtual ~Trigger()
Definition: triggerbox.h:140
PBD::Property< gain_t > _gain
Definition: triggerbox.h:156
bool active() const
Definition: triggerbox.h:315
static void make_property_quarks()
void copy_to_ui_state()
uint32_t index() const
Definition: triggerbox.h:323
virtual SegmentDescriptor get_segment_descriptor() const =0
Temporal::BBT_Argument compute_start(Temporal::TempoMap::SharedPtr const &, samplepos_t start, samplepos_t end, Temporal::BBT_Offset const &q, samplepos_t &start_samples, bool &will_start)
samplepos_t expected_end_sample
Definition: triggerbox.h:470
PBD::Property< uint32_t > _follow_count
Definition: triggerbox.h:151
std::shared_ptr< Region > region() const
Definition: triggerbox.h:321
virtual void set_used_channels(Evoral::SMF::UsedChannels)
Definition: triggerbox.h:387
PBD::Property< StretchMode > _stretch_mode
Definition: triggerbox.h:161
void set_ui_state(UIState &state)
Trigger(uint32_t index, TriggerBox &)
virtual void set_legato_offset(timepos_t const &offset)=0
void shutdown_from_fwd()
timepos_t current_pos() const
gain_t _pending_velocity_gain
Definition: triggerbox.h:441
virtual timepos_t natural_length() const =0
uint32_t _index
Definition: triggerbox.h:436
virtual void retrigger()
bool cue_launched() const
Definition: triggerbox.h:305
void set_pending(Trigger *)
virtual void reload(BufferSet &, void *)=0
virtual void setup_stretcher()=0
virtual bool probably_oneshot() const =0
void set_velocity_gain(gain_t g)
Definition: triggerbox.h:400
gain_t _velocity_gain
Definition: triggerbox.h:442
void stop_quantized()
virtual void _startup(BufferSet &, pframes_t dest_offset, Temporal::BBT_Offset const &)
UIState ui_state
Definition: triggerbox.h:429
std::shared_ptr< Region > _region
Definition: triggerbox.h:426
void startup_from_ffwd(BufferSet &, uint32_t loop_cnt)
virtual void set_length(timecnt_t const &)=0
virtual double segment_tempo() const =0
PBD::Property< bool > _legato
Definition: triggerbox.h:155
virtual void unset_all_patch_changes()
Definition: triggerbox.h:393
Trigger * swap_pending(Trigger *)
static PBD::Signal2< void, PBD::PropertyChange, Trigger * > TriggerPropertyChange
Definition: triggerbox.h:418
PBD::Property< color_t > _color
Definition: triggerbox.h:166
void begin_switch(TriggerPtr)
Evoral::SMF::UsedChannels _used_channels
Definition: triggerbox.h:446
bool compute_quantized_transition(samplepos_t start_sample, Temporal::Beats const &start, Temporal::Beats const &end, Temporal::BBT_Argument &t_bbt, Temporal::Beats &t_beats, samplepos_t &t_samples, Temporal::TempoMap::SharedPtr const &tmap, Temporal::BBT_Offset const &q)
XMLNode & get_state() const
PBD::Property< Temporal::BBT_Offset > _follow_length
Definition: triggerbox.h:153
void set_region(std::shared_ptr< Region >, bool use_thread=true)
double estimated_tempo() const
Definition: triggerbox.h:378
void get_ui_state(UIState &state) const
void * ui() const
Definition: triggerbox.h:374
UIRequests _requests
Definition: triggerbox.h:431
std::atomic< Trigger * > _pending
Definition: triggerbox.h:473
Temporal::BBT_Time _transition_bbt
Definition: triggerbox.h:331
void bang(float velocity=1.0f)
Temporal::Beats transition_beats
Definition: triggerbox.h:330
void maybe_compute_next_transition(samplepos_t start_sample, Temporal::Beats const &start, Temporal::Beats const &end, pframes_t &nframes, pframes_t &dest_offset)
void update_properties()
PBD::Property< bool > _use_follow_length
Definition: triggerbox.h:154
Temporal::BBT_Offset _nxt_quantization
Definition: triggerbox.h:472
virtual void set_segment_tempo(double t)=0
void send_property_change(PBD::PropertyChange pc)
virtual pframes_t run(BufferSet &, samplepos_t start_sample, samplepos_t end_sample, Temporal::Beats const &start, Temporal::Beats const &end, pframes_t nframes, pframes_t offset, double bpm, pframes_t &quantize_offset)=0
virtual void set_start(timepos_t const &)=0
void set_next_trigger(int n)
void start_and_roll_to(samplepos_t start_pos, samplepos_t end_position, TriggerType &trigger, pframes_t(TriggerType::*run_method)(BufferSet &bufs, samplepos_t start_sample, samplepos_t end_sample, Temporal::Beats const &start_beats, Temporal::Beats const &end_beats, pframes_t nframes, pframes_t dest_offset, double bpm, pframes_t &), uint32_t cnt)
bool explicitly_stopped() const
Definition: triggerbox.h:369
TriggerBox & _box
Definition: triggerbox.h:430
bool _explicitly_stopped
Definition: triggerbox.h:440
PBD::Property< bool > _allow_patch_changes
Definition: triggerbox.h:160
double _segment_tempo
Definition: triggerbox.h:456
std::atomic< unsigned int > last_property_generation
Definition: triggerbox.h:474
virtual void tempo_map_changed()
Definition: triggerbox.h:280
void startup(BufferSet &, pframes_t dest_offset, Temporal::BBT_Offset const &start_quantization=Temporal::BBT_Offset(9, 3, 0))
bool internal_use_follow_length() const
bool is_set() const
Definition: PatchChange.h:110
std::bitset< 16 > UsedChannels
Definition: SMF.h:92
Definition: id.h:35
std::shared_ptr< TempoMap const > SharedPtr
Definition: xml++.h:114
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
PBD::PropertyDescriptor< uint32_t > queued
PBD::PropertyDescriptor< gain_t > gain
PBD::PropertyDescriptor< bool > legato
PBD::PropertyDescriptor< bool > tempo_meter
PBD::PropertyDescriptor< Temporal::BBT_Offset > follow_length
PBD::PropertyDescriptor< bool > use_follow_length
PBD::PropertyDescriptor< bool > running
PBD::PropertyDescriptor< Trigger::LaunchStyle > launch_style
PBD::PropertyDescriptor< uint32_t > color
PBD::PropertyDescriptor< uint32_t > currently_playing
PBD::PropertyDescriptor< int > follow_action_probability
PBD::PropertyDescriptor< bool > allow_patch_changes
PBD::PropertyDescriptor< timecnt_t > length
PBD::PropertyDescriptor< bool > cue_isolated
PBD::PropertyDescriptor< Temporal::BBT_Offset > quantization
PBD::PropertyDescriptor< bool > patch_change
PBD::PropertyDescriptor< FollowAction > follow_action1
PBD::PropertyDescriptor< timepos_t > start
PBD::PropertyDescriptor< float > velocity_effect
PBD::PropertyDescriptor< FollowAction > follow_action0
PBD::PropertyDescriptor< uint32_t > follow_count
PBD::PropertyDescriptor< bool > stretchable
PBD::PropertyDescriptor< bool > used_channels
PBD::PropertyDescriptor< Trigger::StretchMode > stretch_mode
PBD::PropertyDescriptor< bool > channel_map
PBD::RingBuffer< CueRecord > CueRecords
Definition: triggerbox.h:714
std::shared_ptr< Trigger > TriggerPtr
Definition: triggerbox.h:80
uint32_t pframes_t
std::vector< CueEvent > CueEvents
Temporal::samplecnt_t samplecnt_t
uint32_t color_t
Definition: triggerbox.h:74
std::string cue_marker_name(int32_t)
Temporal::samplepos_t samplepos_t
void flush()
DebugBits Properties
Definition: axis_view.h:42
DEFINE_ENUM_CONVERT(ARDOUR::Track::FreezeState)
int32_t cue_number
Definition: triggerbox.h:705
static const int32_t stop_all
Definition: triggerbox.h:711
CueRecord(int32_t cn, samplepos_t t)
Definition: triggerbox.h:708
samplepos_t when
Definition: triggerbox.h:706
static PBD::MultiAllocSingleReleasePool * pool
Definition: triggerbox.h:692
std::shared_ptr< Region > region
Definition: triggerbox.h:685
static PBD::MultiAllocSingleReleasePool * pool
Definition: triggerbox.h:919
std::atomic< bool > stop_all
Definition: triggerbox.h:858
std::atomic< bool > stop
Definition: triggerbox.h:422
Temporal::BBT_Offset quantization
Definition: triggerbox.h:180
Temporal::BBT_Offset follow_length
Definition: triggerbox.h:181
StretchMode stretch_mode
Definition: triggerbox.h:189
LaunchStyle launch_style
Definition: triggerbox.h:175
FollowAction follow_action0
Definition: triggerbox.h:176
std::atomic< unsigned int > generation
Definition: triggerbox.h:173
Evoral::SMF::UsedChannels used_channels
Definition: triggerbox.h:191
Evoral::PatchChange< MidiBuffer::TimeType > patch_change[16]
Definition: triggerbox.h:192
FollowAction follow_action1
Definition: triggerbox.h:177
#define TRIGGERBOX_PROPERTY_DECL_CONST_REF(name, type)
Definition: triggerbox.h:238
#define TRIGGERBOX_PROPERTY_DECL(name, type)
Definition: triggerbox.h:237