A sound file can be played in BlitzMax with a combination of LoadSound that loads a sound file and PlaySound which plays the sound through the systems audio system if available.
BlitzMax contains native support for sound files in both .wav (uncompressed) and .ogg (compressed) file formats.
Playback of sounds can be controlled with various audio channel
operators including
SetChannelVolume,
SetChannelPan,
SetChannelDepth
and
SetChannelRate.
A channel handle is obtained from either the return value of
PlaySound and
CueSound or from
reserving a channel with the
AllocChannel command.
Returns: An audio channel object
PlaySound starts a sound playing through an audio channel.
If no channel is specified, PlaySound creates a channel for you.
Returns: An audio channel object
CueSound prepares an audio channel for playback of a sound. To actually start the sound, you must use ResumeChannel.
This allows you to setup various states such as volume or pan before a channel starts playing.
Returns: An audio channel object
Allocates an audio channel for use with PlaySound and CueSound. Any sound playing on a channel when it is reused will stop playing.
Use StopChannel to release the channel.
Shuts down an audio channel. Further commands on this channel will have no effect.
volume should be in the range 0 (silent) to 1 (full volume)
pan should be in the range -1 (left) to 1 (right)
depth should be in the range -1 (back) to 1 (front)
rate is a multiplier used to calculate the frequency
sounds are played back on the channel. Use 0.5 to play a sound
at half it's recorded frequency and 2.0 to replay at twice the
frequency.
Module | brl.audio |
Version | 1.00 |
Author | Mark Sibly |
License | Blitz Shared Source Code |
Copyright | Blitz Research Ltd |
Modserver | BRL |