Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #2075 #2946

Merged
merged 2 commits into from Sep 10, 2014
Merged

Fixed #2075 #2946

merged 2 commits into from Sep 10, 2014

Conversation

Nezz
Copy link
Member

@Nezz Nezz commented Aug 22, 2014

Cleaned up the usage of playingInternal to be WP only (#2075).

Cleaned up the usage of playingInternal to be WP only
@tomspilman
Copy link
Member

@dancolasanti - Can you verify this change solves your issue?

@tomspilman
Copy link
Member

@dancolasanti - Can you verify this change solves your issue?

@dancolasanti
Copy link

Sorry for the late reply - I've been out of town this week - I will be home
Saturday and should be able to verify it then.

Date: Thu, 28 Aug 2014 16:41:18 -0700
From: notifications@github.com
To: MonoGame@noreply.github.com
CC: dancolasanti@hotmail.com
Subject: Re: [MonoGame] Fixed #2075 (#2946)

@dancolasanti - Can you verify this change solves your issue?


Reply to this email directly or view it on GitHub.

@dancolasanti
Copy link

@tomspilman I was unable to verify that this fix fully resolves the problem. I downloaded the latest MonoGame-Develop code, made the suggested fix, hooked it up to SharpDX 2.6.2, rebuilt it and ran my Invasion game with it. My original problem (that trying to stop the user's music after the user says that the game can do this) seems fixed (the user's music stops), but the new side-effect (since a year ago when I last looked into this) is that the game now doesn't recognize that the user's music is playing and so it never asks the user if it can take control of music in the first place. So now the game just takes control of the user's music (shutting it off) without asking the user if that is OK (despite having logic to ask the user this - same code as my original XNA-WP7 game) and starts playing its own music. I think that this is caused by MediaPlayer.GameHasControl returning true when it shouldn't, although I haven't been able to prove this because I'm having trouble getting a debug build of MonoGame that I can actually step-into functions with (and this is partially because I don't know how to properly reference SharpDX ARM & x86 assemblies within my MonoGame project. (If you know of documentation that shows how to do this, please let me know). I could probably be of more help with this and other issues that I found if only I could figure out how to get a proper MonoGame dev-build configured correctly and reference it in my game project. cc: @Nezz

@Nezz
Copy link
Member Author

Nezz commented Sep 2, 2014

Detecting if the user's music is playing at launch works for us and it wasn't working without this fix. This is the code from this PR:

return (!playingInternal && State == MediaState.Playing) || MsMediaPlayer.GameHasControl;

playingInternal is true by default, so the first part is false, therefore we return what the platform (MsMediaPlayer) gives us. So GameHasControl returns a correct value as long as playingInternal is set to true.
playingInternal is set to false by playing a non-MediaLibrary song (e.g. your game music).
So this doesn't work if you open up the game, start the background music, then leave the game, start user music and return to the game. I personally do not plan to fix this case because it is rather complicated (user music and game music use two different players that can play at the same time) and isn't a store requirement.

@tomspilman Could you merge this PR so that future improvements can be made regarding GameHasControl? The bug described in #2075 ("Can't MediaPlayer.Stop User's Music to Play Game Music") was in fact fixed, even if there are some other problems with the MediaPlayer :)

@tomspilman
Copy link
Member

Merging...

tomspilman added a commit that referenced this pull request Sep 10, 2014
@tomspilman tomspilman merged commit 971864e into MonoGame:develop Sep 10, 2014
@Nezz Nezz deleted the wp_internal_fix branch September 10, 2014 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants