diff --git a/src/reskit/soundtrack/engines/echo.rs b/src/reskit/soundtrack/engines/echo.rs index 673e7d5..613d46f 100644 --- a/src/reskit/soundtrack/engines/echo.rs +++ b/src/reskit/soundtrack/engines/echo.rs @@ -230,7 +230,7 @@ fn get_portamento( channel: &mut Channel, portamento_effect: &Effect ) -> Result * For a specific row and channel, get the events this row and channel contribute to the stream. * While doing so, update the state of the channel for future event generation. */ -fn get_events_for_channel( channel: &mut Channel, row: &PatternRow ) -> Result, Box> { +fn get_events_for_channel( channel: &mut Channel, row: &PatternRow, pcm_offset: u8 ) -> Result, Box> { let mut events: Vec = Vec::new(); // Adjust volume @@ -264,7 +264,7 @@ fn get_events_for_channel( channel: &mut Channel, row: &PatternRow ) -> Result, channels: &mut [Channel], ticks_to_wait: * For an entire row across all channels, generate the events that apply to the row as a whole. This usually means applying * the waits so that the row can be flushed to Echo and played - ESF ticks are until the nearest wait or stop event. */ -pub fn get_events_for_row( channels: &mut [Channel], subrows: Vec<&PatternRow>, ticks_to_wait: u8 ) -> Result, Box> { +pub fn get_events_for_row( channels: &mut [Channel], subrows: Vec<&PatternRow>, ticks_to_wait: u8, pcm_offset: u8 ) -> Result, Box> { let mut events: Vec = Vec::new(); // Get events for each subrow (part of the total row for each channel) @@ -482,7 +482,7 @@ pub fn get_events_for_row( channels: &mut [Channel], subrows: Vec<&PatternRow>, events.extend( apply_effects_to_channel( &mut channels[ i ], &subrows[ i ].effects )? ); // Get the ESF events for this channel's part of the row - events.extend( get_events_for_channel( &mut channels[ i ], subrows[ i ] )? ); + events.extend( get_events_for_channel( &mut channels[ i ], subrows[ i ], pcm_offset )? ); } Ok( get_delays( events, channels, ticks_to_wait )? ) diff --git a/src/reskit/soundtrack/formats/dmf.rs b/src/reskit/soundtrack/formats/dmf.rs index cf5f5ef..b3612c1 100644 --- a/src/reskit/soundtrack/formats/dmf.rs +++ b/src/reskit/soundtrack/formats/dmf.rs @@ -935,7 +935,8 @@ impl EchoFormat for DmfModule { self.speed_a * self.time_base } else { self.speed_b * self.time_base - } + }, + self.instruments.len() as u8 )?; // Transfer ESF events to the main stream