mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Fix crash for some files
This commit is contained in:
parent
67de2d5833
commit
4f7fb7125b
|
@ -147,8 +147,10 @@ pub fn parse_module(module: &Module) -> TokenStream {
|
||||||
if let InstrumentType::Default(ref instrument) =
|
if let InstrumentType::Default(ref instrument) =
|
||||||
module.instrument[instrument_index].instr_type
|
module.instrument[instrument_index].instr_type
|
||||||
{
|
{
|
||||||
let sample_slot =
|
let sample_slot = *instrument
|
||||||
instrument.sample_for_note[slot.note as usize - 1] as usize;
|
.sample_for_note
|
||||||
|
.get(slot.note as usize)
|
||||||
|
.unwrap_or(&0) as usize;
|
||||||
instruments_map
|
instruments_map
|
||||||
.get(&(instrument_index, sample_slot))
|
.get(&(instrument_index, sample_slot))
|
||||||
.map(|sample_idx| sample_idx + 1)
|
.map(|sample_idx| sample_idx + 1)
|
||||||
|
@ -163,7 +165,7 @@ pub fn parse_module(module: &Module) -> TokenStream {
|
||||||
let previous_note_and_sample = note_and_sample[channel_number];
|
let previous_note_and_sample = note_and_sample[channel_number];
|
||||||
let maybe_note_and_sample = if matches!(slot.note, Note::KeyOff) {
|
let maybe_note_and_sample = if matches!(slot.note, Note::KeyOff) {
|
||||||
effect1 = PatternEffect::Stop;
|
effect1 = PatternEffect::Stop;
|
||||||
// note_and_sample[channel_number] = None;
|
|
||||||
¬e_and_sample[channel_number]
|
¬e_and_sample[channel_number]
|
||||||
} else if !matches!(slot.note, Note::None) {
|
} else if !matches!(slot.note, Note::None) {
|
||||||
if sample != 0 {
|
if sample != 0 {
|
||||||
|
|
Loading…
Reference in a new issue