The ability to force enable the Input Device setting in "RobloxGui.Modules.Settings.Pages.GameSettings" to change Microphone Device

As a Roblox developer, it is currently too hard to …

switch the Input Device for the Microphone in Roblox Studio when launching a playtest, through the ESC Settings Menu.
 

If this issue is addressed, it would improve my development experience because …

It would allow comfortable switching through different microphone devices, useful for testing.

image
(No Input Device option is present)

 

Current way to change a mic is through SoundService, but that’s a RobloxSecurity thing.

Code
function iter2(a, i)
	i = i + 1
	local v = a[1][i]
	local v2 = a[2][i]

	if v or v2 then
		return i, v, v2
	end
end
local function ipairsDouble(tbl1, tbl2)
	local merged = {tbl1, tbl2}
	
	return iter2, merged, 0
end


local SoundService = game:GetService("SoundService")

local function get_devices_in_an_understandable_format()
	local tbl_deviceNames, tbl_guids = game:GetService("SoundService"):GetInputDevices()
	
	local out = {}
	
	for k, v, v2 in ipairsDouble(tbl_deviceNames, tbl_guids) do
		table.insert(out, {
			name = v,
			guid = v2
		})
	end
	
	return out :: {
		[number]: {
			name: string,
			guid: string
		}
	}
end




local inputDevices = get_devices_in_an_understandable_format()

local selectedDevice = inputDevices[1]

local deviceBefore = SoundService:GetInputDevice()
SoundService:SetInputDevice(selectedDevice.name, selectedDevice.guid)

-- Did the device actually change?
if (deviceBefore == SoundService:GetInputDevice()) then
	warn("The device didn't change, if you were trying to change it.")
	warn("Current Device:", SoundService:GetInputDevice())	
else
	print("New Device:", SoundService:GetInputDevice())	
end

 

Not sure if it’s called like that, but there’s a function called updateAudioDevices. That only gets ran if game:GetEngineFeature("EnableCrossExpVoice") returns true and if a CrossExperienceVoiceManager is “connected”.

There’s two of these updateAudioDevices, one for the Input and one for the Output. And only the output is not in those “if” closures.

So, the Input Device setting, is gated through that :thinking:
I think at least.

 

Not, sure how I’d force enable this game:GetEngineFeature("EnableCrossExpVoice") but, it’s pretty much one of the things that seems to gate the Input Device setting from showing up in there, I think.

Once it used to appear in the settings, but now it doesn’t anymore. Give us the ability to better test Voice Chat API - #4 by ReallyLongArms

2 Likes

Hey @HealthyKarl, the option to pick an Input device should appear in the ESC menu whenever microphone input is available – in studio, the only ways to get microphone input are to start a Team-Test in TeamCreate, or to use the Audio API (VoiceChatService.UseAudioApi). Additionally, you’ll need to enable “Microphone” under Game Settings > Communication, since some logic is gated on that.

I gave this a try locally:

  1. Publish a place
  2. Enable Microphone in game settings
  3. set VoiceChatService.UseAudioApi to Enabled

and see input device selection as an option on my end – are you seeing different behavior?

1 Like

I didn’t try it on a Published Game. :thinking:

I just tried that and it worked.

(This has to be set before starting the game)

image

 

I don’t know why it appears below Output Devices. :thinking:

But it works.