Pleca Posted January 24 Share Posted January 24 In the documentation, the example for Speaker:SetFilter throws an error after pressing the space key (which activates the Speaker:SetFilter function). https://www.ultraengine.com/learn/Speaker_SetFilter?lang=lua Example: --Get the displays local displays = GetDisplays() --Create a window local window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[1], WINDOW_CENTER + WINDOW_TITLEBAR) --Create a world local world = CreateWorld() --Create a framebuffer local framebuffer = CreateFramebuffer(window) --Create a camera local camera = CreateCamera(world) camera:SetClearColor(0.125) camera:SetFov(70) camera:SetPosition(0, 0, -3) camera:Listen() --Create a light local light = CreateBoxLight(world) light:SetRotation(35, 45, 0) light:SetRange(-10, 10) --Create a box local box = CreateBox(world) box:SetColor(0, 0, 1) --Sound local sound = LoadSound("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Sound/notification.wav") local speaker = CreateSpeaker(sound) speaker:SetLooping(true) speaker:SetPosition(box:GetPosition(true)) speaker:Play() speaker:SetRange(10) --Main loop while window:Closed() == false and window:KeyDown(KEY_ESCAPE) == false do --Add filter when space key is pressed if window:KeyHit(KEY_SPACE) then speaker:SetFilter(AUDIOFILTER_REVERB_SEWERPIPE) end --Move and turn with the arrow keys - best experienced with headphones if window:KeyDown(KEY_UP) then camera:Move(0, 0, 0.1) end if window:KeyDown(KEY_DOWN) then camera:Move(0, 0, -0.1) end if window:KeyDown(KEY_LEFT) then camera:Turn(0, -1, 0) end if window:KeyDown(KEY_RIGHT) then camera:Turn(0, 1, -0) end world:Update() world:Render(framebuffer) end return 0 Error: [sol2] An error occurred and has been passed to an error handler: sol: runtime error: stack index 2, expected number, received nil: stack traceback: [C]: in method 'SetFilter' [string "G:\development\ultraengine\testbloomeffect\source\main.lua"]:42: in main chunk sol: runtime error: stack index 2, expected number, received nil: stack traceback: [C]: in method 'SetFilter' [string "G:\development\ultraengine\testbloomeffect\source\main.lua"]:42: in main chunk Error: [string "G:\development\ultraengine\testbloomeffect\source\main.lua"]:42: in main chunk Quote Link to comment Share on other sites More sharing options...
Josh Posted January 24 Share Posted January 24 You are correct. All the constants for this need to be added. In the meantime, the value for AUDIOFILTER_REVERB_SEWERPIPE is 22. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Solution Josh Posted January 24 Solution Share Posted January 24 AI made this tedious task a lot faster. Compiling now... 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Pleca Posted January 24 Author Share Posted January 24 So I guess AUDIOFILTER_REVERB_CAVE is 9? That's the one I wanted to use. Quote Link to comment Share on other sites More sharing options...
Josh Posted January 24 Share Posted January 24 Yes. An update will add these later today. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.