Skip to content

Commit

Permalink
Trying to make the adjustments more robust for currupted results.
Browse files Browse the repository at this point in the history
  • Loading branch information
oddbear committed Oct 24, 2022
1 parent 0b6f446 commit c952606
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 11 deletions.
10 changes: 8 additions & 2 deletions WaveLinkPlugin/Adjustments/InputMonitorMixAdjustment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ protected override void RunCommand(string actionParameter)
return;

inputMix.IsLocalInMuted = !inputMix.IsLocalInMuted;
inputMix.IsLocalInMuted = _client.SetInputMixer(inputMix, MixType.LocalMix)
var result = _client.SetInputMixer(inputMix, MixType.LocalMix)
?.IsLocalInMuted;

if (result != null)
inputMix.IsLocalInMuted = result;

base.ActionImageChanged();
}

Expand All @@ -110,9 +113,12 @@ protected override void ApplyAdjustment(string actionParameter, int diff)
volume = 100;

inputMix.LocalVolumeIn = volume;
inputMix.LocalVolumeIn = _client.SetInputMixer(inputMix, MixType.LocalMix)
var result = _client.SetInputMixer(inputMix, MixType.LocalMix)
?.LocalVolumeIn;

if (result != null)
inputMix.LocalVolumeIn = result;

base.AdjustmentValueChanged(actionParameter);
}

Expand Down
10 changes: 8 additions & 2 deletions WaveLinkPlugin/Adjustments/InputStreamMixAdjustment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ protected override void RunCommand(string actionParameter)
return;

inputMix.IsStreamInMuted = !inputMix.IsStreamInMuted;
inputMix.IsStreamInMuted = _client.SetInputMixer(inputMix, MixType.StreamMix)
var result = _client.SetInputMixer(inputMix, MixType.StreamMix)
?.IsStreamInMuted;

if (result != null)
inputMix.IsStreamInMuted = result;

base.ActionImageChanged();
}

Expand All @@ -110,9 +113,12 @@ protected override void ApplyAdjustment(string actionParameter, int diff)
volume = 100;

inputMix.StreamVolumeIn = volume;
inputMix.StreamVolumeIn = _client.SetInputMixer(inputMix, MixType.StreamMix)
var result = _client.SetInputMixer(inputMix, MixType.StreamMix)
?.StreamVolumeIn;

if (result != null)
inputMix.StreamVolumeIn = result;

base.AdjustmentValueChanged(actionParameter);
}

Expand Down
13 changes: 10 additions & 3 deletions WaveLinkPlugin/Adjustments/OutputMonitorMixAdjustment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ protected override void RunCommand(string actionParameter)
return;

_state.IsLocalOutMuted = !_state.IsLocalOutMuted;
_state.IsLocalOutMuted = _client.SetOutputMixer(_state)
var result = _client.SetOutputMixer(_state)
?.IsLocalOutMuted;

if (result != null)
_state.IsLocalOutMuted = result;

base.ActionImageChanged(actionParameter);
}

Expand All @@ -70,9 +73,13 @@ protected override void ApplyAdjustment(string actionParameter, int diff)
volume = 100;

_state.LocalVolumeOut = volume;
_state.LocalVolumeOut = _client.SetOutputMixer(_state)
var result = _client.SetOutputMixer(_state)
?.LocalVolumeOut;


if (result != null)
_state.LocalVolumeOut = result;


base.AdjustmentValueChanged(actionParameter);
}

Expand Down
12 changes: 9 additions & 3 deletions WaveLinkPlugin/Adjustments/OutputStreamMixAdjustment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ protected override void RunCommand(string actionParameter)
return;

_state.IsStreamOutMuted = !_state.IsStreamOutMuted;
_state.IsStreamOutMuted = _client.SetOutputMixer(_state)
var result = _client.SetOutputMixer(_state)
?.IsStreamOutMuted;


if (result != null)
_state.IsStreamOutMuted = result;

base.ActionImageChanged(actionParameter);
}
protected override void ApplyAdjustment(string actionParameter, int diff)
Expand All @@ -69,9 +72,12 @@ protected override void ApplyAdjustment(string actionParameter, int diff)
volume = 100;

_state.StreamVolumeOut = volume;
_state.StreamVolumeOut = _client.SetOutputMixer(_state)
var result = _client.SetOutputMixer(_state)
?.StreamVolumeOut;

if (result != null)
_state.StreamVolumeOut = result;

base.AdjustmentValueChanged(actionParameter);
}

Expand Down
5 changes: 4 additions & 1 deletion WaveLinkPlugin/Commands/SetOutputMonitorMixCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,12 @@ protected override void RunCommand(string actionParameter)
if (actionParameter is null || !_client.IsConnected)
return;

_monitorMix = _client.SetMonitorMixOutput(actionParameter)
var result = _client.SetMonitorMixOutput(actionParameter)
?.MonitorMix;

if (result != null)
_monitorMix = result;

base.ActionImageChanged();
}

Expand Down

0 comments on commit c952606

Please sign in to comment.