Blitz3D+ Command Reference

AudioReverb ( preset$[,transitionMs] )

Parameters

preset$ - case-insensitive environment name: off, generic, room, bathroom, livingroom, stoneroom, auditorium, concerthall, cave, arena, hangar, hallway, stonecorridor, alley, forest, city, mountains, quarry, plain, parkinglot, sewerpipe, underwater

transitionMs (optional) - crossfade time from 0 to 5000 ms; 250 (default)

Description

Selects the listener reverb environment for all groups.

Zero transition switches immediately and may truncate the old tail. Two banks per group crossfade new inputs while the old room drains. Rapid requests retain only the latest pending preset; reusing a draining bank can fade its oldest tail within 50 ms. Off cancels pending requests, stops new input, fades returns and clears their state. Draining banks retire after 250 ms below -80 dBFS, or at 30 seconds with a short fade.

Selecting a preset alone does not add reverb: set a sound/channel send with SoundReverb or ChannelReverb as well.

Call InitAudioEffects before the first WAV/Ogg playback. Configuration commands return 1 on success or 0 on failure; use AudioLastError for the reason. Finite numeric values and valid handles are required in Debug and Release. Queries preserve errors unless the query itself fails.

Audio effects process decoded WAV and mono/stereo Ogg at an internal 48 kHz. MIDI uses a separate backend. Sound defaults are copied to independent playing channels. Runtime pause freezes sources, tails and transition time; pausing one channel leaves shared tails running. Event waits service transitions and release completed source resources without ChannelPlaying polling. Lightweight completed handles are retained until program shutdown.

The interactive Audio Playground sample demonstrates the whole effects family together.

Requires Extended mode.

See also: AudioReverbVolume, SoundReverb, ChannelReverb.

Example

; AudioReverb example. Compile in Extended mode; media ships with Audio Playground.
AppTitle "AudioReverb"
If Not InitAudioEffects() Then RuntimeError AudioLastError$()
Graphics 680,240,0,2
SetBuffer BackBuffer()
sound = LoadSound("../../../samples/audio/media/machine.wav")
If sound = 0 Then RuntimeError "The installed audio sample media is missing."
LoopSound sound
SoundVolume sound,0.25
RequireAudio AudioMasterMeter(True)
RequireAudio AudioGroupMeter(0,True)
message$ = "AudioReverb"
RequireAudio AudioReverb("cave",250)
RequireAudio SoundReverb(sound,0.6)
channel = PlaySound(sound)
If channel = 0 Then RuntimeError "Unable to play the example sound."

started = MilliSecs()
While KeyDown(1) = False And MilliSecs()-started < 5000

    Cls
    Text 20,20,message
    Text 20,50,"Group 0 peak: " + AudioGroupPeak(0) + "   RMS: " + AudioGroupRMS(0)
    Text 20,80,"Master peak: " + AudioMasterPeak() + "   RMS: " + AudioMasterRMS()
    Text 20,120,"Listen for five seconds, or press Escape to finish."
    Flip
Wend
StopChannel channel
For group = 0 To 3
    RequireAudio AudioGroupClearEffects(group)
Next
Delay 60
FreeSound sound
EndGraphics
End

Function RequireAudio(success)
    If Not success Then RuntimeError AudioLastError$()
End Function

Index