I’ve modified the “stream” sample to play a WAVE file with markers in the following way: every time I reach a marker, I skip back to the first marker and continue to play.
The problem is: if I pass more than once over the same marker, the callback function is not called.
Example: a file with four markers (0,1,2,3):
I begin the stream from marker #0.
When I reach marker #1, the callback is executed (where I “rewind” the stream with the FSOUND_Stream_SetTime function to marker #0), and the stream continues from there.
Then, I reach marker #1 again, but the callback is NOT executed, and I don’t understand why!
So the stream goes on, and I reach marker #2, and the callback is executed (“rewinding” to marker #0).
When I reach marker #1 again, the callback is NOT executed, neither when I reach marker #2, but only when I get to marker #3, and so on.
And.. misteriously.. when I skip back this time to marker #0 and reach marker #1, the callback IS executed.
- flipp3r asked 14 years ago
The point is: for each marker, the Callback is called once and then is not called anymore until I reach the end of the file, even if I pass over the same marker more than once. Is this a bug?
For example, try to substitute this function in the “stream” example, and play a file with markers. The stream will play until the first marker, then go back to the beginning of the file and the play until the second marker (not the first!) and so on, until it reaches the end of file.
signed char endcallback(FSOUND_STREAM *stream, void *buff, int len, int param)
[quote="brett":2fln2skf]the sync markers are skipped if they are not saved in the file as 1,2,3,4 ..[/quote:2fln2skf]
I renamed the markers in the wave file (“1”, “2”, “3”) but the result was the same. I downloaded the newest DLL and still nothing changed.
Is there something else I can try?
[quote="brett":czmh5iuq]the ‘name’ has nothing to do with it. It is the order in which the markers are created. [/quote:czmh5iuq]
Do you mean, the order in which they are created in SoundForge? Wave markers also save this information?
[quote="brett":czmh5iuq]The latest dll definately fixes this problem[/quote:czmh5iuq]
Mmh.. strangely I still get it! Maybe I’ll post the code so you can check it.
[quote="brett":czmh5iuq]hopefully you are saving out the right marker types.[/quote:czmh5iuq]
I’m saving “markers” with SoundForge.. I’m not saving regions if you’re thinking about this.
I will try to explain the whole process:
1) Download fmod for Windows in a new directory
2) Browse to fmodapi360win32\samples\stream
3) Copy the file fmod.dll in this directory (any version)
4) Try to run “stream.exe ../../media/jbtennis.wav” (the same as “runme.bat”): it works fine and shows the synchpoints. When the file ends it goes back to the start and it shows them again
5) Now open “stream.dsp” in Visual Studio, and go to “Main.cpp”
6) At line 78, after
printf(“\nSYNCHPOINT : \”%s\”\n”, buff);
add this new line
7) Compile and build the new “stream.exe”
8) Now try to run “stream.exe ../../media/jbtennis.wav” again.
What I get is this screenshot:
Direct Sound Driver list
1 – Primary Sound Driver
2 – SoundMAX Digital Audio
Press a corresponding number or ESC to quit
Press SPACE to pause/unpause
Press ‘f’ to fast forward 2 seconds
Press ESC to quit
Name : ../../media/jbtennis.wav
Frequency : 11025
pos 28672/ 52862 time 00:02/00:04 cpu 0.10%
SYNCHPOINT : “Hello”
pos 36864/ 52862 time 00:02/00:04 cpu 0.23%
SYNCHPOINT : “Hi..”
pos 40960/ 52862 time 00:03/00:04 cpu 0.23%
SYNCHPOINT : “Hi”
pos 45056/ 52862 time 00:03/00:04 cpu 0.23%
SYNCHPOINT : “i have a”
pos 49152/ 52862 time 00:03/00:04 cpu 0.24%
SYNCHPOINT : “little”
pos 386/ 52862 time 00:04/00:04 cpu 0.23%
SYNCHPOINT : “problem”
^Cs 49152/ 52862 time 00:03/00:04 cpu 0.23%
So: the stream goes up to the FIRST synchpoint, then back to the start.
Then it goes up to the SECOND synchpoint (skipping the first one), and back to the start.
Then it goes up to the THIRD synchpoint (skipping the first and the second one).. and so on.
But this is not what I expected.
I was expecting the stream to: go up to the FIRST synchpoint, then back to the start, then go up to the FIRST synchpoint again, then back to the start, then go up to the FIRST.. and so on.
But once it has passed over a synchpoint, it doesn’t “see” it anymore, until it reaches the end of the file. Just then it sees it again.
I’ve tried putting both versions of the DLL in the same dir as the “stream.exe” file.
Thanks for any advice
Please login first to submit.