Sound and Music

Function CreateSound(byref buffer, buffer_size, vol)

Returns a new sound from a buffer of raw audio data.


Function LoadSound(snd_file$)

Returns an id for a loaded audio track.


Sub LoadMusic(music_file$)

Loads a music track.


Sub PlaySound(slot, channel, loops)

Plays a sound on the given channel for the given number of loops.


Sub PlaySoundTimed(slot, channel, loops, ms)

Plays sound for a given number of loops until the given number of milliseconds is reached.


Sub PlayMusic(mLoops)

Plays music for set number of loops.

Note: If you only want to play the music once, set this to 0.

Note: Set this to -1 to play infinitely.

See also

StopMusic()


Sub PauseSound(channel)

Pauses a sound at its current position.


Sub ResumeSound(channel)

Resumes playing sound on the given channel.

See also

PauseSound()


Sub PauseMusic() Pauses the currently loaded music track. Unlike StopMusic()

, paused music can be resumed from its current position.


Sub ResumeMusic()

Resumes playing music.


Sub DeleteSound(snd)

Removes a sound from memory.


Sub DeleteMusic()

Removes the current music track from memory.


Sub FadeMusicIn(fade_time, loops)

Fades music in.


Sub FadeMusicOut(fade_time)

Fades music out.


Function MusicExists()

Returns true if there is a music track loaded.


Sub SetMusicVolume(vol)

Sets the volume of the loaded music track.


Function GetMusicVolume()

Returns the music track’s volume.


Sub SetMusicPosition(pos)

Sets the position of the loaded music track.


Function GetMusicPosition()

Returns the position of the music track.


Sub RewindMusic()

Rewinds the music track.


Sub SetSoundChannels(max_channels)

Sets the maximum number of sound channels.


Function NumSoundChannels()

Returns the number of sound channels available.


Function SoundIsEnabled()

Returns true if the audio subsystem has been initialized.


Function SoundExists(snd)

Returns true if the snd id given is associated with an allocated audio track in memory.


Sub SetChannelVolume(channel, vol)

Sets the volume of the audio on a channel.


Function GetChannelVolume(channel)

Returns the volume of the audio on a channel.


Sub SetSoundVolume(snd, vol)

Sets the volume of a sound.


Function GetSoundVolume(slot)

Returns the given sounds volume.


Sub StopMusic()

Stops playing the loaded music track and resets the music position to 0.


Sub StopSound(channel)

Stops playing sound on the specified channel.


Function SetChannelPanning(channel, left_value, right_value)

Set Panning effect for channel. left_value and right_value must be a value between 0 and 255. Returns 0 on error.

NOTE: Setting both left and right to 255 will cancel the pan effect.


Function SetChannelDistance(channel, dist_value)

Set a volume adjustment effect due to distance. distance must be a value between 0 and 255. Returns 0 on error.

NOTE: Setting distance to 0 will cancel the effect.


Function ChannelIsPlaying(channel)

Returns true if an audio channel is playing.


Function ChannelIsPaused(channel)

Returns true if an audio channel is currently paused.

See also

PauseSound()


Function QueryAudioSpec(ByRef freq, ByRef format, ByRef channels)

Gets the frequency, output format, and number of channels for the audio device being used.


Function MusicIsPlaying()

Returns true if the music track is currently playing.


Function SetChannelSpacePosition(channel, angle, distance)

Simulates audio in 3D space.

Angle 0 is in front of the listener and increases clockwise.