0
0

Hey guys,

I’ve recently upgraded from version 4.8.9 to 4.18.8, and now I get the following problem:

I use FMOD for organizing sound samples in time. Each sample has a start and an end time. Using sync points and callback, i sequence the samples in time. If a sound sample’s length is longer than the actual sample playtime, i set a sync point in the sound sample at the position where i want the sample to stop playing. Since i can’t call channel->stop(), i use channel->setPosition(length-1, FMOD_TIMEUNIT_MS) (where length is the length of sounds sample, NOT the actual play time). Thus, on the next system->update(), i get a FMOD_CHANNEL_CALLBACKTYPE_END, release the sound and continue with my life.

On 4.8.9 it used to work perfectly. On 4.18.8 I get a weird behavior – the sample isn’t played at all. Including the part of the sample that precedes the sync point where i call setPosition().

[code:1uf8r4x7]channel->setPaused(true);
FMOD::Sound *sound;
channel->getCurrentSound(&sound);
unsigned int length;
sound->getLength(&length, FMOD_TIMEUNIT_MS);
channel->setPosition(length-1, FMOD_TIMEUNIT_MS);
channel->setPaused(false);
[/code:1uf8r4x7]

I am not sure whether this is a bug at all. I know that this setPosition() is a bit of a crooked solution. Any advice on whether this is a bug or poor programming on my side?

Thanks,
K

  • You must to post comments
0
0

I’ve done some more debugging and i came up with something interesting.

I add the sync point in the following way:

[code:3r4ndgov]sound->addSyncPoint((int)durationOffset, FMOD_TIMEUNIT_MS, key.c_str(), &syncPoint);[/code:3r4ndgov]

where durationOffset is the time value where i want to stop the playing of the sample.

When I catch the sync point event i check for the sync point offset and channel position

[code:3r4ndgov]
cppchannel->getCurrentSound(&sound);
unsigned int length;
cppchannel->getPosition(&length, FMOD_TIMEUNIT_MS);
FMOD_SYNCPOINT *sync;
sound->getSyncPoint(commanddata1, &sync);
unsigned int offset;
char syncPointName[MAX_LEN];
sound->getSyncPointInfo(sync, syncPointName, MAX_LEN, &offset, FMOD_TIMEUNIT_MS);
[/code:3r4ndgov]

And what i get is that the sync point offset is as expected but the channel position is 0 (zero). Meaning it does go through the sound sample, but doesn’t play the channel.

Any idea?

  • You must to post comments
0
0

just to be sure have you checked any return values to see if any errors are being returned?

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.