Implement portamentoup/portamentodown effects
parent
8aef9f262d
commit
c91dc3d230
|
@ -306,6 +306,44 @@ fn apply_effects_to_channel( channel: &mut Channel, effects: &LinkedHashSet<Effe
|
|||
channel.active_effects.insert_if_absent( Effect::DacEnable { enabled: true } );
|
||||
}
|
||||
},
|
||||
Effect::PortamentoUp { 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::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<EchoEvent> ) -> Result<Vec<EchoEvent>, Box<dyn Er
|
|||
// Continue to push delay events into current_sequence
|
||||
current_sequence.push( event );
|
||||
} else {
|
||||
// Encountered a non-delay event - we will always push something here,
|
||||
// but let's check first if we need to push a current_sequence of waits.
|
||||
// Coalesce all current delays in current_sequence and push them
|
||||
// onto the new event stream.
|
||||
let mut cumulative_delay: u16 = 0;
|
||||
|
|
Loading…
Reference in New Issue