With our “live streaming” method, we are trying to achieve the following:
The sender captures PCM data coming through microphone
Encode this data to MP3 directly in memory
Send this MP3 data through network
The receiver will get this MP3 data
Decode this data to PCM directly in memory
Output through speaker
As you can see, the encode/decode process must be done in real time without saving the data to file.
It seems that the encode process can be done simply with the function: beEncodeChunk().
However, decoding doesn’t look as simple as the encoding process as it required a FILE* parameter.
If there is an api to achieve such functionality, could you tell us where to find it?
There’s an FMOD plugin examples under examples\plugins called output_mp3.cpp which shows encoding PCM data into mp3. It writes it to file but that’s optional.
on the decode side, it would be possible to have fmod decode the data if you wrote far enough ahead with Sound::lock/Sound::unlock and used FMOD_CREATECOMPRESSEDSAMPLE, or just use FMOD_OPENMEMORY_POINT and FMOD_CREATECOMPRESSEDSAMPLE to play a looping buffer that you write to in front of the play cursor.