Fix ORG sampling bug

Also included the full org2 wavetable.
This commit is contained in:
Edward Stuckey 2024-02-26 13:52:00 -05:00 committed by Laura K
parent b275816e76
commit af9947b931
2 changed files with 7 additions and 3 deletions

Binary file not shown.

View File

@ -121,11 +121,15 @@ impl OrgPlaybackEngine {
}
}
// Initialize drums
for (idx, (track, buf)) in song.tracks[8..].iter().zip(self.track_buffers[128..].iter_mut()).enumerate() {
if self.song.version == Version::Extended {
*buf = RenderBuffer::new(samples.samples[track.inst.inst as usize].clone());
if song.version == Version::Extended {
// Check for OOB track count, instruments outside of the sample range will be set to the last valid sample
let index = if track.inst.inst as usize >= samples.samples.len() {samples.samples.len() - 1} else {track.inst.inst as usize} ;
*buf = RenderBuffer::new(samples.samples[index].clone());
} else {
*buf = RenderBuffer::new(samples.samples[idx].clone());
let index = if idx >= samples.samples.len() {samples.samples.len() - 1} else {idx};
*buf = RenderBuffer::new(samples.samples[index].clone());
}
}