Simple Sound for Small Devices
libsssd
last updated: 14 JUN 2003 (v0.6)

Function Name: sssd_copySample...
 
sssd_copySample
sssd_copySampleLeft
sssd_copySampleRight
sssd_copySampleStereo

   Copy a pre-loaded sample to sssd's sample memory.  If the sample is in a differnt format than the currently running sssd player thread, the sample will be converted.   Once a sample is registered with a copySample function, the memory holding the original source sample data can be freed.


C Prototype:

int sssd_copySampleStereo( struct sssdaudio* ga, void* data, int channels, int freq, int bits, int samples, int flags )

  Macros:

#define sssd_copySample(a,b,c,d,e,f,g) sssd_copySampleStereo(a,b,c,d,e,f,LOAD_STEREO|g)
#define sssd_copySampleLeft(a,b,c,d,e,f,g) sssd_copySampleStereo(a,b,c,d,e,f,LOAD_LEFT|g)
#define sssd_copySampleRight(a,b,c,d,e,f,g) sssd_copySampleStereo(a,b,c,d,e,f,LOAD_RIGHT|g)

  Other Prototypes:


Arguments:


struct gameaudio *ga

    Pointer to an initialized sssdaudio structure (returned by sssd_initAudio)

void *data

    Pointer to the digital audio sample data.  (Must be unsigned 8-bit or signed 16-bit.)

int channels

    Number of channels present in the sample data (currently only 1 or 2 for mono or stereo are supported)

int frequency

    Sample frequency of the sound data. (See also frequency hints)

int bits

    Number of bits per sample value (currently only 8 and 16 are supported)

int samples

    Number of samples in the sample data.  (sometimes called 'frames')

int flags

    A series of or'ed {|} flags

    Override sample parameters: one of LOAD_STEREO, LOAD_RIGHT, LOAD_LEFT will force the sample to load as stereo, load only the right channel (left channel will be blank), or load only the left channel (right channel will be blank).   These should be used when you want a sample to pan.

   LOAD_DONT_RESAMPLE will prevent sssd from resampling the loaded sample if the sample frequency differs from the sssd subsystem frequency.


Returns:

>0
    Successful copy returns the sample_id of the sample.  This ID number is used to control and play the sample.

ERR_NOT_INITIALIZED
    SSSD system has not been initialized.

ERR_SAMPLES_FULL
    No open sample slots are available to create a new SSSD sample.

ERR_SAMPLES_ALLOC
    Could not allocate memory for sample.





libsssd (c)2003 Patrick Roberts created from libgaudio (c) 1999-2000 A. Schiffler.  Release as open source under MPL 1.1.  Documentation (c)2003 Patrick Roberts.