triggerbox: change API for finish_recording() and captured() to not require BufferSet

This commit is contained in:
Paul Davis 2025-10-27 14:32:54 -06:00
parent 1400fe012e
commit 3b6b1bdd93
2 changed files with 12 additions and 10 deletions

View file

@ -296,7 +296,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
timepos_t current_pos() const; timepos_t current_pos() const;
double position_as_fraction() const; double position_as_fraction() const;
virtual void captured (SlotArmInfo&, BufferSet&) {} virtual void captured (SlotArmInfo&) {}
void arm (Temporal::BBT_Offset duration = Temporal::BBT_Offset()) { void arm (Temporal::BBT_Offset duration = Temporal::BBT_Offset()) {
_arm (duration); _arm (duration);
} }
@ -542,7 +542,7 @@ class LIBARDOUR_API AudioTrigger : public Trigger {
void io_change (); void io_change ();
bool probably_oneshot () const; bool probably_oneshot () const;
void captured (SlotArmInfo&, BufferSet&); void captured (SlotArmInfo&);
int set_region_in_worker_thread (std::shared_ptr<Region>); int set_region_in_worker_thread (std::shared_ptr<Region>);
int set_region_in_worker_thread_from_capture (std::shared_ptr<Region>); int set_region_in_worker_thread_from_capture (std::shared_ptr<Region>);
@ -616,7 +616,7 @@ class LIBARDOUR_API MIDITrigger : public Trigger {
bool playable() const { return rt_midibuffer.load() || _region; } bool playable() const { return rt_midibuffer.load() || _region; }
void captured (SlotArmInfo&, BufferSet&); void captured (SlotArmInfo&);
void disarm (); void disarm ();
template<bool actually_run> pframes_t midi_run (BufferSet&, samplepos_t start_sample, samplepos_t end_sample, template<bool actually_run> pframes_t midi_run (BufferSet&, samplepos_t start_sample, samplepos_t end_sample,
@ -985,6 +985,8 @@ class LIBARDOUR_API TriggerBox : public Processor, public std::enable_shared_fro
/* return start time for capture; only valid if is_set is true upon return */ /* return start time for capture; only valid if is_set is true upon return */
Temporal::Beats start_time (bool& is_set) const; Temporal::Beats start_time (bool& is_set) const;
void finish_recording ();
private: private:
struct Requests { struct Requests {
std::atomic<bool> stop_all; std::atomic<bool> stop_all;
@ -1016,7 +1018,6 @@ class LIBARDOUR_API TriggerBox : public Processor, public std::enable_shared_fro
PBD::PCGRand _pcg; PBD::PCGRand _pcg;
void maybe_capture (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes); void maybe_capture (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes);
void finish_recording (BufferSet& bufs);
void set_armed (SlotArmInfo*); void set_armed (SlotArmInfo*);
/* These four are accessed (read/write) only from process() context */ /* These four are accessed (read/write) only from process() context */

View file

@ -1864,7 +1864,7 @@ AudioTrigger::drop_data ()
} }
void void
AudioTrigger::captured (SlotArmInfo& ai, BufferSet&) AudioTrigger::captured (SlotArmInfo& ai)
{ {
if (ai.audio_buf.length == 0) { if (ai.audio_buf.length == 0) {
/* Nothing captured */ /* Nothing captured */
@ -2441,7 +2441,7 @@ MIDITrigger::disarm ()
} }
void void
MIDITrigger::captured (SlotArmInfo& ai, BufferSet& bufs) MIDITrigger::captured (SlotArmInfo& ai)
{ {
if (ai.midi_buf->size() == 0) { if (ai.midi_buf->size() == 0) {
disarm (); disarm ();
@ -3670,7 +3670,7 @@ TriggerBox::disarm ()
} }
void void
TriggerBox::finish_recording (BufferSet& bufs) TriggerBox::finish_recording ()
{ {
SlotArmInfo* ai = _arm_info.load(); SlotArmInfo* ai = _arm_info.load();
assert (ai); assert (ai);
@ -3678,7 +3678,7 @@ TriggerBox::finish_recording (BufferSet& bufs)
/* This transfers responsibility for the SlotArmInfo object to the /* This transfers responsibility for the SlotArmInfo object to the
trigger trigger
*/ */
ai->slot->captured (*ai, bufs); ai->slot->captured (*ai);
_arm_info = nullptr; _arm_info = nullptr;
/* XXX this should likely be dependent on what the post-record action is */ /* XXX this should likely be dependent on what the post-record action is */
@ -3729,8 +3729,9 @@ TriggerBox::maybe_capture (BufferSet& bufs, samplepos_t start_sample, samplepos_
if (speed <= 0.) { if (speed <= 0.) {
if (_record_state == Recording) { if (_record_state == Recording) {
std::cerr << "time to stop record\n";
/* We stopped the transport, so just stop immediately (no quantization) */ /* We stopped the transport, so just stop immediately (no quantization) */
finish_recording (bufs); finish_recording ();
} }
/* we stopped or reversed, but were not recording. Nothing to do here */ /* we stopped or reversed, but were not recording. Nothing to do here */
return; return;
@ -3831,7 +3832,7 @@ TriggerBox::maybe_capture (BufferSet& bufs, samplepos_t start_sample, samplepos_
} }
if (reached_end) { if (reached_end) {
finish_recording (bufs); finish_recording ();
} }
} }