feat(ui): add bundled custom notification sounds
Adds three embedded WAV files as additional notification sound choices (ids 17-19) alongside the existing 16 game sounds. Playback via NAudio WaveOutEvent/WinMM, which works correctly on Wine/Linux.
This commit is contained in:
@@ -174,8 +174,11 @@ internal sealed class Tabs : ISettingsTab
|
||||
if (tab.EnableNotificationSound)
|
||||
{
|
||||
using var indent = ImRaii.PushIndent(10.0f);
|
||||
// Build a readable preview label for the currently selected sound.
|
||||
var soundPreview =
|
||||
$"{HellionStrings.Tabs_NotificationSound_Option} {tab.NotificationSoundId}";
|
||||
tab.NotificationSoundId <= 16
|
||||
? $"{HellionStrings.Tabs_NotificationSound_Option} {tab.NotificationSoundId}"
|
||||
: $"{HellionStrings.Tabs_NotificationSound_CustomOption} {tab.NotificationSoundId - 16}";
|
||||
using (var combo = ImRaii.Combo($"##notif-sound-{i}", soundPreview))
|
||||
{
|
||||
if (combo.Success)
|
||||
@@ -190,6 +193,21 @@ internal sealed class Tabs : ISettingsTab
|
||||
)
|
||||
tab.NotificationSoundId = s;
|
||||
}
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
// Bundled custom sounds (ids 17-19).
|
||||
for (uint n = 1; n <= 3; n++)
|
||||
{
|
||||
var customId = 16 + n;
|
||||
if (
|
||||
ImGui.Selectable(
|
||||
$"{HellionStrings.Tabs_NotificationSound_CustomOption} {n}",
|
||||
tab.NotificationSoundId == customId
|
||||
)
|
||||
)
|
||||
tab.NotificationSoundId = customId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,13 +222,20 @@ internal sealed class Tabs : ISettingsTab
|
||||
)
|
||||
{
|
||||
var previewId = tab.NotificationSoundId;
|
||||
Plugin.Framework.RunOnFrameworkThread(() =>
|
||||
if (previewId <= 16)
|
||||
{
|
||||
unsafe
|
||||
Plugin.Framework.RunOnFrameworkThread(() =>
|
||||
{
|
||||
UIGlobals.PlaySoundEffect(previewId);
|
||||
}
|
||||
});
|
||||
unsafe
|
||||
{
|
||||
UIGlobals.PlaySoundEffect(previewId);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Plugin.CustomAudioPlayer.Play((int)previewId - 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui.Checkbox(Language.Options_Tabs_PopOut, ref tab.PopOut);
|
||||
|
||||
Reference in New Issue
Block a user