Auditioner: add API for UI to run the synth (idle)

This allows the synth to process injected out-of-band MIDI
data, such as Program/Patch Changes while audition is inactive.
This commit is contained in:
Robin Gareus 2022-02-04 13:19:47 +01:00
parent 604652b7d6
commit 4fe9d99674
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 18 additions and 0 deletions

View File

@ -57,6 +57,8 @@ public:
sampleoffset_t seek_sample() const { return _seeking ? _seek_sample : -1;}
void seek_response(sampleoffset_t pos);
void idle_synth_update ();
MonitorState monitoring_state () const;
bool needs_monitor() const { return via_monitor; }

View File

@ -551,6 +551,22 @@ Auditioner::seek_response (sampleoffset_t pos) {
}
}
void
Auditioner::idle_synth_update ()
{
if (auditioning() || !asynth) {
return;
}
auto pi = boost::dynamic_pointer_cast<PluginInsert> (asynth);
/* Note: calling thread must have process buffers */
BufferSet bufs;
samplepos_t start = 0;
pframes_t n_samples = 16;
/* MIDI buffers need to be able to hold patch/pgm change messages. (16 bytes + msg-size) per event */
bufs.ensure_buffers (max (asynth->input_streams (), asynth->output_streams ()), std::max<size_t> (1024, n_samples));
pi->run (bufs, start, start + n_samples, 1.0, n_samples, false);
}
void
Auditioner::output_changed (IOChange change, void* /*src*/)