Skip to content

Commit

Permalink
Fixed volume not actually changing
Browse files Browse the repository at this point in the history
  • Loading branch information
PaciStardust committed Jun 7, 2024
1 parent fa0f6bc commit c1e79c3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions OscMultitool/Services/Speech/Synthesizing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ internal static void ChangeVolume()
try
{
var configVolume = Config.Speech.SpeakerVolumeInt / 100f;
var roundedWaveOutVolume = Math.Ceiling(_waveOut.Volume * 20) / 20f;
var roundedWaveOut = Math.Round(_waveOut.Volume*100, 2) / 100;

//Floating points messed with this so its strings now
if (configVolume + string.Empty == roundedWaveOutVolume + string.Empty)
if (configVolume + string.Empty == roundedWaveOut + string.Empty)
return;

_waveOut.Volume = Config.Speech.SpeakerVolumeInt;
_waveOut.Volume = configVolume;
Logger.PInfo("Changed synthesizer volume: " + Config.Speech.SpeakerVolumeInt);
}
catch (Exception ex)
Expand Down
2 changes: 1 addition & 1 deletion OscMultitool/Ui/Pages/PageOutput.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
</WrapPanel>

<WrapPanel Margin="0,4,0,0">
<TextBox Tag="Volume..." Style="{StaticResource HTextBoxShort}">
<TextBox Tag="Volume..." Style="{StaticResource HTextBoxShort}" TextChanged="VolumeBox_TextChanged">
<TextBox.Text>
<Binding Source="{x:Static local:Config.Data}" Path="Speech.SpeakerVolumeInt" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
Expand Down
3 changes: 3 additions & 0 deletions OscMultitool/Ui/Pages/PageOutput.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ private void SynthUseAzure_Checked(object sender, RoutedEventArgs e)

private void SynthTextBox_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
=> TryEnableChangeIndicatorSynth();

private void VolumeBox_TextChanged(object sender, TextChangedEventArgs e)
=> Synthesizing.ChangeVolume();
#endregion
}
}

0 comments on commit c1e79c3

Please sign in to comment.