Stop audio device change event from occurring when opening big menu

This commit is contained in:
Natsumi
2022-06-13 02:23:10 +12:00
parent 5c6d8799df
commit e68f570b86

View File

@@ -332,6 +332,7 @@ namespace VRCX
});
logContext.onJoinPhotonDisplayName = String.Empty;
logContext.LastAudioDevice = String.Empty;
logContext.LastVideoError = String.Empty;
return true;
@@ -811,17 +812,22 @@ namespace VRCX
lineOffset += 3;
var endPos = line.Length - 1;
var audioDevice = line.Substring(lineOffset, endPos - lineOffset);
if (logContext.AudioDeviceChanged && audioDevice != logContext.LastAudioDevice)
if (String.IsNullOrEmpty(logContext.LastAudioDevice))
{
AppendLog(new[]
{
fileInfo.Name,
ConvertLogTimeToISO8601(line),
"event",
$"Audio device changed, mic set to '{audioDevice}'"
});
logContext.AudioDeviceChanged = false;
logContext.LastAudioDevice = audioDevice;
return true;
}
if (!logContext.AudioDeviceChanged || logContext.LastAudioDevice == audioDevice)
return true;
AppendLog(new[]
{
fileInfo.Name,
ConvertLogTimeToISO8601(line),
"event",
$"Audio device changed, mic set to '{audioDevice}'"
});
logContext.LastAudioDevice = audioDevice;
logContext.AudioDeviceChanged = false;