0
0

Hey guys,

i wanna stream Mp3 Files over my Home Network.
The Server is working, but i don´t know how i can play these Bytestream on the Client.
Here is some Code.

Server:
[code:2a7cv651]
FMOD.FILE_READCALLBACK readcallback = new FMOD.FILE_READCALLBACK( streamAudio);
public FMOD.RESULT streamAudio( IntPtr handle, IntPtr buffer, uint sizebytes, ref uint bytesread, IntPtr userdata )
{
byte[] filebuffer = new byte[ (int)sizebytes ];

  Marshal.Copy( buffer, filebuffer, 0, (int)sizebytes );

  // Stream "filebuffer" to Client

}
[/code:2a7cv651]

Client:
[code:2a7cv651]
FMOD.SOUND_PCMSETPOSCALLBACK _pcmsetposcallback = new FMOD.SOUND_PCMSETPOSCALLBACK(pcmSetCallback);
uint channels = 2;
uint frequency = 44100;
CREATESOUNDEXINFO info = new CREATESOUNDEXINFO();
info.cbsize = Marshal.SizeOf(info);
info.fileoffset = 0;
info.length = frequency * channels * 2 * 2;
info.numchannels = (int)channels;
info.defaultfrequency = (int)frequency;
info.format = FMOD.SOUND_FORMAT.PCM16;
info.pcmreadcallback = _pcmreadcallback;
info.pcmsetposcallback = null;
info.dlsname = null;

_system.createSound((string)null, (_mode | FMOD.MODE.CREATESTREAM), ref info, ref _sound);

private FMOD.RESULT pcmReadCallback(IntPtr soundraw, IntPtr data, uint datalen)
{
// play the "filebuffer" from the Server
Marshal.Copy( filebuffer, 0, data, (int)filebuffer.Length ); // don´t working..
}
[/code:2a7cv651]

I don´t know how i can get these filebuffer into these Callback.

What im doing wrong?

Thanks for your effort

Cupras

  • You must to post comments
0
0

Can nobody help me? 😥

  • You must to post comments
0
0

did you OR’ed FMOD_OPENUSR with _mode?

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.