mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:17:44 +00:00
LibDSP+LibAudio: Use logarithmic scaling in delay effect
With logarithmic volume scaling, the delay effect can sound more natural.
This commit is contained in:
parent
152ec28da0
commit
ab4a2b8b41
2 changed files with 3 additions and 4 deletions
|
@ -78,7 +78,7 @@ struct Frame {
|
|||
return *this;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Frame log_multiplied(double const volume_change)
|
||||
ALWAYS_INLINE Frame log_multiplied(double const volume_change) const
|
||||
{
|
||||
Frame new_frame { left, right };
|
||||
new_frame.log_multiply(volume_change);
|
||||
|
|
|
@ -39,9 +39,8 @@ Signal Delay::process_impl(Signal const& input_signal)
|
|||
|
||||
Sample const& in = input_signal.get<Sample>();
|
||||
Sample out;
|
||||
// FIXME: Once we have log scaling, change these to use it instead
|
||||
out += in.scaled(static_cast<double>(m_dry_gain));
|
||||
out += m_delay_buffer[m_delay_index].scaled(m_delay_decay);
|
||||
out += in.log_multiplied(static_cast<double>(m_dry_gain));
|
||||
out += m_delay_buffer[m_delay_index].log_multiplied(m_delay_decay);
|
||||
|
||||
// This is also convenient for disabling the delay effect by setting the buffer size to 0
|
||||
if (m_delay_buffer.size() >= 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue