About Monkey 2 › Forums › Monkey 2 Development › Best method to stop PlayMusic
This topic contains 4 replies, has 3 voices, and was last updated by 
 bigand 1 year, 3 months ago.
- 
		AuthorPosts
 - 
		
			
				
November 9, 2017 at 2:34 pm #11598
Just having a problem with the new PlayMusic streaming.
I am playing the music with:
ChanM=Audio.PlayMusic("asset::TITLEMUSIC.ogg")Before that music has finished, I am stopping the music with:
ChanM.Stop()
(I have also tried adding ChanM.Discard())If I then play a new music track with the following:
ChanM=Audio.PlayMusic("asset::GAMEMUSIC.ogg")The music will start but will be all messed up and glitchy.
If I wait for the first music track to finish and then play a new one its fine.
I have also tried waiting a few seconds after stopping the first track before staring the new music.
Using a different channel variable for a different stream has no effect.Should I be stopping the channel/music a different way?
November 10, 2017 at 12:23 am #11611Yes, channel.Stop() is the way you’re supposed to stop music and your code should work fine.
Can you confirm both pieces of music work OK if they are played first? Ditto do both glitch if played second? How about if you play the same piece of music the first and second time?
Can you send me the music files? My email address is blitzmunter at gmail dot com.
November 10, 2017 at 8:56 am #11615Thanks Mark and I will send you the music files.
Any of the music files work fine if you play them first or wait for the first music track to finish (without a callback for looping).
If I swap the order the first always plays fine and the second one glitches.
If I play the same music after stopping it (not pausing), it glitches.EDIT: Just to add that I have now tried it on both Windows and Mac as well as Debug and Release with the same results.
January 8, 2018 at 9:21 am #12750I’m getting this too using v1.1.09.
January 9, 2018 at 2:25 pm #12779therevills, the problem I had was I was using the MusicWhatever.Discard() which was messing things up. Once I removed that it worked fine (I had missed one in my code) although I have not tried it with 09 yet.
EDIT: Just tried v1.1.09. and it is indeed not working like therevills said.
I deleted my build folders and also rebuilt modules. This is on Mac.
Works fine in 1.1.08. - 
		AuthorPosts
 
You must be logged in to reply to this topic.