This section describes all functions available for MIDAS sample playback.
MIDASsample MIDASloadRawSample(char *filename, int sampleType, int loopSample)
Loads a raw sound effect sample.
This function loads a sound effect sample into memory and adds it to the Sound Device. The sample file must contain just the raw sample data, and all of it will be loaded into memory. If loopSample is MIDAS_LOOP_YES, the whole sample will be looped. After the sample has been loaded, it can be played using MIDASplaySample, and it should be deallocated with MIDASfreeSample after it is no longer used.
Sample handle if successful, NULL if failed.
All
MIDASplaySample, MIDASfreeSample
BOOL MIDASfreeSample(MIDASsample sample)
Deallocates a sound effect sample.
This function deallocates a sound effect sample that has been previously loaded with MIDASloadRawSample. It removes the sample from the Sound Device and deallocates the memory used. This function may not be called if the sample is still being played.
TRUE if successful, FALSE if not.
All
BOOL MIDASsetAutoEffectChannels(unsigned firstChannel, unsigned numChannels)
Sets the range of channels that can be used as automatic effect channels.
This function is used to set the range of channels that can be used as automatic effect channels by MIDASplaySample. When MIDASplaySample is passed MIDAS_CHANNEL_AUTO as the channel number, it will use one of these automatic channels to play the sound.
TRUE if successful, FALSE if not.
All
MIDASsamplePlayHandle MIDASplaySample(MIDASsample sample, unsigned channel, int priority, unsigned rate, unsigned volume, int panning)
Plays a sound effect sample.
This function is used to play a sound effect sample on a given channel. The sample will receive as initial parameters the values passed as arguments, and playing the sample will be started. If channel is MIDAS_CHANNEL_AUTO, the channel will be selected automatically. The sample playing priority is used to choose the channel the sample will be played on in this case.
This function returns a sample playing handle, that can later be used to stop the sample or change its parameters. This makes it possible to refer to samples without knowing the exact channel they are played on.
Sample playing handle if successful, NULL if failed.
All
MIDASstopSample, MIDASsetAutoEffectChannels
BOOL MIDASstopSample(MIDASsamplePlayHandle sample)
Stops playing a sample.
This function stops playing a sound effect sample started with MIDASplaySample. Playing the sound will stop, and the channel is freed for other samples to use. Note that sample is the sample playing handle returned by MIDASplaySample.
TRUE if successful, FALSE if not.
All
BOOL MIDASsetSampleRate(MIDASsamplePlayHandle sample, unsigned rate)
Changes the sample rate for a sound effect sample.
This function changes the sample rate for a sound effect sample that is being played.
TRUE if successful, FALSE if not.
All
BOOL MIDASsetSampleVolume(MIDASsamplePlayHandle sample, unsigned volume)
Changes the volume for a sound effect sample.
This function changes the volume for a sound effect sample that is being played.
TRUE if successful, FALSE if not.
All
BOOL MIDASsetSamplePanning(MIDASsamplePlayHandle sample, int panning)
Changes the panning position of a sound effect sample.
This function changes the panning position of a sound effect sample that is being played. See description of enum MIDASpanning for information about the panning position values.
TRUE if successful, FALSE if not.
All
BOOL MIDASsetSamplePriority(MIDASsamplePlayHandle sample, int priority)
Changes the playing priority of a sound effect sample.
This function changes the playing priority a sound effect sample that is being played.
TRUE if successful, FALSE if not.
All