; Extended mode. Open from this folder; media is shared with AudioPlayground. Graphics3D 960,640,0,2 SetBuffer BackBuffer() If InitAudioEffects()=False Then RuntimeError AudioLastError() Local world=LoadWorldAsync("resources/demo.world"),deadline=MilliSecs()+20000 While WorldReady(world)=False And WorldLoadState(world)<>WORLD_LOAD_FAILED UpdateAsyncLoads 2 If MilliSecs()>deadline Then RuntimeError "Audio resource loading timed out" Wend If WorldReady(world)=False Then RuntimeError WorldLoadError(world) SetWorld world:SetAudioWorld world Local camera=FindWorldEntity(world,"camera"),emitter=FindWorldEntity(world,"wind") Local preset=FindWorldAsset(world,"room"),preview=0,playing=False,message$="Ready. Loading has not started any sounds." AudioGroupMeter 3,True While KeyHit(1)=False If KeyHit(57) Then If playing Then StopSoundEmitter emitter:playing=False:message="Stopped" Else If ActivateWorldSounds(world)<0 Then message=AudioLastError() Else playing=True:message="Playing the authored spatial wind" EndIf EndIf If KeyHit(50) Then If preview<>0 Then If EndAudioMixPreview(preview) Then preview=0:message="Previous mix restored" Else message=AudioLastError() Else preview=BeginAudioMixPreview(preset) If preview=0 Then message=AudioLastError() Else message="Stone room mix preview active" EndIf EndIf If KeyDown(203) Then MoveEntity camera,-0.035,0,0 If KeyDown(205) Then MoveEntity camera,0.035,0,0 UpdateWorld RenderWorld Color 240,245,255 Text 20,18,"Sound definitions and audio mixes" Text 20,46,"Space: play / stop wind M: preview / restore room mix Left / Right: move listener Esc: exit" Text 20,74,message Text 20,102,"Ambience RMS: "+AudioGroupRMS(3) Flip Wend StopSoundEmitter emitter If preview<>0 Then If EndAudioMixPreview(preview)=False Then RuntimeError AudioLastError() EndIf FreeWorld world:EndGraphics:End