SoundProp
NAME
Snack_GetSampleRate, Snack_SetSampleRate, Snack_GetSampleEncoding,
Snack_SetSampleEncoding, Snack_GetNumChannels,
Snack_SetNumChannels, Snack_GetBytesPerSample,
Snack_SetBytesPerSample, Snack_GetSoundFilename,
Snack_SetHeaderSize - macros to set/get properties of Snack sound
objects
SYNOPSIS
#include <snack.h>
Snack_GetSampleRate(sound)
Snack_SetSampleRate(sound, frequency)
Snack_GetSampleEncoding(sound)
Snack_SetSampleEncoding(sound, format)
Snack_GetNumChannels(sound)
Snack_SetNumChannels(sound, numChannels)
Snack_GetBytesPerSample(sound)
Snack_SetBytesPerSample(sound, size)
Snack_SetHeaderSize(sound, size)
Snack_GetSoundFilename(sound)
ARGUMENTS
Sound *sound (in)
A pointer to a sound object to query or modify
int frequency (in)
A positive integer specifying the sample rate of
the sound.
int format (in)
An integer used to specify sample encoding
format. Use one of these definitions LIN16, MULAW, ALAW,
LIN8OFFSET, LIN8, LIN24, LIN32, SNACK_FLOAT, or SNACK_DOUBLE
int numChannels (in)
A positive integer specifying the number of
separate channels of a sound
int size (in)
A size specification measured in bytes
DESCRIPTION
The following functions are implemented as macros.
Snack_GetLength returns the length of a sound in number of
frames, for mono sounds this is equal to the number of samples.
Snack_SetLength is used to specify the length of the sound.
No storage is allocated/freed as a result of this, the function
Snack_ResizeSoundStorage must be used to the perform actual
storage management.
Snack_GetFrequency and
Snack_SetFrequency control the sampling frequency of a Snack
sound object. Most audio devices only allow certain specific values
for playback and recording. Common values are 8000, 11025, 16000,
22050, 32000, 44100, and 48000.
Snack_GetNumChannels and
Snack_SetNumChannels handle the number of channels of the
sound, either a positive integer or MONO/STEREO/QUAD.
Snack_GetSampleFormat and
Snack_SetSampleFormat
control the sample encoding format. Use the constants LIN16, MULAW,
ALAW, LIN8OFFSET, LIN8, LIN24, LIN32, SNACK_FLOAT, or SNACK_DOUBLE.
Snack_GetBytesPerSample and
Snack_SetBytesPerSample
should be used in conjunction with the previous pair. For LIN16 the
number of bytes per sample is 2. No checks are performed for any
arguments to these functions.
Snack_GetSoundFilename is used
to retrieve a pointer to the filename string which is or last was
associated with the sound object.
Snack_SetHeaderSize is
used, in code that defines new sound file formats, to specify how
large (in bytes) the header of the sound file is.