Hi guys, long time since I posted here
I am using steam to get the voice data from the microphone, and to send it to my players. Then I use steam to uncompressed it on the other side, and I end up with a buffer 16 bits, 11025 sample rate.
Now, I was wondering how I can feed this data to fmod. I can expect to receive more voice data, even if the first one is not done playing, and concatenate it at the end of the currently playing buffer.
So here are my thoughts so far:
use System::createStream with a fixed length pre-allocated buffer. And set the end point to the beginning. When I receive voice, fill the buffer, move the end point to the end of that voice packet, and call play on the stream. Etc. until the end of buffer, where I am not sure how I can make fmod to loop the buffer (With a normal loop I presume) but to make him stop at the end of the sound that is now at the beginning of the buffer. Phew!
PS: I have no working code so far, we are still trying to figure out if fmod will be able to do it…
If you have previously done this, help will be greatly appreciated.
Thanks a lot
- Daivuk asked 8 years ago
Ok, it seams to be working fine now
Thanks to point me out to this example, this is exactly what I needed. I just have to buffer a little before starting to play the voice. Because the packets are not sent equally. So voice got choped often. Now it seems fine.
There is a UserCreatedSound example that ships with FMOD, I think this would be the easiest method. All you have to do is specify a PCM read callback and use that to fill the buffer FMOD passes in. You will have to manage the decompression and buffering of the incoming data yourself.
Ok hum, I have difficulties to make that work. Read callback request a size also. Me, I never know the size I will have to buffer him. And I want it to pause when I don’t have anything to feed him. It comes from a voice input. And the guy can talk for a minute, it has to play non-stop. It is not something I play once.
So I am not sure if it’s doable in fmod at all?
What I want is to feed a cyclic buffer basically. Never ending stream.
Hum, wait. It does always call read callback when looping is set. So what I am going to do is. If there is buffer to feed, I will feed it. Otherwise, I will put 0 to all bit and the sound will always keep playing.
Is it bad to do that? I might have 15 streams like that running in the same time if there are 16 players in the game. Do 15 streams running like that in the same time can cause big lags or anything?
Please login first to submit.