Git Product home page Git Product logo

Comments (21)

flibitijibibo avatar flibitijibibo commented on June 21, 2024

My guess is VS only attempts to kill the main thread, and the other ones just die on their own (well, unmanaged threads probably). You're essentially killing the process without closing the mixer, so this is expected.

That NullReferenceException report is stupidly useless without a trace.

Are you absolutely sure that XNA4 is okay with your code? The more issues I hear on this, the more I suspect that WMP would leak with your engine.

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on June 21, 2024

How well does this project work on OSX/Linux? At least if it happens on other platforms it would verify that it's a generic lib problem rather than something Win32 needs to deal with.

from fna-mghistory.

xanather avatar xanather commented on June 21, 2024

Ok so last night I thought as to why I am getting all these odd disposing issues, I am using 64-bit binaries if that changes anything? I am also using the preview build of sdl2_mixer.dll (I thought we were supposed to use that right?). Ill switch to 32-bit right now. I'd also like to point out that the only other MediaPlayer things I am touching other than MediaPlayer.Play() is MediaPlayer.Volume.

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on June 21, 2024

Strange, I've actually not looked at anything 64-bit on Windows. I know 64-bit Linux is okay, and OSX is still limited to 32-bit... no idea how well .NET 64-bit works. The only MG-SDL2 title I've got where Windows is involved is Fez, and that one's currently 32-bit only.

As long as you're using consistent architectures it should be okay, but for .NET (or just Win32 in general) you may just want to stick with 32-bit bins.

from fna-mghistory.

xanather avatar xanather commented on June 21, 2024

Ok, I was right. No problems with 32-bit binaries. Thats a bumber though, one of the reasons I'm not using just original XNA4 on PC is so I can have access to 64-bit (and .net 4.5.). What differences could there be between 32-bit and 64-bit, I mean there are x64 sdl2_mixer libraries and associated files?

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on June 21, 2024

To tell you the truth, I'm not sure. Particularly for Windows. Considering it works with 64-bit Linux, I'm wondering if something else is going on in there. This is where a background in low-level programming/debugging comes in handy, and Windows is my weakest platform.

Maybe it's how the .NET assemblies are being built? I know Windows cares a lot more about the architecture target than Mac/Linux do (I just build my games as x86 and it's fine on both). Maybe SDL2# needs an explicit 64-bit target to deal with Windows? 🤷

Also keep in mind that a lot of those features are not available on other platforms (Mac especially), so you'll probably want to avoid the bleeding edge when it comes to the .NET features (and architecture targets) you use.

from fna-mghistory.

xanather avatar xanather commented on June 21, 2024

SDL 64-bit I think works alright on Windows, the only problem it has is the several odd MediaPlayer issues. Maybe these won't be issues anymore once someone makes the vorbis port?

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on June 21, 2024

That would definitely resolve it, but I suppose it's still concerning that Win64 exhibits this problem with SDL2_mixer.

I don't see anything in the SDL2 Bugzilla or the Hg log that suggests any problem is known, so either there's something wrong with my SDL2_mixer interop or SDL2_mixer Win64 has an issue of its own. If you can, see if upstream Hg SDL2_mixer fixes it. For all I know, the binary could just be a dud.

Also, try tracing all of the Song method calls... for all I know there's a call being done out of order that SDL2_mixer can't handle, though I try to limit mixer calls overall (grumble, threads).

from fna-mghistory.

xanather avatar xanather commented on June 21, 2024

Yep, will do. Also what happens on x64 MacOSX, is it similar problems? Maybe you should create a issue for that as well?

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on June 21, 2024

OSX doesn't even have a 64-bit Mono runtime yet. :P
On Jun 9, 2013 1:24 AM, "Jordan S" [email protected] wrote:

Yep, will do. Also what happens on x64 MacOSX, is it similar problems?
Maybe you should create a issue for that as well?


Reply to this email directly or view it on GitHubhttps://github.com//issues/97#issuecomment-19161138
.

from fna-mghistory.

xanather avatar xanather commented on June 21, 2024

Haha, I see.

from fna-mghistory.

xanather avatar xanather commented on June 21, 2024

Okay well I switched to 32-bit for the time being, more bad news but, even though the end-of-song NullReferenceException is gone the "leak" warning is still there when I call Game.Exit(). Is fez on windows using .ogg files for sounds? Just like before on 64-bit, #98 fixes this, but I don't want you to accept that PR if you feel it is unnecessary. This is the best stack trace I could get:

[External Code] 

MonoGame.Framework.dll!Microsoft.Xna.Framework.Media.Song.closeMixer() Line 71 + 0x5 bytes C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.SDL2_GamePlatform.Exit() Line 154 + 0x5 bytes C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.Game.Exit() Line 376 + 0xe bytes C#
hidden.exe!hidden.Interface.Menu.MenuWindow.Update() Line 42 C#
hidden.exe!hidden.Interface.UIManager.Update() Line 81 + 0x44 bytes C#
hidden.exe!hidden.Menu.Update() Line 69 C#
hidden.exe!hidden.Engine.Update(Microsoft.Xna.Framework.GameTime gameTime) Line 128 C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.Game.DoUpdate(Microsoft.Xna.Framework.GameTime gameTime) Line 697 + 0xe bytes C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.Game.Tick() Line 505 + 0xe bytes C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.SDL2_GameWindow.INTERNAL_RunLoop() Line 404 + 0xd bytes C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.SDL2_GamePlatform.RunLoop() Line 135 + 0xd bytes C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.Game.Run(Microsoft.Xna.Framework.GameRunBehavior runBehavior) Line 437 + 0xe bytes C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.Game.Run() Line 415 + 0x22 bytes C#
hidden.exe!hidden.Program.Main() Line 16 + 0xa bytes C#
[External Code]

My own global exception handler for the game writes this down as a NullReferenceException in the logs as:

Unhandled exception at: 9/06/2013 3:54:02 PM, on thread: Main Thread. Fatal: True
System.NullReferenceException: Object reference not set to an instance of an object.
at SDL2.SDL_mixer.Mix_CloseAudio()
at Microsoft.Xna.Framework.Media.Song.closeMixer() in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\SDL2\Media\Song.cs:line 71
at Microsoft.Xna.Framework.SDL2_GamePlatform.Exit() in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\SDL2\SDL2_GamePlatform.cs:line 154
at Microsoft.Xna.Framework.Game.Exit() in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line 376
at hidden.Interface.Menu.MenuWindow.Update() in c:\Users\Xanather\Documents\Programming\Main\hiddenTest\hidden\Interface\Menu\MenuWindow.cs:line 40
at hidden.Interface.UIManager.Update() in c:\Users\Xanather\Documents\Programming\Main\hiddenTest\hidden\Interface\UIManager.cs:line 83
at hidden.Menu.Update() in c:\Users\Xanather\Documents\Programming\Main\hiddenTest\hidden\Menu.cs:line 68
at hidden.Engine.Update(GameTime gameTime) in c:\Users\Xanather\Documents\Programming\Main\hiddenTest\hidden\Engine.cs:line 127
at Microsoft.Xna.Framework.Game.DoUpdate(GameTime gameTime) in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line 697
at Microsoft.Xna.Framework.Game.Tick() in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line 505
at Microsoft.Xna.Framework.SDL2_GameWindow.INTERNAL_RunLoop() in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\SDL2\SDL2_GameWindow.cs:line 404
at Microsoft.Xna.Framework.SDL2_GamePlatform.RunLoop() in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\SDL2\SDL2_GamePlatform.cs:line 135
at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior) in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line 437
at Microsoft.Xna.Framework.Game.Run() in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line 415
at hidden.Program.Main() in c:\Users\Xanather\Documents\Programming\Main\hiddenTest\hidden\Program.cs:line 16

I am so lost... I'm doing nothing significant with MediaPlayer and if Fez reports no problems with song on Windows then what?

This error does not happen if I were to close the game quickly after it started (within the first 10 seconds), after woods its doomed and always results in this.

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on June 21, 2024

Wow, that's actually an interesting trace. It suggests that Song.closeMixer
isn't entirely static, which it obviously is... I dunno if I could explain
that. I think if we could find the explanation and the MediaPlayer.Stop
call really fixes it I'd be down, but I can't really tell if there's a
deeper problem we should be looking at.
On Jun 9, 2013 4:00 AM, "Jordan S" [email protected] wrote:

Okay well I switched to 32-bit for the time being, more bad news but, even
though the end-of-song NullReferenceException is gone the "leak" warning is
still there when I call Game.Exit(). Is fez on windows using .ogg files for
sounds? Just like before on 64-bit, #98https://github.com/flibitijibibo/MonoGame/issues/98fixes this, but I don't want you to accept that PR if you feel it is
unnecessary. This is the best stack trace I could get:

[External Code]

MonoGame.Framework.dll!Microsoft.Xna.Framework.Media.Song.closeMixer()
Line 71 + 0x5 bytes C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.SDL2_GamePlatform.Exit()
Line 154 + 0x5 bytes C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.Game.Exit() Line 376 + 0xe
bytes C#
hidden.exe!hidden.Interface.Menu.MenuWindow.Update() Line 42 C#
hidden.exe!hidden.Interface.UIManager.Update() Line 81 + 0x44 bytes C#
hidden.exe!hidden.Menu.Update() Line 69 C#
hidden.exe!hidden.Engine.Update(Microsoft.Xna.Framework.GameTime gameTime)
Line 128 C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.Game.DoUpdate(Microsoft.Xna.Framework.GameTime
gameTime) Line 697 + 0xe bytes C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.Game.Tick() Line 505 + 0xe
bytes C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.SDL2_GameWindow.INTERNAL_RunLoop()
Line 404 + 0xd bytes C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.SDL2_GamePlatform.RunLoop()
Line 135 + 0xd bytes C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.Game.Run(Microsoft.Xna.Framework.GameRunBehavior
runBehavior) Line 437 + 0xe bytes C#
MonoGame.Framework.dll!Microsoft.Xna.Framework.Game.Run() Line 415 + 0x22
bytes C#
hidden.exe!hidden.Program.Main() Line 16 + 0xa bytes C#
[External Code]

My own global exception handler for the game writes this down as a
NullReferenceException in the logs as:
Unhandled exception at: 9/06/2013 3:54:02 PM, on thread: Main Thread.
Fatal: True

System.NullReferenceException: Object reference not set to an instance of
an object.
at SDL2.SDL_mixer.Mix_CloseAudio()
at Microsoft.Xna.Framework.Media.Song.closeMixer() in
c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\SDL2\Media\Song.cs:line
71
at Microsoft.Xna.Framework.SDL2_GamePlatform.Exit() in
c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\SDL2\SDL2_GamePlatform.cs:line
154
at Microsoft.Xna.Framework.Game.Exit() in
c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line
376
at Xancraft.Interface.Menu.MenuWindow.Update() in
c:\Users\Xanather\Documents\Programming\Main\XancraftTest\Xancraft\Interface\Menu\MenuWindow.cs:line
40
at Xancraft.Interface.UIManager.Update() in
c:\Users\Xanather\Documents\Programming\Main\XancraftTest\Xancraft\Interface\UIManager.cs:line
83
at Xancraft.Menu.Update() in
c:\Users\Xanather\Documents\Programming\Main\XancraftTest\Xancraft\Menu.cs:line
68
at Xancraft.Engine.Update(GameTime gameTime) in
c:\Users\Xanather\Documents\Programming\Main\XancraftTest\Xancraft\Engine.cs:line
127
at Microsoft.Xna.Framework.Game.DoUpdate(GameTime gameTime) in
c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line
697
at Microsoft.Xna.Framework.Game.Tick() in
c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line
505
at Microsoft.Xna.Framework.SDL2_GameWindow.INTERNAL_RunLoop() in
c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\SDL2\SDL2_GameWindow.cs:line
404
at Microsoft.Xna.Framework.SDL2_GamePlatform.RunLoop() in
c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\SDL2\SDL2_GamePlatform.cs:line
135
at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior) in
c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line
437
at Microsoft.Xna.Framework.Game.Run() in
c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line
415
at Xancraft.Program.Main() in
c:\Users\Xanather\Documents\Programming\Main\XancraftTest\Xancraft\Program.cs:line
16

I am so lost... I'm doing nothing significant with MediaPlayer and if Fez
reports no problems with song on Windows then what?

This error does not happen if I were to close the game quickly after it
started (within the first 10 seconds), after woods its doomed and always
results in this.


Reply to this email directly or view it on GitHubhttps://github.com//issues/97#issuecomment-19162382
.

from fna-mghistory.

xanather avatar xanather commented on June 21, 2024

http://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer_12.html

Was just reading it. It mentions that "After calling this all audio is stopped, the device is closed, and the SDL_mixer functions should not be used."

Makes me wonder why MediaPlayer.Stop() needs to be called in the first place then.

from fna-mghistory.

xanather avatar xanather commented on June 21, 2024

After reading through some of the SDL_Mixer docs and looking at Song.cs I am so surprised this is even happening (I never realized how high level SDL/SDL_Mixer was haha, makes me want to learn C++). I'm probably going to do a variety of tests tomorrow on computers other than just my desktop as well. I'll also try create a test case that can create the problem.

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on June 21, 2024

Does adding SDL_mixer.Mix_HookMusicFinished(null); after this line help at all? Wondering if CloseAudio's halting the music and possibly calling the hook:

https://github.com/flibitijibibo/MonoGame/blob/monogame-sdl2/MonoGame.Framework/SDL2/Media/Song.cs#L70

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on June 21, 2024

Ha, turns out I was a big liar: there is a 64-bit OSX runtime, as long as you're smart and stay away from System.Windows.Forms and MonoMac.

Still, though.

from fna-mghistory.

xanather avatar xanather commented on June 21, 2024

Ok, well, I downloaded the updated SDL_Mixer libraries and now I cannot get sound to play at all. I tried looking into why this is happening and I cant figure it out, nothing looks too significant on the SDL_Mixer change log. If I go back to the older SDL_Mixer libraries the sound works but the several crashing issues are back. My laptop reports exactly the same things. For now I am just going to disable SDL_Mixer entirely (thanks for that by the way - its not a required dependency anymore). I want to get back actually developing my game because for now I am over these SDL_Mixer issues and have not made much progress otherwise.

By the time I actually "need" to play songs when my game is closer to release I will probably come back here, maybe others will report the same thing by then. I'm sure as heck still going to be using MonoGameSDL though, I love it and its in a much better state than WindowsGL/WindowsDX (MonoGame's WinDX is still unfinished and has been for 6 months...)

If I come along any other issues I will be sure to post them here, Ill post if I end up getting SDL_Mixer working as well. Thanks for the help flibitijibibo :)

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on June 21, 2024

Hm, wondering if your SDL2_mixer build missed Vorbis support, but the VCproj files should include it...

Ah well. Hoping we find a real Vorbisfile# at some point, rather than that thing I found in the dumpster. Glad the rest of MG-SDL2 works though!

from fna-mghistory.

xanather avatar xanather commented on June 21, 2024

@flibitijibibo
Good news! Playing .ogg files under x86 works now! It must have been a issue with SDL2 (I just downloaded latest binaries). No more leaking warnings, nothing, just works :)

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on June 21, 2024

Ah, good. Will be nice that this works with the 2.0 release, then. :D

from fna-mghistory.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.