CUSTOM SAMPLES AND STREAMS
This answers some of the questions regarding how to create a custom/user stream, and a custom/user sample.
1. Declare and allocate a custom sample...
FSOUND_SAMPLE *mysamp = FSOUND_Sample_Alloc(FSOUND_FREE, length, mode, deffreq, defvol, defpan, defpri);
Remember 'length' is measured in *samples* not bytes, and mode is a bitfield using
FSOUND_MODES (see the help for a description of modes to describe the sample you are allocating)
This will create you an empty sample to upload data into.
2. Upload your data to the sample.
Use FSOUND_Sample_Lock()/FSOUND_Sample_Unlock() or FSOUND_Sample_Upload() to get your data into the sample.
With FSOUND_Sample_Lock()/FSOUND_Sample_Unlock(), the data you copy in MUST be in signed format.
FSOUND_Sample_Upload() is the favoured choice though, as you can describe the format, and it will convert it for you, but you have to pre-read the data into your own buffer first before passing it to FSOUND_Sample_Upload(), which temporarily uses more memory. This converts from all types of sources.. unsigned, delta samples, even IT compressed. more types will come in the future.
3. Play it! :)
See FSOUND_Stream_Create. You can pass a callback function pointer and a length to this function.
When you start the stream with FSOUND_Stream_Play (as you would with any other stream), you start getting callbacks.