mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
API changes for clip recording in TriggerBox
Also, disarm all triggers when track-level rec-enable is disabled
This commit is contained in:
parent
774f5f49da
commit
7608d4ade2
2 changed files with 21 additions and 7 deletions
|
|
@ -783,6 +783,7 @@ struct SlotArmInfo {
|
||||||
samplepos_t start_samples;
|
samplepos_t start_samples;
|
||||||
Temporal::Beats end_beats;
|
Temporal::Beats end_beats;
|
||||||
samplepos_t end_samples;
|
samplepos_t end_samples;
|
||||||
|
Temporal::timecnt_t captured;
|
||||||
RTMidiBufferBeats* midi_buf;
|
RTMidiBufferBeats* midi_buf;
|
||||||
AudioTrigger::AudioData audio_buf;
|
AudioTrigger::AudioData audio_buf;
|
||||||
RubberBand::RubberBandStretcher* stretcher;
|
RubberBand::RubberBandStretcher* stretcher;
|
||||||
|
|
@ -940,7 +941,7 @@ class LIBARDOUR_API TriggerBox : public Processor, public std::enable_shared_fro
|
||||||
|
|
||||||
void dump (std::ostream &) const;
|
void dump (std::ostream &) const;
|
||||||
|
|
||||||
PBD::Signal0<void> Captured;
|
PBD::Signal1<void,timecnt_t> Captured;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Requests {
|
struct Requests {
|
||||||
|
|
|
||||||
|
|
@ -3556,6 +3556,12 @@ TriggerBox::arm_from_another_thread (Trigger& slot, samplepos_t now, uint32_t ch
|
||||||
ai->start_samples = t_samples;
|
ai->start_samples = t_samples;
|
||||||
ai->start_beats = t_beats;
|
ai->start_beats = t_beats;
|
||||||
|
|
||||||
|
if (_data_type == DataType::AUDIO) {
|
||||||
|
ai->captured = timecnt_t (timepos_t (0), timepos_t (0));
|
||||||
|
} else {
|
||||||
|
ai->captured = timecnt_t::from_ticks (0, timepos_t (Beats()));
|
||||||
|
}
|
||||||
|
|
||||||
_arm_info = ai;
|
_arm_info = ai;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3650,10 +3656,11 @@ TriggerBox::maybe_capture (BufferSet& bufs, samplepos_t start_sample, samplepos_
|
||||||
AudioBuffer& buf (bufs.get_audio (n));
|
AudioBuffer& buf (bufs.get_audio (n));
|
||||||
ai->audio_buf.append (buf.data() + offset, nframes, n);
|
ai->audio_buf.append (buf.data() + offset, nframes, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ai->captured += timecnt_t (start_sample, timepos_t (ai->start_samples));
|
||||||
}
|
}
|
||||||
|
|
||||||
n_buffers = bufs.count().n_midi();
|
n_buffers = bufs.count().n_midi();
|
||||||
bool send_signal = false;
|
|
||||||
|
|
||||||
if (n_buffers) {
|
if (n_buffers) {
|
||||||
|
|
||||||
|
|
@ -3694,16 +3701,15 @@ TriggerBox::maybe_capture (BufferSet& bufs, samplepos_t start_sample, samplepos_
|
||||||
*/
|
*/
|
||||||
ai->midi_buf->write (tmap->quarters_at_sample (event_time) - ai->start_beats, ev.event_type(), ev.size(), ev.buffer());
|
ai->midi_buf->write (tmap->quarters_at_sample (event_time) - ai->start_beats, ev.event_type(), ev.size(), ev.buffer());
|
||||||
_gui_feed_fifo.write (event_time - ai->start_samples, Evoral::MIDI_EVENT, ev.size(), ev.buffer());
|
_gui_feed_fifo.write (event_time - ai->start_samples, Evoral::MIDI_EVENT, ev.size(), ev.buffer());
|
||||||
send_signal = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timecnt_t dur = tmap->convert_duration (timecnt_t (nframes), timepos_t (start_sample), Temporal::BeatTime);
|
||||||
|
ai->captured += dur;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (send_signal) {
|
Captured (ai->captured); /* EMIT SIGNAL */
|
||||||
std::cerr << "SEND CAPTURED\n";
|
|
||||||
Captured(); /* EMIT SIGNAL */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reached_end) {
|
if (reached_end) {
|
||||||
finish_recording (bufs);
|
finish_recording (bufs);
|
||||||
|
|
@ -3714,6 +3720,13 @@ void
|
||||||
TriggerBox::set_record_enabled (bool yn)
|
TriggerBox::set_record_enabled (bool yn)
|
||||||
{
|
{
|
||||||
_record_state = yn ? Enabled : Disabled;
|
_record_state = yn ? Enabled : Disabled;
|
||||||
|
|
||||||
|
if (_record_state == Disabled) {
|
||||||
|
for (auto & trig : all_triggers) {
|
||||||
|
trig->disarm ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RecEnableChanged (); /* EMIT SIGNAL */
|
RecEnableChanged (); /* EMIT SIGNAL */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue