TeamStarDrive / StarDrive

StarDrive BlackBox Mod
MIT License
26 stars 4 forks source link

Failed to play audio file: problems with NAudio? #147

Closed YongZHU02 closed 5 months ago

YongZHU02 commented 7 months ago

I tried to start up this exciting game on Mac OS through Wine. With the following environment settings:

It successfully ran for the first time (with audio) and I enjoyed it for a while. However, after the very first time I started it up, it failed to play the audio files every time.

I tried to uninstall the game and recreate the whole Wine environment many times, but this problem still existed.

I am not sure whether there's some other environment component that I forgot to install? (So far as I know, NAudio is related to .NET, but I already got it.) And not understand why it succeeded for the first time and failed in the following.

Thank you for spending time reading this issue!

Checking the log file, there was a warning as follows:

03:03:30.977ms: Warning: Failed to play audio file: System.Runtime.InteropServices.COMException (0xC00D36BB): Exception from HRESULT: 0xC00D36BB
   at NAudio.MediaFoundation.MediaFoundationInterop.MFCreateSourceReaderFromURL(String pwszURL, IMFAttributes pAttributes, IMFSourceReader& ppSourceReader)
   at Ship_Game.Audio.NAudio.NAudioMFReader.CreateReader(MediaFoundationReaderSettings settings) in C:\Projects\BlackBox\Ship_Game\Audio\NAudio\NAudioMFReader.cs:line 143
   at Ship_Game.Audio.NAudio.NAudioMFReader.Init(MediaFoundationReaderSettings initialSettings) in C:\Projects\BlackBox\Ship_Game\Audio\NAudio\NAudioMFReader.cs:line 91
   at Ship_Game.Audio.NAudio.NAudioMFReader..ctor(String file, MediaFoundationReaderSettings settings) in C:\Projects\BlackBox\Ship_Game\Audio\NAudio\NAudioMFReader.cs:line 81
   at Ship_Game.Audio.NAudio.NAudioFileReader.CreateMFReader(WaveFormat outFormat, String fileName) in C:\Projects\BlackBox\Ship_Game\Audio\NAudio\NAudioFileReader.cs:line 37
   at Ship_Game.Audio.NAudio.NAudioFileReader.CreateReaderStream(WaveFormat outFormat, String fileName) in C:\Projects\BlackBox\Ship_Game\Audio\NAudio\NAudioFileReader.cs:line 45
   at Ship_Game.Audio.NAudio.NAudioFileReader..ctor(WaveFormat outFormat, String audioFile) in C:\Projects\BlackBox\Ship_Game\Audio\NAudio\NAudioFileReader.cs:line 25
   at Ship_Game.Audio.NAudio.NAudioPlaybackEngine.Play(AudioCategory category, AudioEmitter emitter, String audioFile, Single volume) in C:\Projects\BlackBox\Ship_Game\Audio\NAudio\NAudioPlaybackEngine.cs:line 59
VenteF commented 6 months ago

Try the following versions: .Net 3.5 vcredist 2010 XNA 3.1

These are the versions that shipped on my copy of the game. I hope that resolves the issue for you,

YongZHU02 commented 5 months ago

@VenteF Thank you for your suggestion!

 The game itself required the .NET above 4.8.



I finally solved this problem with the following:
 On Mac:


I hope my experience helps.