XNA PlayMusic loop error

Monkey Forums/Monkey Bug Reports/XNA PlayMusic loop error

Amnesia(Posted 2012) [#1]
This is a bug on XNA (Tested on a Windows Phone Lumia 800) When you play a music looped it play fine, but after, if you play a music not looped, the music plays looped anyways. The problem is in gxtkAudio.PlayMusic. The property MediaPlayer.IsRepeating is global, so if the flag is set to not looped, is necessary to set it to false.
Currently (After version 51 until latest version 66):
public virtual int PlayMusic( String path,int flags ){
	MediaPlayer.Stop();
	
	Song song=MonkeyData.LoadSong( path,gxtkApp.game.Content );
	if( song==null ) return -1;
	
	if( (flags&1)!=0 ) MediaPlayer.IsRepeating=true;
	
	MediaPlayer.Play( song );
	return 0;
}


But it should be:
public virtual int PlayMusic( String path,int flags ){
	MediaPlayer.Stop();
	
	Song song=MonkeyData.LoadSong( path,gxtkApp.game.Content );
	if( song==null ) return -1;
	
	if( (flags&1)!=0 )
		MediaPlayer.IsRepeating=true;
	else
		MediaPlayer.IsRepeating=false;
	
	MediaPlayer.Play( song );
	return 0;
}



marksibly(Posted 2012) [#2]
Hi,

Nice find, thanks!