Prohibit trigger of note on instrument-less FM channel
parent
a44a986009
commit
6886040535
|
@ -312,7 +312,18 @@ pub fn get_events_for_channel( channels: &mut [Channel], active_channel: usize,
|
||||||
channels[ active_channel ].note_keyed = false;
|
channels[ active_channel ].note_keyed = false;
|
||||||
events.push( vec![ ESF_NOTE_OFF | channels[ active_channel ].id ] );
|
events.push( vec![ ESF_NOTE_OFF | channels[ active_channel ].id ] );
|
||||||
} else {
|
} else {
|
||||||
channels[ active_channel ].note_keyed = true;
|
// Determine if we can key on. We can't key on if we are in FM1..FM6, and no instrument was ever set
|
||||||
|
// on the channel either here or previously. (We can do that for psg, using the default instrument.)
|
||||||
|
channels[ active_channel ].note_keyed = if ( ESF_FM_1..=ESF_FM_3 ).contains( &channels[ active_channel ].id ) | ( ESF_FM_4..=ESF_FM_6 ).contains( &channels[ active_channel ].id ) {
|
||||||
|
if channels[ active_channel ].active_instrument.is_none() {
|
||||||
|
print_warning( "no instrument set on this fm channel - cannot trigger the note!" );
|
||||||
|
false
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
};
|
||||||
channels[ active_channel ].active_note = Some(
|
channels[ active_channel ].active_note = Some(
|
||||||
OctaveFrequency {
|
OctaveFrequency {
|
||||||
octave: note.get_octave()?,
|
octave: note.get_octave()?,
|
||||||
|
|
Loading…
Reference in New Issue