Hi, I have some confusion over the FSOUND_GetCurrentPosition function. My computer setup uses windows xp and fmod 3.73.

I have pasted code that uses fmod to continuously poll the position of the playcursor until the song stops.


include <iostream>

include <fstream>

include "fmod.h"

using namespace std;

void main()
// initialize sound
if(FSOUND_Init(44100, 32, 0))
FSOUND_SetVolume(FSOUND_ALL, 255);
FSOUND_STREAM* fs = FSOUND_Stream_Open("girl.wav", FSOUND_2D, NULL, NULL);
FSOUND_Stream_Play(0, fs);

  // begin polling
     unsigned int current = FSOUND_GetCurrentPosition(0);
     cout &lt;&lt; current &lt;&lt; &quot; &quot;;

cout << "Sound Init Failed!" << endl;
cout << "Song Done" << endl;

The program compiles/runs, but the output is questionable:

Note that the playcursor position outputted to the screen increments by 1024 samples. This suggests that using the code above, the true playcursor position is not reported correctly. With directsound, there is no problem.

Could anyone tell me what I am doing wrong, why fmod behaves this way, and some possible fixes… my application heavily depends on the EXACT location of the playcursor via pollng to function normally, and I want to use fmod because of its many capabilities. Thanks!

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.