None of this shit has to be public
parent
01da82a428
commit
db302a7f7e
|
@ -311,8 +311,8 @@ impl EchoFormat for DmfModule {
|
||||||
// Iterate for each row, for each channel
|
// Iterate for each row, for each channel
|
||||||
// Recall items are stored as self.channel_patterns[ channel ][ row_number ]
|
// Recall items are stored as self.channel_patterns[ channel ][ row_number ]
|
||||||
let mut all_events: Vec<EchoEvent> = Vec::new();
|
let mut all_events: Vec<EchoEvent> = Vec::new();
|
||||||
let rows_per_pattern: u32 = self.channel_patterns[ 0 ].len() as u32;
|
let total_rows: u32 = self.channel_patterns[ 0 ].len() as u32;
|
||||||
for row_number in 0..rows_per_pattern {
|
for row_number in 0..total_rows {
|
||||||
let events_this_row: Vec<EchoEvent> = get_events_for_row(
|
let events_this_row: Vec<EchoEvent> = get_events_for_row(
|
||||||
&mut channels,
|
&mut channels,
|
||||||
&self.instruments,
|
&self.instruments,
|
||||||
|
@ -334,6 +334,8 @@ impl EchoFormat for DmfModule {
|
||||||
|
|
||||||
// Transfer ESF events to the main stream
|
// Transfer ESF events to the main stream
|
||||||
all_events.extend( events_this_row );
|
all_events.extend( events_this_row );
|
||||||
|
|
||||||
|
// Any jumps?
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compact sequences of delays to save rom space
|
// Compact sequences of delays to save rom space
|
||||||
|
|
|
@ -544,7 +544,7 @@ fn apply_effects_to_channel( channel: &mut Channel, effects: &LinkedHashSet<Effe
|
||||||
Ok( events )
|
Ok( events )
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sequence_to_compacted_delay( current_sequence: &Vec<EchoEvent> ) -> Result<Vec<EchoEvent>, Box<dyn Error>> {
|
fn sequence_to_compacted_delay( current_sequence: &Vec<EchoEvent> ) -> Result<Vec<EchoEvent>, Box<dyn Error>> {
|
||||||
let mut new_events: Vec<EchoEvent> = Vec::new();
|
let mut new_events: Vec<EchoEvent> = Vec::new();
|
||||||
|
|
||||||
let mut cumulative_delay: u16 = 0;
|
let mut cumulative_delay: u16 = 0;
|
||||||
|
@ -605,7 +605,7 @@ pub fn compact_delays( events: Vec<EchoEvent> ) -> Result<Vec<EchoEvent>, Box<dy
|
||||||
* Generate an Echo frequency shift up event for a given channel, updating active_note to be ready
|
* Generate an Echo frequency shift up event for a given channel, updating active_note to be ready
|
||||||
* for the next event.
|
* for the next event.
|
||||||
*/
|
*/
|
||||||
pub fn get_portamento( channel: &mut Channel, portamento_effect: &Effect ) -> Result<EchoEvent, Box<dyn Error>> {
|
fn get_portamento( channel: &mut Channel, portamento_effect: &Effect ) -> Result<EchoEvent, Box<dyn Error>> {
|
||||||
if channel.id != ESF_FM_6_PCM && channel.id != ESF_PSG_4 {
|
if channel.id != ESF_FM_6_PCM && channel.id != ESF_PSG_4 {
|
||||||
// A portamento was called for on this channel, and if none was provided, we need to start with C, octave 0
|
// A portamento was called for on this channel, and if none was provided, we need to start with C, octave 0
|
||||||
// This replicates the behaviour in deflemask
|
// This replicates the behaviour in deflemask
|
||||||
|
@ -696,7 +696,7 @@ pub fn get_portamento( channel: &mut Channel, portamento_effect: &Effect ) -> Re
|
||||||
/**
|
/**
|
||||||
* Generate a note cut effect for this channel and modify channel state to reflect it
|
* Generate a note cut effect for this channel and modify channel state to reflect it
|
||||||
*/
|
*/
|
||||||
pub fn get_note_cut( channel: &mut Channel, note_cut_effect: &Effect, tick: u8 ) -> Result<EchoEvent, Box<dyn Error>> {
|
fn get_note_cut( channel: &mut Channel, note_cut_effect: &Effect, tick: u8 ) -> Result<EchoEvent, Box<dyn Error>> {
|
||||||
let after_ticks = match note_cut_effect {
|
let after_ticks = match note_cut_effect {
|
||||||
Effect::NoteCut { after_ticks } => *after_ticks,
|
Effect::NoteCut { after_ticks } => *after_ticks,
|
||||||
_ => return Err( "internal error: provided effect is not the note cut effect" )?
|
_ => return Err( "internal error: provided effect is not the note cut effect" )?
|
||||||
|
@ -721,7 +721,7 @@ pub fn get_note_cut( channel: &mut Channel, note_cut_effect: &Effect, tick: u8 )
|
||||||
/**
|
/**
|
||||||
* Get effects that require a specific action when computing the event flushes to Echo.
|
* Get effects that require a specific action when computing the event flushes to Echo.
|
||||||
*/
|
*/
|
||||||
pub fn get_actionable_effects( channels: &mut [Channel] ) -> Result<Vec<(usize, Effect)>, Box<dyn Error>> {
|
fn get_actionable_effects( channels: &mut [Channel] ) -> Result<Vec<(usize, Effect)>, Box<dyn Error>> {
|
||||||
// All portamento effects deploy per tick, not per row. So we need to aggregate all portamentos across all
|
// All portamento effects deploy per tick, not per row. So we need to aggregate all portamentos across all
|
||||||
// channels for this row, then flush them once per `ticks_to_wait` for this row.
|
// channels for this row, then flush them once per `ticks_to_wait` for this row.
|
||||||
let mut actionable_effects: Vec<(usize, Effect)> = Vec::new();
|
let mut actionable_effects: Vec<(usize, Effect)> = Vec::new();
|
||||||
|
@ -750,7 +750,7 @@ pub fn get_actionable_effects( channels: &mut [Channel] ) -> Result<Vec<(usize,
|
||||||
* -are- effects generated by this function, you should not apply ticks_to_wait, since this function will spend out
|
* -are- effects generated by this function, you should not apply ticks_to_wait, since this function will spend out
|
||||||
* the tick budget for that row instead.
|
* the tick budget for that row instead.
|
||||||
*/
|
*/
|
||||||
pub fn get_actionable_effect_sequence( channels: &mut [Channel], ticks_to_wait: u8 ) -> Result<Vec<EchoEvent>, Box<dyn Error>> {
|
fn get_actionable_effect_sequence( channels: &mut [Channel], ticks_to_wait: u8 ) -> Result<Vec<EchoEvent>, Box<dyn Error>> {
|
||||||
let mut events: Vec<EchoEvent> = Vec::new();
|
let mut events: Vec<EchoEvent> = Vec::new();
|
||||||
|
|
||||||
let actionable_effects = get_actionable_effects( channels )?;
|
let actionable_effects = get_actionable_effects( channels )?;
|
||||||
|
@ -780,7 +780,7 @@ pub fn get_actionable_effect_sequence( channels: &mut [Channel], ticks_to_wait:
|
||||||
/**
|
/**
|
||||||
* Get the delays due at the end of a row. These delays are what flushes the tick to Echo so that it can play.
|
* Get the delays due at the end of a row. These delays are what flushes the tick to Echo so that it can play.
|
||||||
*/
|
*/
|
||||||
pub fn get_delays( events: Vec<EchoEvent>, channels: &mut [Channel], ticks_to_wait: u8 ) -> Result<Vec<EchoEvent>, Box<dyn Error>> {
|
fn get_delays( events: Vec<EchoEvent>, channels: &mut [Channel], ticks_to_wait: u8 ) -> Result<Vec<EchoEvent>, Box<dyn Error>> {
|
||||||
let mut events: Vec<EchoEvent> = events;
|
let mut events: Vec<EchoEvent> = events;
|
||||||
|
|
||||||
let applied_effects = get_actionable_effect_sequence( channels, ticks_to_wait )?;
|
let applied_effects = get_actionable_effect_sequence( channels, ticks_to_wait )?;
|
||||||
|
|
Loading…
Reference in New Issue