From ea9aad22e186b3271e7775db6b32123b762ae771 Mon Sep 17 00:00:00 2001 From: halleyscometsw Date: Tue, 1 Jul 2008 16:27:27 +0000 Subject: [PATCH] properly check aiff playMode before deciding to use it for loop this loop support may never be useful, bah git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@269 51a99a44-fe44-0410-b1ba-c3e57ba2b86b --- src/meta/aifc.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/meta/aifc.c b/src/meta/aifc.c index d86874c5..800cbb9b 100644 --- a/src/meta/aifc.c +++ b/src/meta/aifc.c @@ -230,24 +230,26 @@ VGMSTREAM * init_vgmstream_aifc(STREAMFILE *streamFile) { int start_marker; int end_marker; /* use the sustain loop */ - start_marker = read_16bitBE(InstrumentChunkOffset+18,streamFile); - end_marker = read_16bitBE(InstrumentChunkOffset+20,streamFile); - /* check for sustain markers != 0 (invalid marker no) */ - /* There is a PlayMode flag, but 3DO games don't seem to use it */ - if (start_marker && end_marker) { - /* find start marker */ - loop_start = find_marker(streamFile,MarkerChunkOffset,start_marker); - loop_end = find_marker(streamFile,MarkerChunkOffset,end_marker); + /* if playMode=ForwardLooping */ + if (read_16bitBE(InstrumentChunkOffset+16,streamFile) == 1) { + start_marker = read_16bitBE(InstrumentChunkOffset+18,streamFile); + end_marker = read_16bitBE(InstrumentChunkOffset+20,streamFile); + /* check for sustain markers != 0 (invalid marker no) */ + if (start_marker && end_marker) { + /* find start marker */ + loop_start = find_marker(streamFile,MarkerChunkOffset,start_marker); + loop_end = find_marker(streamFile,MarkerChunkOffset,end_marker); - /* find_marker is type uint32_t as the spec says that's the type - * of the position value, but it returns a -1 on error, and the - * loop_start and loop_end variables are int32_t, so the error - * will become apparent. - * We shouldn't have a loop point that overflows an int32_t - * anyway. */ - printf("%d %d\n",loop_start,loop_end); - if (loop_start >= 0 && loop_end >= 0) loop_flag = 1; - if (loop_start==loop_end) loop_flag = 0; + /* find_marker is type uint32_t as the spec says that's the type + * of the position value, but it returns a -1 on error, and the + * loop_start and loop_end variables are int32_t, so the error + * will become apparent. + * We shouldn't have a loop point that overflows an int32_t + * anyway. */ + printf("%d %d\n",loop_start,loop_end); + if (loop_start >= 0 && loop_end >= 0) loop_flag = 1; + if (loop_start==loop_end) loop_flag = 0; + } } }