1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:57:35 +00:00

Piano: Move to LibDSP's Classic synthesizer

Almost all synthesizer code in Piano is removed in favor of the LibDSP
reimplementation.

This causes some issues that mainly have to do with the way Piano
currently handles talking to LibDSP. Additionally, the sampler is gone
for now and will be reintroduced with future work.
This commit is contained in:
kleines Filmröllchen 2021-09-28 18:01:39 +02:00 committed by Andreas Kling
parent 3ca059da2d
commit b14a64b3c8
14 changed files with 128 additions and 464 deletions

View file

@ -63,6 +63,7 @@ Signal Classic::process_impl(Signal const& input_signal)
return out;
}
// Linear ADSR envelope with no peak adjustment.
double Classic::volume_from_envelope(Envelope envelope)
{
switch (static_cast<EnvelopeState>(envelope)) {
@ -71,10 +72,12 @@ double Classic::volume_from_envelope(Envelope envelope)
case EnvelopeState::Attack:
return envelope.attack();
case EnvelopeState::Decay:
return (1. - envelope.decay()) * m_sustain + m_sustain;
// As we fade from high (1) to low (headroom above the sustain level) here, use 1-decay as the interpolation.
return (1. - envelope.decay()) * (1. - m_sustain) + m_sustain;
case EnvelopeState::Sustain:
return m_sustain;
case EnvelopeState::Release:
// Same goes for the release fade from high to low.
return (1. - envelope.release()) * m_sustain;
}
VERIFY_NOT_REACHED();