Skip to content

Commit

Permalink
wrap in windows check for now, only supported on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nstlaurent committed Jan 1, 2024
1 parent b496dab commit 5e6726d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Client/Music/MusicPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using NLog;
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;

namespace Helion.Client.Music;
Expand Down Expand Up @@ -62,13 +63,18 @@ public bool Play(byte[] data, MusicPlayerOptions options)
m_musicPlayer = CreateFluidSynthPlayer();
data = converted;
}
else if (NAudioMusicPlayer.IsOgg(data))
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
m_musicPlayer = new NAudioMusicPlayer(NAudioMusicType.Ogg);
}
else if (NAudioMusicPlayer.IsMp3(data))
{
m_musicPlayer = new NAudioMusicPlayer(NAudioMusicType.Mp3);
// Ogg/mp3 currently only works in Windows
if (NAudioMusicPlayer.IsOgg(data))
{
m_musicPlayer = new NAudioMusicPlayer(NAudioMusicType.Ogg);
}
else if (NAudioMusicPlayer.IsMp3(data))
{
m_musicPlayer = new NAudioMusicPlayer(NAudioMusicType.Mp3);
}

}
else if (MusToMidi.TryConvertNoHeader(data, out converted))
{
Expand Down

0 comments on commit 5e6726d

Please sign in to comment.