Skip to content

Commit

Permalink
Fix some issues with listing microphones in the device list (YARC-Off…
Browse files Browse the repository at this point in the history
…icial#424)

* Fix some microphones not getting listed

* Mark default microphone explicitly instead of using the "Default" entry
  • Loading branch information
TheNathannator authored Jun 5, 2023
1 parent 49ae6e5 commit 25018e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Assets/Script/Audio/Bass/BassAudioManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ public IList<IMicDevice> GetAllInputDevices() {
continue;
}

if (info.Type != DeviceType.Microphone) {
// We do not check the device type since there are too many that a recording device can be,
// instead we only exclude loopback devices
// The "Default" device is also excluded here since we want the user to explicitly pick which microphone to use
if (info.IsLoopback || info.Name == "Default") {
continue;
}

Expand Down
6 changes: 5 additions & 1 deletion Assets/Script/UI/AddPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ private void StartSelectDevice(bool micSelected = false) {
var mics = GameManager.AudioManager.GetAllInputDevices();
foreach (var mic in mics) {
var button = Instantiate(deviceButtonPrefab, devicesContainer);
button.GetComponentInChildren<TextMeshProUGUI>().text = $"(MIC) <b>{mic.DisplayName}</b>";
var textBox = button.GetComponentInChildren<TextMeshProUGUI>();
textBox.text = $"(MIC) <b>{mic.DisplayName}</b>";
if (mic.IsDefault) {
textBox.text += " <i>(Default)</i>";
}

var capture = mic;
button.GetComponentInChildren<Button>().onClick.AddListener(() => {
Expand Down

0 comments on commit 25018e9

Please sign in to comment.