I tried to use it but there seems to be a problem with making it work. The stream is not played from the loop points passed to it. Here’s the code snippet(the times passed are in ms):
void FMODSound::SetLoopPoints(FSOUND_STREAM *pStream, Time tLoopStart, Time tLoopEnd)
Time tLen = FSOUND_Stream_GetLengthMs(pStream) – 1;
if(tLoopStart < 0 || tLoopStart > tLen)
tLoopStart = 0;
if(tLoopEnd < 0 || tLoopEnd > tLen)
tLoopEnd = tLen;
FSOUND_SAMPLE *pSample = FSOUND_Stream_GetSample(pStream); ASSERT(pSample); int iSampleRate; signed char res = FSOUND_Sample_GetDefaults(pSample, &iSampleRate, 0, 0, 0); ASSERT(res == TRUE); unsigned int uiStartPCM = tLoopStart * iSampleRate / 1000; unsigned int uiEndPCM = tLoopEnd * iSampleRate / 1000; res = FSOUND_Stream_SetLoopPoints(pStream, uiStartPCM, uiEndPCM); ASSERT(res == TRUE);
void FMODSound::SetLoopPoints(int channel, Time tLoopStart, Time tLoopEnd)
FSOUND_STREAM *pStream = m_pChannels[channel];
signed char res = FSOUND_Stream_Stop(pStream);
ASSERT(res == TRUE);
SetLoopPoints(pStream, tLoopStart, tLoopEnd);
int ret_play = FSOUND_Stream_PlayEx(channel, pStream, 0, true);
if(ret_play == -1)
here the vector m_pToUnpause hold the channels which will be unpaused on the next update().
when called SetLoopPoints(channel,21500,23000) the stream is restarted at the starting point due to __SetTime but it is played to the end instead of just 1.5s sample to loop.
The other thing is that the __SetLoopPoints asserts with invalid parameters even if the are correct(<7000, 90000> with stream length in ms > 213000).
Are there some special flags for creation of the stream? There is nothing mentioned in the documentation for FSOUND_Stream_SetLoopPoints but it is said something about "FSOUND_HW3D and FSOUND_HW2D under the FSOUND_OUTPUT_DSOUND" about FSOUND_Sample_SetLoopPoints?
- xenomeno asked 11 years ago
- You must login to post comments