1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:57:34 +00:00

LibDSP+Piano: Convert DSP APIs to accept entire sample ranges

This has mainly performance benefits, so that we only need to call into
all processors once for every audio buffer segment. It requires
adjusting quite some logic in most processors and in Track, as we have
to consider a larger collection of notes and samples at each step.

There's some cautionary TODOs in the currently unused LibDSP tracks
because they don't do things properly yet.
This commit is contained in:
kleines Filmröllchen 2022-05-11 23:24:46 +02:00 committed by Linus Groh
parent 4d65607649
commit 9035d9e845
9 changed files with 123 additions and 75 deletions

View file

@ -45,8 +45,11 @@ void Track::fill_sample(Sample& sample)
m_keyboard_notes[i] = {};
}
auto synthesized_sample = m_synth->process(playing_notes).get<LibDSP::Sample>();
auto delayed_sample = m_delay->process(synthesized_sample).get<LibDSP::Sample>();
auto synthesized_sample = LibDSP::Signal { FixedArray<Audio::Sample>::must_create_but_fixme_should_propagate_errors(1) };
m_synth->process(playing_notes, synthesized_sample);
auto delayed_signal = LibDSP::Signal { FixedArray<Audio::Sample>::must_create_but_fixme_should_propagate_errors(1) };
m_delay->process(synthesized_sample, delayed_signal);
auto delayed_sample = delayed_signal.get<FixedArray<Audio::Sample>>()[0];
// HACK: Convert to old Piano range: 16-bit int
delayed_sample *= NumericLimits<i16>::max();