diff --git a/src/reskit/soundtrack/engines/echo.rs b/src/reskit/soundtrack/engines/echo.rs index 9a3c923..e9a7c32 100644 --- a/src/reskit/soundtrack/engines/echo.rs +++ b/src/reskit/soundtrack/engines/echo.rs @@ -306,6 +306,44 @@ fn apply_effects_to_channel( channel: &mut Channel, effects: &LinkedHashSet { + let speed = *speed; + + // Remove all prior portamentos (you cannot portamento up and down at the same time) + channel.active_effects = channel.active_effects + .clone() + .into_iter() + .filter( | effect | + !( + matches!( effect, Effect::PortamentoDown { speed: _ } ) || + matches!( effect, Effect::PortamentoUp { speed: _ } ) + ) + ) + .collect(); + + if speed > 0 { + channel.active_effects.insert( Effect::PortamentoUp { speed } ); + } + }, + Effect::PortamentoDown { speed } => { + let speed = *speed; + + // Remove all prior portamentos (you cannot portamento up and down at the same time) + channel.active_effects = channel.active_effects + .clone() + .into_iter() + .filter( | effect | + !( + matches!( effect, Effect::PortamentoDown { speed: _ } ) || + matches!( effect, Effect::PortamentoUp { speed: _ } ) + ) + ) + .collect(); + + if speed > 0 { + channel.active_effects.insert( Effect::PortamentoDown { speed } ); + } + }, Effect::SetPanning { left, right } => { let left = *left; let right = *right; @@ -357,6 +395,8 @@ fn compact_delays( events: Vec ) -> Result, Box