Commit 7121ecb 1 parent b5e36cb commit 7121ecb Copy full SHA for 7121ecb
File tree 1 file changed +10
-1
lines changed
SoundSwitch.Audio.Manager
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,7 @@ public void SetVolumeFromDefaultDevice(DeviceInfo device)
200
200
var currentDefault = GetMmDefaultAudioEndpoint ( ( EDataFlow ) device . Type , ERole . eConsole ) ;
201
201
if ( currentDefault == null )
202
202
return ;
203
+
203
204
var audioInfo = InteractWithMmDevice ( currentDefault , mmDevice =>
204
205
{
205
206
var defaultDeviceAudioEndpointVolume = mmDevice . AudioEndpointVolume ;
@@ -222,7 +223,15 @@ public void SetVolumeFromDefaultDevice(DeviceInfo device)
222
223
if ( mmDevice . AudioEndpointVolume == null )
223
224
return nextDevice ;
224
225
225
- mmDevice . AudioEndpointVolume . MasterVolumeLevelScalar = audioInfo . Volume ;
226
+ if ( mmDevice . AudioEndpointVolume . Channels . Count == 2 )
227
+ {
228
+ mmDevice . AudioEndpointVolume . Channels [ 0 ] . VolumeLevelScalar = audioInfo . Volume ;
229
+ mmDevice . AudioEndpointVolume . Channels [ 1 ] . VolumeLevelScalar = audioInfo . Volume ;
230
+ }
231
+ else
232
+ {
233
+ mmDevice . AudioEndpointVolume . MasterVolumeLevelScalar = audioInfo . Volume ;
234
+ }
226
235
mmDevice . AudioEndpointVolume . Mute = audioInfo . IsMuted ;
227
236
return mmDevice ;
228
237
} ) ;
You can’t perform that action at this time.
0 commit comments