This is my first time here so hello everybody
I have one simple (i hope) question.. I am trying to create an app (C#) which will play selected part of wav file for me. The thing is I can make this using own Timers etc. etc. etc., but I am wondering – maybe there is such functionality built in FMOD? Or maybe there is some nice piece of advise somebody have for me how to achieve this?
Thanks in advance for any help, and best regards!
- doonay21 asked 7 years ago
Thanks for your answer!
So.. Yes I do know exactly what time I want to start and stop playing my sound file. I tried to set these properties you told me, but nothing happens, well.. lets say nothing what i expect to happen.
Let me provide you peaces of my C# code I use to achieve this:
[code:174mowcg]FMOD.System system = null;
FMOD.Channel channel1= null;
FMOD.Sound sound1= null;
system.init(1, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
system.createStream("test.wav", FMOD.MODE.SOFTWARE, ref sound1);
system.playSound(FMOD.CHANNELINDEX.FREE, sound1, true, ref channel1);
channel1.setDelay(DELAYTYPE.DSPCLOCK_END, 1000, 0);
Could you tell me what am I doing wrong?
- doonay21 answered 7 years ago
The problem is the parameters to your setDelay call. Take a look at the documentation for FMOD_DELAYTYPE. FMOD_DELAYTYPE_DSPCLOCK_END actually uses the DSP clock, which is updated at the system output frequency every second. You need to use Channel::getDelay() to find out what time the sound was played, convert your desired play time into DSP clocks, add that to the initial start time, and then pass the result into Channel::setDelay().
Please login first to submit.