Closed Sebanisu closed 5 years ago
SharpDX.SharpDXException HResult=0x88960001 Message=HRESULT: [0x88960001], Module: [SharpDX.XAudio2], ApiCode: [XAUDIO2_E_INVALID_CALL/InvalidCall], Message: Unknown Source=SharpDX StackTrace: at SharpDX.Result.CheckError() at SharpDX.XAudio2.SourceVoice.SubmitSourceBuffer(AudioBuffer bufferRef, IntPtr bufferWMARef) at SharpDX.XAudio2.SourceVoice.SubmitSourceBuffer(AudioBuffer bufferRef, UInt32[] decodedXMWAPacketInfo) at Microsoft.Xna.Framework.Audio.DynamicSoundEffectInstance.PlatformSubmitBuffer(Byte[] buffer, Int32 offset, Int32 count) at Microsoft.Xna.Framework.Audio.DynamicSoundEffectInstance.SubmitBuffer(Byte[] buffer, Int32 offset, Int32 count) at FF8.Ffcc.LoadSoundFromStream(Byte[]& buffer, Int32 start, Int32& length) in D:\OpenVIII\FF8\Ffcc.cs:line 965 at FF8.Ffcc.WritetoMs(Byte[]& output, Int32 start, Int32& length) in D:\OpenVIII\FF8\Ffcc.cs:line 1349 at FF8.Ffcc.Resample(AVFrame& frame) in D:\OpenVIII\FF8\Ffcc.cs:line 1255 at FF8.Ffcc.Process() in D:\OpenVIII\FF8\Ffcc.cs:line 1201 at FF8.Ffcc.PrepareProcess() in D:\OpenVIII\FF8\Ffcc.cs:line 1100 at FF8.Ffcc.Update(FfccState state, Int32 ret) in D:\OpenVIII\FF8\Ffcc.cs:line 1323 at FF8.Ffcc.Init(String filename, AVMediaType mediatype, FfccMode mode, Int32 loopstart) in D:\OpenVIII\FF8\Ffcc.cs:line 883 at FF8.Ffcc..ctor(String filename, AVMediaType mediatype, FfccMode mode, Int32 loopstart) in D:\OpenVIII\FF8\Ffcc.cs:line 69 at FF8.Module_movie_test.LoadMovie() in D:\OpenVIII\FF8\module_movie_test.cs:line 197 at FF8.Module_movie_test.Update() in D:\OpenVIII\FF8\module_movie_test.cs:line 102 at FF8.ModuleHandler.<Update>d__2.MoveNext() in D:\OpenVIII\FF8\ModuleHandler.cs:line 68
Im glad my thoughts worked on this :) - I'm getting the exact same results however.
so you select directx project and it didn't work?
As I've developed this on my own, yes - I haven't tried your latest commit for now, I'll test it tomorrow but I think it should work - I've also disabled the audio previously and it worked.
Oh when I commented above I thought you meant you got the new code and it didn't work. :P I might wanna see if naudio can help make things work. I was avoiding it because some of it's functions are windows only and i was going ffmpeg -> monogame so why add another layer. Though we still have the library there so maybe it can eat the audio samples and spit it out of waveout or directsound. instead of xaudio. At Least till someone finds a fix for xaudio.
https://github.com/MonoGame/MonoGame/issues/6611 per this issue sharpdx is a discontinued project monogame was using to interface with xaudio. Resent 21 day old post says they forked it. So maybe a fix will happen when they update it.
After setting the target-platform to x86 everywhere it worked - I guess the midi-sounds are still played (hearable at the black/white intro, not working in the first amv-intro).
yeah midi only works in x86. because it uses an old library. Maki is working on replacing it. https://github.com/MaKiPL/OpenVIII/issues/7 They have it replaced in linux but having trouble compiling the new library in Windows.
All Ogg, game sounds and movie sounds are piped through ffmpeg into monogame.
https://stackoverflow.com/questions/6377597/streaming-non-pcm-raw-audio-using-naudio
I think this is promising info though it's been a while since I've messed with ffcc. I basically need to take any part that writes to a SoundEffect or DynamicSoundEffectInstance and say when error occured use naudio calls instead.
Another thought was we build monogram ourselves and use desktopgl's audio with everything else windows. Though I haven't a clue how difficult that would be.
Maybe I should make a wrapper class that holds all the soundeffects or dynamic sounds and naudio and just presents a dumbed down interface for ffcc or other libraries to use. Though I should at least make sure the naudio Idea works lol. And ffcc is kinda the wrapper class for all things audio and video though it's kinda big.
https://markheath.net/post/how-to-record-and-play-audio-at-same <- this looks like exactly what I need.
Okay I added workaround till monogame fixes SharpDX.XAudio2. Though maybe there's a better way I haven't found. When it detects the above exception it switches to nAudio mode. And all audio is piped through that into DirectSoundOut. It's not perfect. Sometimes the sound glitches. But it seems to be working.
Effects Direct3D build XAudio throws exceptions when try to playback audio from ffmpeg.
related? https://github.com/MonoGame/MonoGame/issues/5662