How to Use the Sound Spooler


In order to use the sound spooler, your application must do the following:

  1. Load a sample player instrument and connect it to a mixer or directout.dsp.

    See Preparing Instruments, Playing Instruments, and Playing Sound Files, for information on loading a player and instrument. Do not forget to start other instruments. You do not need to start sampler instruments as ssplStartSpooler() starts this instrument.

    SoundSpooler *ssplCreateSoundSpooler(int32 NumBuffers, Item SamplerIns)
    int32 ssplSpoolData(SoundSpooler *sspl, char *Data, int32 NumBytes, void *UserData)
    Err ssplStartSpooler(SoundSpooler *sspl, int32 Amplitude)

    If you are using the sound spooler in a loop, you must monitor the signals returned by ssplSpoolData(), and inform the spooler that the buffers are complete by calling ssplProcessSignals():

    int32 ssplProcessSignals(SoundSpooler *sspl, int32 SignalMask, void (*UserBufferProcessor)(SoundSpooler *sspl, SoundBufferNode *sbn))

    You must also read more sound data and keep calling ssplSpoolData() until you run out of data.

  2. Stop the sound spooler by calling ssplStopSpooler():

    Err ssplStopSpooler(SoundSpooler *sspl)

  3. Clean up by the spooling process by calling ssplDeleteSoundSpooler():

    Err ssplDeleteSoundSpooler(SoundSpooler *sspl)