Better looping

This commit is contained in:
Gwilym Inzani 2023-11-01 13:29:38 +00:00
parent e103468b86
commit a55b106106

View file

@ -98,7 +98,12 @@ pub fn parse_midi(midi_info: &MidiInfo) -> TokenStream {
for sample in sf2.get_sample_headers() { for sample in sf2.get_sample_headers() {
let sample_start = sample.get_start() as usize; let sample_start = sample.get_start() as usize;
let sample_end = sample.get_end() as usize; let mut sample_end = sample.get_end() as usize;
let sample_loop_end = sample.get_end_loop() as usize;
if sample_loop_end > sample_start && sample_loop_end < sample_end {
sample_end = sample_loop_end;
}
let sample_data = &sf2_data[sample_start..sample_end]; let sample_data = &sf2_data[sample_start..sample_end];