0
0

i’m under C#.net

i use
system.createStream(curraudio, FMOD.MODE.HARDWARE & FMOD.MODE.ACCURATETIME, ref sound);
to create the stream, and then use
system.playSound(FMOD.CHANNELINDEX.FREE, sound, true, ref channel);
to play the sound paused for further use.

i use setPaused() to play/pause the sound and have a timer to track the position by channel.getPosition().

when the sound played till the end, get paused, and setPosition to the position before, and unpaused it, the sound played abnormal. it only plays for a short time repeatly (say from 1:20.0 to 1:20.8 repeatly).

what should i do to prevent such problem? or is it a bug?

regards,
MeteorRain

  • You must to post comments
0
0

you have to give more concrete steps to reproduce what you’re talking about, I can’t really work out what you mean with the description you provided.

Note it looks like you are using & when you should be using | ?

  • You must to post comments
0
0

well, thanks for pointing out the problem of ‘&’.

let’s reproduce the problem:
[code:1aru0m8g] /// initialize part:
system.createStream(curraudio, FMOD.MODE.HARDWARE | FMOD.MODE.ACCURATETIME, ref sound);
......
system.playSound(FMOD.CHANNELINDEX.FREE, sound, true, ref channel);
sound.seekData(0);
......

/// play&pause part
if(timer.Enabled)
{
channel.setPaused(true);
timer.Stop();
}
else
{
playpos = currpos;
channel.setPosition(playpos * 1000 / wscale, FMOD.TIMEUNIT.MS);
channel.setPaused(false);
timer.Start();
}

/// timer_tick
channel.getPosition(ref i, FMOD.TIMEUNIT.MS);
....
if(i >= audiolength – 10)
{
channel.setPaused(true);
timer.Stop();
}

[/code:1aru0m8g]

then play the sound, until reach the end of the audio (of cuz it will stop before the end, but there’s no difference if we play it to the end)
then let’s set the playpos to before the end (say the middle of the audio, say 10:00.00), then play it. it will repeatly play from 10:00.00 to 10:0x.xx. and you will see the variable i in timer_tick repeatly, too.

  • You must to post comments
0
0

why do you have a seekData there? I think what that does is throws off the timing, the channel and sound would now be out of sync with each other. seekdata/readdata are supposed to be used together to read data offline.

  • You must to post comments
0
0

i use readdata/seekdata for waveform creation. and want to reuse the resource.

well, i just rewrite that part of code to:

system.createStream(curraudio, FMOD.MODE.HARDWARE | FMOD.MODE.ACCURATETIME, ref sound);
……(create wave form)
sound.release();

system.createStream(curraudio, FMOD.MODE.HARDWARE | FMOD.MODE.ACCURATETIME, ref sound);
system.playSound(FMOD.CHANNELINDEX.FREE, sound, true, ref channel);
}

and the problem is still there.

regards,
MR

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.