When I play a commpresed song from memory, the song loops even when it hasn’t finished. I don’t have this problem when I play a regular sound from memory or when the compressed sound wasn’t created from memory. Right now, the songs are looping at about 1/3 of the length. If I change the size when creating the sound by half, it does seem to play half of what it was playing but if I double it I have problems. The code looks something like this:
[code:9dnl4p7z]iResult = FMOD_System_CreateSound(ptFSystem, pszPosition, FMOD_SOFTWARE |FMOD_2D | FMOD_CREATECOMPRESSEDSAMPLE | FMOD_OPENMEMORY, ptInfo, psndSound);
I’m using FMOD 4.04 in Suse 10.1 and gcc version 4.1.0, but I’ve also tested this (and had the same problems) in Windows 2000 and XP using Dev-C++.
Thanks for your help![/code]
- pier_guillen asked 12 years ago
or when the compressed sound wasn’t created from memory.[/quote:3kpkvb8o]
This means you have done something like truncate the length incorrectly so fmod thinks the sound is shorter than it is . Just doublecheck your info especially your values passed to FMOD_CREATESOUNDEXINFO.
[quote:3olidbql]Just doublecheck your info especially your values passed to FMOD_CREATESOUNDEXINFO.[/quote:3olidbql]It seems that they’re correct. I’m basically doing the same that when creating a normal sample, just changing it to compressed. What I’m currently doing is something like this:
[code:3olidbql] FMOD_CREATESOUNDEXINFO tInfo;
memset(&tInfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
tInfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
tInfo.length = datTemp->size;
Checking the size of the song (with FMOD_TIMEUNIT_RAWBYTES) and the one in datTemp->size, there seems to be only a 0.5K to 2K difference, depending on the file (which, I guess, might be normal). There’s no difference between datTemp->size and the original size of the file.
After some testing, I found that it doesn’t loop early with all songs. I haven’t been able to see a pattern to when it does. Yet, each song has a point where it always loops. I tested printing the length of the song, the current position and the loop points (all this in ms). The length of the songs seems to be correct, while the some end loop points were set to a different position rather the end of the song. I tried changing the loop end to the end of the song, and while getLoopPoints now tells me it’s set correctly, it still loops early.
- pier_guillen answered 12 years ago
Please login first to submit.