Best method to stop PlayMusic

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.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #11598

    bigand
    Participant

    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?

    #11611

    Mark Sibly
    Keymaster

    Yes, 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.

    #11615

    bigand
    Participant

    Thanks 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.

    #12750

    therevills
    Participant

    I’m getting this too using v1.1.09.

    #12779

    bigand
    Participant

    therevills, 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.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.