Hi! I have trouble with getting a soundtrack paused/resumed when clicking on a button. Here is the (oversimplified) code:
My question: Is this the way soundPause/soundResume actually works? If so, how can I effectively resume the song from the same position it paused?
I would appreciate any clues and recommendations.
UPDATE:
After a long brainstorm I think I actually found some way to "pause" the song. The idea is to set the frequency to 0.
This seems to do exactly what I was looking for.
UPDATE 2:
Well this partially does the job. Letting the sound "paused" for a long time results in losing its sync. So the issue is still open.
Code:
int sound = soundPlaySample(soundData, SoundFormat_ADPCM, dataSize, freq, 100, 64, false, 0);
soundPause(sound); // <-- it pauses after (let's say) 3 seconds
soundResume(sound); // <-- replays from the beginning intead of resuming from the position it paused
My question: Is this the way soundPause/soundResume actually works? If so, how can I effectively resume the song from the same position it paused?
I would appreciate any clues and recommendations.
UPDATE:
After a long brainstorm I think I actually found some way to "pause" the song. The idea is to set the frequency to 0.
Code:
int sound = soundPlaySample(soundData, SoundFormat_ADPCM, dataSize, freq, 100, 64, false, 0);
soundSetFreq(sound, 0); // <-- this pauses
soundSetFreq(sound, freq); // <-- this resumes
This seems to do exactly what I was looking for.
UPDATE 2:
Well this partially does the job. Letting the sound "paused" for a long time results in losing its sync. So the issue is still open.
Last edited by NotImpLife,