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:
@@ -363,16 +363,26 @@ internal class MessageManager : IAsyncDisposable
|
||||
|
||||
if (notificationSound is { } soundId)
|
||||
{
|
||||
// ProcessMessage runs on the PendingMessageThread worker; the native
|
||||
// UIGlobals.PlaySoundEffect must be marshalled onto the framework
|
||||
// thread (reference_dalamud_framework_thread).
|
||||
Plugin.Framework.RunOnFrameworkThread(() =>
|
||||
if (soundId is >= 1 and <= 16)
|
||||
{
|
||||
unsafe
|
||||
// ProcessMessage runs on the PendingMessageThread worker; the native
|
||||
// UIGlobals.PlaySoundEffect must be marshalled onto the framework
|
||||
// thread (reference_dalamud_framework_thread).
|
||||
Plugin.Framework.RunOnFrameworkThread(() =>
|
||||
{
|
||||
UIGlobals.PlaySoundEffect(soundId);
|
||||
}
|
||||
});
|
||||
unsafe
|
||||
{
|
||||
UIGlobals.PlaySoundEffect(soundId);
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (soundId >= 17)
|
||||
{
|
||||
// Custom bundled sounds (ids 17-19) go through NAudio WaveOutEvent.
|
||||
// NAudio manages its own playback thread, so no framework marshalling needed.
|
||||
Plugin.CustomAudioPlayer.Play((int)soundId - 16);
|
||||
}
|
||||
// soundId == 0 (hand-edited config) falls through: plays nothing.
|
||||
}
|
||||
|
||||
MessageProcessed?.Invoke(message);
|
||||
|
||||
Reference in New Issue
Block a user