If you wish to stream raw data, not PCM data you could achieve this by overriding the FMOD file system. There are two ways to achieve this, the first is by setting the file callbacks in the CreateSoundExInfo structure if this is for one specific file. The second is you can set the file system globally for all FMOD file operations (incase you want to do this with multiple files).
If you wish to stream raw data, not PCM data you could achieve this by overriding the FMOD file system. There are two ways to achieve this, the first is by setting the file callbacks in the CreateSoundExInfo structure if this is for one specific file. The second is you can set the file system globally for all FMOD file operations (incase you want to do this with multiple files).
I will explain the latter, it would be trivial to switch to the former though. Refer to the "filecallbacks" FMOD example for a complete example. Function pointers: private FMOD.
FILE_OPENCALLBACK myopen = new FMOD. FILE_OPENCALLBACK(OPENCALLBACK); private FMOD. FILE_CLOSECALLBACK myclose = new FMOD.
FILE_CLOSECALLBACK(CLOSECALLBACK); private FMOD. FILE_READCALLBACK myread = new FMOD. FILE_READCALLBACK(READCALLBACK); private FMOD.
FILE_SEEKCALLBACK myseek = new FMOD. FILE_SEEKCALLBACK(SEEKCALLBACK); Callbacks: private static FMOD. RESULT OPENCALLBACK(MarshalAs(UnmanagedType.
LPWStr)string name, int unicode, ref uint filesize, ref IntPtr handle, ref IntPtr userdata) { // You can ID the file from the name, then do any loading required here return FMOD.RESULT. OK; } private static FMOD. RESULT CLOSECALLBACK(IntPtr handle, IntPtr userdata) { // Do any closing required here return FMOD.RESULT.
OK; } private static FMOD. RESULT READCALLBACK(IntPtr handle, IntPtr buffer, uint sizebytes, ref uint bytesread, IntPtr userdata) { byte readbuffer = new bytesizebytes; // Populate readbuffer here with raw data Marshal. Copy(readbuffer, 0, buffer, (int)sizebytes); return FMOD.RESULT.
OK; } private static FMOD. RESULT SEEKCALLBACK(IntPtr handle, int pos, IntPtr userdata) { // Seek your stream to desired position return FMOD.RESULT. OK; } Implementation: // Usual init code here... result = system.
SetFileSystem(myopen, myclose, myread, myseek, 2048); ERRCHECK(result); // Usual create sound code here...
I would recommend you check out the "usercreatedsound" example that ships with FMOD, it should do what you require. The basic idea is you define the properties of the sound you wish to play in the CreateSoundExInfo structure and provide it with callbacks which you can use to load / stream data from wherever you like. Function pointer: private FMOD.
SOUND_PCMREADCALLBACK pcmreadcallback = new FMOD. SOUND_PCMREADCALLBACK(PCMREADCALLBACK); Callback used to populate the FMOD sound: private static FMOD. RESULT PCMREADCALLBACK(IntPtr soundraw, IntPtr data, uint datalen) { unsafe { short *stereo16bitbuffer = (short *)data.ToPointer(); // Populate the 'stereo16bitbuffer' with sound data } return FMOD_OK; } Code to create the sound that will use the callback: // ...Usual FMOD initialization code here... FMOD.
CREATESOUNDEXINFO exinfo = new FMOD. CREATESOUNDEXINFO(); // You define your required frequency and channels exinfo. Cbsize = Marshal.
SizeOf(exinfo); exinfo. Length = frequency * channels * 2 * 5; // *2 for sizeof(short) *5 for 5 seconds exinfo. Numchannels = (int)channels; exinfo.
Defaultfrequency = (int)frequency; exinfo. Format = FMOD. SOUND_FORMAT.
PCM16; exinfo. Pcmreadcallback = pcmreadcallback; result = system. CreateStream((string)null, (FMOD.MODE.
DEFAULT | FMOD.MODE. OPENUSER | FMOD.MODE. LOOP_NORMAL), ref exinfo, ref sound); That should be sufficient to get you going, hope this helps.
Beacuse I don't have the raw format of the files... – LnDCobra Aug 9 '10 at 3:11 No this solution is just for PCM, I will provide another answer for the case of compressed data. – Mathew Block Aug 9 '10 at 5:47.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.