Add required offset to pcm instrument note triggers
parent
546376cc02
commit
686d44b137
|
@ -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<Vec<EchoEvent>, Box<dyn Error>> {
|
||||
fn get_events_for_channel( channel: &mut Channel, row: &PatternRow, pcm_offset: u8 ) -> Result<Vec<EchoEvent>, Box<dyn Error>> {
|
||||
let mut events: Vec<EchoEvent> = Vec::new();
|
||||
|
||||
// Adjust volume
|
||||
|
@ -264,7 +264,7 @@ fn get_events_for_channel( channel: &mut Channel, row: &PatternRow ) -> Result<V
|
|||
);
|
||||
|
||||
if channel.id == ESF_FM_6_PCM {
|
||||
events.push( vec![ ESF_NOTE_ON | channel.id, get_pcm_index( note )? ] );
|
||||
events.push( vec![ ESF_NOTE_ON | channel.id, get_pcm_index( note )? + pcm_offset ] );
|
||||
} else {
|
||||
let note = get_note( note, channel.id )?;
|
||||
events.push( vec![ ESF_NOTE_ON | channel.id, note ] );
|
||||
|
@ -473,7 +473,7 @@ fn get_delays( events: Vec<EchoEvent>, 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<Vec<EchoEvent>, Box<dyn Error>> {
|
||||
pub fn get_events_for_row( channels: &mut [Channel], subrows: Vec<&PatternRow>, ticks_to_wait: u8, pcm_offset: u8 ) -> Result<Vec<EchoEvent>, Box<dyn Error>> {
|
||||
let mut events: Vec<EchoEvent> = 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 )? )
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue