Skip to content

Portable Tool for an Ideal Windows Setup

-fix sound boost (100%)

Greedeks51a7a4ea16b2
diff --git a/.Source/GTweak/Utilities/Control/SettingsRepository.cs b/.Source/GTweak/Utilities/Control/SettingsRepository.cs
index 116f0f62..9b8b449a 100644
--- a/.Source/GTweak/Utilities/Control/SettingsRepository.cs
+++ b/.Source/GTweak/Utilities/Control/SettingsRepository.cs
@@ -26,10 +26,10 @@ namespace GTweak.Utilities.Control
internal sealed class WinmmMethods
{
[DllImport("winmm.dll")]
- public static extern int waveOutGetVolume(IntPtr hwo, out uint dwVolume);
+ internal static extern int waveOutGetVolume(IntPtr hwo, out uint dwVolume);
[DllImport("winmm.dll")]
- public static extern int waveOutSetVolume(IntPtr hwo, uint dwVolume);
+ internal static extern int waveOutSetVolume(IntPtr hwo, uint dwVolume);
}
private static bool _isViewNotification = true;
@@ -40,8 +40,6 @@ namespace GTweak.Utilities.Control
private static string _theme = "Dark";
internal static bool _isHiddenIpAddress = false;
- private const uint defaultVolume = 50;
- internal static uint currentVolume = 0;
internal static int PID = 0;
internal static string currentRelease = (Assembly.GetEntryAssembly() ?? throw new InvalidOperationException()).GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion.Split(' ').Last().Trim();
internal static readonly string currentName = AppDomain.CurrentDomain.FriendlyName;
@@ -68,7 +66,7 @@ namespace GTweak.Utilities.Control
registryKey?.SetValue("HiddenIP", IsHiddenIpAddress, RegistryValueKind.String);
registryKey?.SetValue("Theme", Theme, RegistryValueKind.String);
registryKey?.SetValue("Language", App.GettingSystemLanguage, RegistryValueKind.String);
- WinmmMethods.waveOutSetVolume(IntPtr.Zero, ((uint)(double)(ushort.MaxValue / 100 * defaultVolume) & 0x0000ffff) | ((uint)(double)((ushort.MaxValue / 100) * defaultVolume) << 16));
+ WinmmMethods.waveOutSetVolume(IntPtr.Zero, 0x80008000);
}
else
{
@@ -79,7 +77,6 @@ namespace GTweak.Utilities.Control
IsHiddenIpAddress = bool.Parse(registryKey?.GetValue("HiddenIP").ToString() ?? "False");
Language = registryKey?.GetValue("Language").ToString() ?? App.GettingSystemLanguage;
Theme = registryKey?.GetValue("Theme").ToString() ?? "Dark";
- WinmmMethods.waveOutGetVolume(IntPtr.Zero, out currentVolume);
}
registryKey?.Close();
}
diff --git a/.Source/GTweak/Windows/MainWindow.xaml.cs b/.Source/GTweak/Windows/MainWindow.xaml.cs
index 70ede8d3..6ce73e26 100644
--- a/.Source/GTweak/Windows/MainWindow.xaml.cs
+++ b/.Source/GTweak/Windows/MainWindow.xaml.cs
@@ -23,7 +23,8 @@ namespace GTweak
BtnUpdate.StateNA = SettingsRepository.IsСheckingUpdate;
BtnTopMost.StateNA = Topmost = SettingsRepository.IsTopMost;
BtnSoundNtn.IsChecked = SettingsRepository.IsPlayingSound;
- SliderVolume.Value = (ushort)(SettingsRepository.currentVolume & 0x0000ffff) / (ushort.MaxValue / 100);
+ SettingsRepository.WinmmMethods.waveOutGetVolume(IntPtr.Zero, out uint currentVolume);
+ SliderVolume.Value = (ushort)(currentVolume & 0x0000ffff) / (ushort.MaxValue / 100);
LanguageSelectionMenu.SelectedIndex = SettingsRepository.Language == "en" ? 0 : 1;
ThemeSelectionMenu.SelectedIndex = SettingsRepository.Theme switch
{