diff --git a/libs/ardour/ardour/triggerbox.h b/libs/ardour/ardour/triggerbox.h index c565d9e3b1..6cc4d50c47 100644 --- a/libs/ardour/ardour/triggerbox.h +++ b/libs/ardour/ardour/triggerbox.h @@ -65,7 +65,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful { Stopping = 6 }; - Trigger (size_t index, TriggerBox&); + Trigger (uint64_t index, TriggerBox&); virtual ~Trigger() {} static void make_property_quarks (); @@ -116,8 +116,8 @@ class LIBARDOUR_API Trigger : public PBD::Stateful { OtherTrigger, }; - FollowAction follow_action (size_t n) const { assert (n < 2); return _follow_action[n]; } - void set_follow_action (FollowAction, size_t n); + FollowAction follow_action (uint64_t n) const { assert (n < 2); return _follow_action[n]; } + void set_follow_action (FollowAction, uint64_t n); virtual int set_region (boost::shared_ptr) = 0; boost::shared_ptr region() const { return _region; } @@ -126,7 +126,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful { void set_quantization (Temporal::BBT_Offset const &); - size_t index() const { return _index; } + uint64_t index() const { return _index; } /* Managed by TriggerBox */ samplepos_t bang_samples; @@ -176,7 +176,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful { std::atomic _requested_state; std::atomic _bang; std::atomic _unbang; - size_t _index; + uint64_t _index; int _next_trigger; LaunchStyle _launch_style; FollowAction _follow_action[2]; @@ -195,7 +195,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful { class LIBARDOUR_API AudioTrigger : public Trigger { public: - AudioTrigger (size_t index, TriggerBox&); + AudioTrigger (uint64_t index, TriggerBox&); ~AudioTrigger (); int run (BufferSet&, pframes_t nframes, pframes_t offset, bool first); @@ -259,7 +259,7 @@ class LIBARDOUR_API TriggerBox : public Processor XMLNode& get_state (void); int set_state (const XMLNode&, int version); - int set_from_path (size_t slot, std::string const & path); + int set_from_path (uint64_t slot, std::string const & path); DataType data_type() const { return _data_type; } @@ -267,14 +267,14 @@ class LIBARDOUR_API TriggerBox : public Processor /* only valid when called by Triggers from within ::process_state_requests() */ bool currently_running() const { return currently_playing; } - void set_next (size_t which); + void set_next (uint64_t which); void queue_explict (Trigger*); void queue_implicit (Trigger*); void clear_implicit (); Trigger* get_next_trigger (); Trigger* peek_next_trigger (); - void prepare_next (size_t current); + void prepare_next (uint64_t current); private: PBD::RingBuffer _bang_queue; @@ -294,7 +294,7 @@ class LIBARDOUR_API TriggerBox : public Processor void drop_triggers (); void process_ui_trigger_requests (); void process_midi_trigger_requests (BufferSet&); - int determine_next_trigger (size_t n); + int determine_next_trigger (uint64_t n); void stop_all (); void note_on (int note_number, int velocity); @@ -303,7 +303,7 @@ class LIBARDOUR_API TriggerBox : public Processor typedef std::map MidiTriggerMap; MidiTriggerMap midi_trigger_map; - static const size_t default_triggers_per_box; + static const uint64_t default_triggers_per_box; }; } // namespace ARDOUR diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index 6116e47445..3a31118074 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -36,7 +36,7 @@ namespace ARDOUR { } } -Trigger::Trigger (size_t n, TriggerBox& b) +Trigger::Trigger (uint64_t n, TriggerBox& b) : _box (b) , _state (Stopped) , _requested_state (None) @@ -79,7 +79,7 @@ Trigger::unbang () } void -Trigger::set_follow_action (FollowAction f, size_t n) +Trigger::set_follow_action (FollowAction f, uint64_t n) { assert (n < 2); _follow_action[n] = f; @@ -363,7 +363,7 @@ Trigger::maybe_compute_next_transition (Temporal::Beats const & start, Temporal: /*--------------------*/ -AudioTrigger::AudioTrigger (size_t n, TriggerBox& b) +AudioTrigger::AudioTrigger (uint64_t n, TriggerBox& b) : Trigger (n, b) , data (0) , read_index (0) @@ -722,9 +722,9 @@ AudioTrigger::run (BufferSet& bufs, pframes_t nframes, pframes_t dest_offset, bo pframes_t this_read = (pframes_t) std::min ((samplecnt_t) nframes, (last_sample - read_index)); - for (size_t chn = 0; chn < ar->n_channels(); ++chn) { + for (uint64_t chn = 0; chn < ar->n_channels(); ++chn) { - size_t channel = chn % data.size(); + uint64_t channel = chn % data.size(); Sample* src = data[channel] + read_index; AudioBuffer& buf (bufs.get_audio (chn)); @@ -754,8 +754,8 @@ AudioTrigger::run (BufferSet& bufs, pframes_t nframes, pframes_t dest_offset, bo if (this_read < nframes) { - for (size_t chn = 0; chn < ar->n_channels(); ++chn) { - size_t channel = chn % data.size(); + for (uint64_t chn = 0; chn < ar->n_channels(); ++chn) { + uint64_t channel = chn % data.size(); AudioBuffer& buf (bufs.get_audio (channel)); DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 short fill, ri %2 vs ls %3, do silent fill\n", index(), read_index, last_sample)); buf.silence (nframes - this_read, dest_offset + this_read); @@ -789,7 +789,7 @@ Trigger::make_property_quarks () DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for running = %1\n", Properties::running.property_id)); } -const size_t TriggerBox::default_triggers_per_box = 8; +const uint64_t TriggerBox::default_triggers_per_box = 8; TriggerBox::TriggerBox (Session& s, DataType dt) : Processor (s, _("TriggerBox"), Temporal::BeatTime) @@ -805,7 +805,7 @@ TriggerBox::TriggerBox (Session& s, DataType dt) /* default number of possible triggers. call ::add_trigger() to increase */ if (_data_type == DataType::AUDIO) { - for (size_t n = 0; n < default_triggers_per_box; ++n) { + for (uint64_t n = 0; n < default_triggers_per_box; ++n) { all_triggers.push_back (new AudioTrigger (n, *this)); } } @@ -893,7 +893,7 @@ TriggerBox::get_next_trigger () } int -TriggerBox::set_from_path (size_t slot, std::string const & path) +TriggerBox::set_from_path (uint64_t slot, std::string const & path) { assert (slot < all_triggers.size()); @@ -956,7 +956,7 @@ TriggerBox::stop_all () { /* XXX needs to be done with mutex or via thread-safe queue */ - for (size_t n = 0; n < all_triggers.size(); ++n) { + for (uint64_t n = 0; n < all_triggers.size(); ++n) { all_triggers[n]->stop (-1); } @@ -1070,9 +1070,9 @@ TriggerBox::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp /* now let each trigger handle any state changes */ - std::vector to_run; + std::vector to_run; - for (size_t n = 0; n < all_triggers.size(); ++n) { + for (uint64_t n = 0; n < all_triggers.size(); ++n) { all_triggers[n]->process_state_requests (); } @@ -1099,7 +1099,7 @@ TriggerBox::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp Temporal::Beats start_beats (start.beats()); Temporal::Beats end_beats (end.beats()); Temporal::TempoMap::SharedPtr tmap (Temporal::TempoMap::use()); - size_t max_chans = 0; + uint64_t max_chans = 0; bool first = false; /* see if there's another trigger explicitly queued that has legato set. */ @@ -1213,7 +1213,7 @@ TriggerBox::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp if (at) { boost::shared_ptr ar = boost::dynamic_pointer_cast (r); - const size_t nchans = ar->n_channels (); + const uint64_t nchans = ar->n_channels (); max_chans = std::max (max_chans, nchans); @@ -1259,7 +1259,7 @@ TriggerBox::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp } void -TriggerBox::prepare_next (size_t current) +TriggerBox::prepare_next (uint64_t current) { int nxt = determine_next_trigger (current); @@ -1271,14 +1271,14 @@ TriggerBox::prepare_next (size_t current) } int -TriggerBox::determine_next_trigger (size_t current) +TriggerBox::determine_next_trigger (uint64_t current) { - size_t n; - size_t runnable = 0; + uint64_t n; + uint64_t runnable = 0; /* count number of triggers that can actually be run (i.e. they have a region) */ - for (size_t n = 0; n < all_triggers.size(); ++n) { + for (uint64_t n = 0; n < all_triggers.size(); ++n) { if (all_triggers[n]->region()) { runnable++; } @@ -1395,7 +1395,7 @@ TriggerBox::determine_next_trigger (size_t current) case Trigger::OtherTrigger: while (true) { n = _pcg.rand (all_triggers.size()); - if ((size_t) n == current) { + if ((uint64_t) n == current) { continue; } if (!all_triggers[n]->region()) {