Hello devs,
I’ve encountered an issue with the new AudioDeviceInput
instance. For some reason, audio is not being detected at all. Not sure why; whether its a setup issue or not.
Code:
iconModule.new()
:setLabel("Hear Myself")
:setRight()
:bindEvent("selected", function(self)
local AudioAnalyzer = Utilities.AudioAnalyzer:Clone()
AudioAnalyzer.Parent = Player.Character
local AudioListener = Utilities.AudioListener:Clone()
AudioListener.AudioInteractionGroup = "Player"
AudioListener.Parent = Player.Character
local AudioOutput = Utilities.AudioDeviceOutput:Clone()
AudioOutput.Parent = AudioListener
local AudioInput = Utilities.AudioDeviceInput:Clone()
AudioInput.Player = Player
AudioInput.Parent = Player
AudioInput.Name = "MicrophoneInput"
local AudioEmitter = Utilities.AudioEmitter:Clone()
AudioEmitter.AudioInteractionGroup = "Player"
AudioEmitter.Parent = Player.Character
local Wire = Utilities.Wire:Clone()
Wire.Parent = AudioEmitter
Wire.SourceInstance = AudioInput
Wire.TargetInstance = AudioEmitter
local Wire2 = Utilities.Wire:Clone()
Wire2.Parent = AudioOutput
Wire2.SourceInstance = AudioListener
Wire2.TargetInstance = AudioOutput
local Wire3 = Utilities.Wire:Clone()
Wire3.Parent = AudioAnalyzer
Wire3.SourceInstance = AudioInput
Wire3.TargetInstance = AudioAnalyzer
print("Audio setup done.")
while true do
task.wait()
if AudioAnalyzer.RmsLevel > 0.1 then
print("Sound")
end
end
self:deselect()
end)
No errors; just no audio heard from myself and the “Sound” print never prints out.
Note: I am using TopbarPlus+ in this script.