Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
49bba25
Implement issue #1703
Dwscdv3 Aug 12, 2025
1645b1b
revert incorrect formatting
Dwscdv3 Aug 12, 2025
80d6b35
Rename dB to Db to comply with camelCase
Dwscdv3 Aug 16, 2025
b279a17
Mute when slide to the left
Dwscdv3 Aug 16, 2025
537b586
Use WeakEventManager to resolve memory leak
Dwscdv3 Aug 16, 2025
ed4c763
precise volume bars calculation
Dwscdv3 Aug 17, 2025
e7da92a
Scrolling on tray icon now changes 0.2 dB instead of 2 dB
Dwscdv3 Aug 17, 2025
e591cf1
settings UI enhancements
Dwscdv3 Aug 27, 2025
98667b1
revert unrelated formatting made by GitHub Copilot
Dwscdv3 Aug 27, 2025
550f867
change from hidden to disabled when setting is not applicable
Dwscdv3 Sep 2, 2025
2ba08c2
Add string resource
riverar Sep 20, 2025
3bc6771
Fix lerp calculation
riverar Sep 20, 2025
1b88175
Merge branch 'dev' into issue-1703
riverar Sep 20, 2025
86ba3fe
Add to changelog
riverar Sep 21, 2025
17511de
resolve conflict for syncing
Dwscdv3 Oct 20, 2025
cc3e63a
Added logarithmic volume support for Actions
Dwscdv3 Oct 22, 2025
2a649bd
merge from upstream
Dwscdv3 Oct 22, 2025
48bcd2d
revert Resources.Designer.cs
Dwscdv3 Oct 22, 2025
8a46be4
revert Resources.Designer.cs
Dwscdv3 Oct 22, 2025
574768f
Regenerate designer resources
riverar Oct 26, 2025
49e792f
Merge branch 'dev' into issue-1703
riverar Oct 26, 2025
6a80e89
Adjustable scroll wheel and hotkey delta
Dwscdv3 Nov 11, 2025
69560e6
Merge branch 'issue-1703' of https://github.com/Dwscdv3/EarTrumpet in…
Dwscdv3 Nov 11, 2025
230f6bb
resolve conflict
Dwscdv3 Nov 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions EarTrumpet/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ private void TrayIconScrolled(object _, int wheelDelta)
if (Settings.UseScrollWheelInTray && (!Settings.UseGlobalMouseWheelHook || _flyoutViewModel.State == FlyoutViewState.Hidden))
{
CollectionViewModel.Default?.IncrementVolume(
Math.Sign(wheelDelta) * (Settings.UseLogarithmicVolume ? 0.2f : 2.0f));
Math.Sign(wheelDelta) *
(Settings.UseLogarithmicVolume ? Settings.ScrollWheelOrHotkeyVolumeChangeDb : Settings.ScrollWheelOrHotkeyVolumeChangePercent));
}
}

Expand Down Expand Up @@ -411,18 +412,17 @@ private void AbsoluteVolumeIncrement()
foreach (var device in CollectionViewModel.AllDevices.Where(d => !d.IsMuted || d.IsAbsMuted))
{
device.IsAbsMuted = false;
device.IncrementVolume(2);
device.Volume += Settings.UseLogarithmicVolume ? Settings.ScrollWheelOrHotkeyVolumeChangeDb : Settings.ScrollWheelOrHotkeyVolumeChangePercent;
}
}

private void AbsoluteVolumeDecrement()
{
foreach (var device in CollectionViewModel.AllDevices.Where(d => !d.IsMuted))
{
var wasMuted = device.IsMuted;
device.Volume -= 2;
device.Volume -= Settings.UseLogarithmicVolume ? Settings.ScrollWheelOrHotkeyVolumeChangeDb : Settings.ScrollWheelOrHotkeyVolumeChangePercent;

if (!wasMuted == (device.Volume <= 0))
if (device.Volume <= (Settings.UseLogarithmicVolume ? Settings.LogarithmicVolumeMinDb : 0.0f))
{
device.IsAbsMuted = true;
}
Expand Down
12 changes: 12 additions & 0 deletions EarTrumpet/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,18 @@ public bool UseScrollWheelInTray
set => _settings.Set("UseScrollWheelInTray", value);
}

public int ScrollWheelOrHotkeyVolumeChangePercent
{
get => _settings.Get("ScrollWheelOrHotkeyVolumeChangePercent", 2);
set => _settings.Set("ScrollWheelOrHotkeyVolumeChangePercent", value);
}

public float ScrollWheelOrHotkeyVolumeChangeDb
{
get => _settings.Get("ScrollWheelOrHotkeyVolumeChangeDb", 0.5f);
set => _settings.Set("ScrollWheelOrHotkeyVolumeChangeDb", value);
}

public bool UseGlobalMouseWheelHook
{
get => _settings.Get("UseGlobalMouseWheelHook", false);
Expand Down
3 changes: 3 additions & 0 deletions EarTrumpet/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -685,4 +685,7 @@ Open [https://eartrumpet.app/jmp/fixstartup] to resolve this?</value>
<data name="VolumeUnit_Decibel" xml:space="preserve">
<value>dB</value>
</data>
<data name="SettingsScrollWheelOrHotkeyVolumeChange" xml:space="preserve">
<value>Volume change amount for each wheel scroll or hotkey press</value>
</data>
</root>
3 changes: 3 additions & 0 deletions EarTrumpet/Properties/Resources.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -679,4 +679,7 @@
<data name="SettingsLogarithmicScaleMinimum" xml:space="preserve">
<value>对数音量刻度最小值</value>
</data>
<data name="SettingsScrollWheelOrHotkeyVolumeChange" xml:space="preserve">
<value>滚动滚轮或按下快捷键时的音量变化幅度</value>
</data>
</root>
3 changes: 2 additions & 1 deletion EarTrumpet/UI/Controls/VolumeSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ private void OnMouseMove(object sender, MouseEventArgs e)

private void OnMouseWheel(object sender, MouseWheelEventArgs e)
{
var amount = Math.Sign(e.Delta) * (App.Settings.UseLogarithmicVolume ? 0.2 : 2.0);
var amount = Math.Sign(e.Delta) *
(App.Settings.UseLogarithmicVolume ? App.Settings.ScrollWheelOrHotkeyVolumeChangeDb : App.Settings.ScrollWheelOrHotkeyVolumeChangePercent);
ChangePositionByAmount(amount);
e.Handled = true;
}
Expand Down
2 changes: 2 additions & 0 deletions EarTrumpet/UI/Converters/NegateConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class NegateConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is bool b) return !b;
if (value is double d) return -d;
if (value is float f) return (double)-f;
if (value is int i) return (double)-i;
Expand All @@ -15,6 +16,7 @@ public object Convert(object value, Type targetType, object parameter, System.Gl

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is bool b) return !b;
if (value is double d) return -d;
throw new InvalidOperationException();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace EarTrumpet.UI.ViewModels;
using System;

namespace EarTrumpet.UI.ViewModels;

public class EarTrumpetCommunitySettingsPageViewModel : SettingsPageViewModel
{
Expand Down Expand Up @@ -29,6 +31,32 @@ public double LogarithmicVolumeMinDb
}
}

public double ScrollWheelOrHotkeyVolumeChangePercent
{
get => _settings.ScrollWheelOrHotkeyVolumeChangePercent;
set
{
if (_settings.ScrollWheelOrHotkeyVolumeChangePercent != (float)value)
{
_settings.ScrollWheelOrHotkeyVolumeChangePercent = (int)Math.Round(value);
RaisePropertyChanged(nameof(ScrollWheelOrHotkeyVolumeChangePercent));
}
}
}

public double ScrollWheelOrHotkeyVolumeChangeDb
{
get => _settings.ScrollWheelOrHotkeyVolumeChangeDb;
set
{
if (_settings.ScrollWheelOrHotkeyVolumeChangeDb != (float)value)
{
_settings.ScrollWheelOrHotkeyVolumeChangeDb = (float)value;
RaisePropertyChanged(nameof(ScrollWheelOrHotkeyVolumeChangeDb));
}
}
}

public bool ShowFullMixerWindowOnStartup
{
get => _settings.ShowFullMixerWindowOnStartup;
Expand Down
3 changes: 2 additions & 1 deletion EarTrumpet/UI/ViewModels/FlyoutViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ private int OnMouseWheelEvent(object sender, System.Windows.Forms.MouseEventArgs
{
if (!_winRect.Contains(new Point(e.X, e.Y)))
{
existing.IncrementVolume(Math.Sign(e.Delta) * 2);
existing.Volume += Math.Sign(e.Delta) *
(App.Settings.UseLogarithmicVolume ? App.Settings.ScrollWheelOrHotkeyVolumeChangeDb : App.Settings.ScrollWheelOrHotkeyVolumeChangePercent);
return -1;
}
}
Expand Down
43 changes: 39 additions & 4 deletions EarTrumpet/UI/Views/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,12 @@
Content="{x:Static resx:Resources.SettingsUseLogarithmicVolume}"
IsChecked="{Binding UseLogarithmicVolume, Mode=TwoWay}" />
<StackPanel>
<!-- Localization required -->
<TextBlock VerticalAlignment="Center"
Style="{StaticResource BodyText}"
Text="{x:Static resx:Resources.SettingsLogarithmicScaleMinimum}" />
<StackPanel Orientation="Horizontal"
Margin="12,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Bottom">
VerticalAlignment="Center">
<!--
-96 dB is the min volume range of most devices
-12 dB is arbitrarily chosen
Expand All @@ -202,7 +200,44 @@
Value="{Binding LogarithmicVolumeMinDb, Converter={StaticResource NegateConverter}, Mode=TwoWay}" />
<TextBlock VerticalAlignment="Center"
Style="{StaticResource BodyText}"
Text="{Binding LogarithmicVolumeMinDb, StringFormat=\{0\} dB}" />
Text="{Binding LogarithmicVolumeMinDb, StringFormat={}{0} dB}" />
</StackPanel>
</StackPanel>
<StackPanel>
<TextBlock VerticalAlignment="Center"
Style="{StaticResource BodyText}"
Text="{x:Static resx:Resources.SettingsScrollWheelOrHotkeyVolumeChange}" />
<StackPanel Orientation="Horizontal"
Margin="12,0,0,0"
VerticalAlignment="Center">
<Slider Minimum="1"
Maximum="10"
Width="200"
IsEnabled="{Binding UseLogarithmicVolume, Converter={StaticResource NegateConverter}}"
IsSnapToTickEnabled="True"
SmallChange="1"
LargeChange="1"
TickFrequency="1"
Value="{Binding ScrollWheelOrHotkeyVolumeChangePercent, Mode=TwoWay}" />
<TextBlock VerticalAlignment="Center"
Style="{StaticResource BodyText}"
Text="{Binding ScrollWheelOrHotkeyVolumeChangePercent, StringFormat={}{0}%}" />
</StackPanel>
<StackPanel Orientation="Horizontal"
Margin="12,0,0,0"
VerticalAlignment="Center">
<Slider Minimum="0.1"
Maximum="5"
Width="200"
IsEnabled="{Binding UseLogarithmicVolume}"
IsSnapToTickEnabled="True"
SmallChange="0.1"
LargeChange="0.5"
TickFrequency="0.1"
Value="{Binding ScrollWheelOrHotkeyVolumeChangeDb, Mode=TwoWay}" />
<TextBlock VerticalAlignment="Center"
Style="{StaticResource BodyText}"
Text="{Binding ScrollWheelOrHotkeyVolumeChangeDb, StringFormat={}{0:F1} dB}" />
</StackPanel>
</StackPanel>
<CheckBox HorizontalAlignment="Left"
Expand Down