Skip to content

Commit 52cd264

Browse files
committed
bfsoundlib: Allocate extra buffer only if XMI has more songs
Extra buffer is required to separate one song from XMI file. If the file has just one song, it is not required.
1 parent 24429ee commit 52cd264

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

bfsoundlib/src/mssxmidi.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,9 +1667,10 @@ int32_t AIL2OAL_API_init_sequence(SNDSEQUENCE *seq, const void *start, int32_t
16671667
return 0;
16681668
}
16691669

1670-
// Current XMIDI playback libraries have no ability to separate sequences
1671-
// Prepare a new image start, which contains only one sequence
1670+
if ((sequence_num > 0) || XMI_find_sequence(start, 1) != NULL)
16721671
{
1672+
// Current XMIDI playback libraries have no ability to separate sequences
1673+
// Prepare a new image start, which contains only one sequence
16731674
uint32_t bebytes;
16741675

16751676
len = 8 + XMI_swap32(*(uint32_t*)(image + 4));
@@ -1694,6 +1695,11 @@ int32_t AIL2OAL_API_init_sequence(SNDSEQUENCE *seq, const void *start, int32_t
16941695
image_start = simg;
16951696
image = simg + 34;
16961697
}
1698+
else
1699+
{
1700+
simg = NULL;
1701+
image_start = start;
1702+
}
16971703

16981704
// Locate IFF chunks within FORM XMID:
16991705
//

0 commit comments

Comments
 (0)