Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
SoundChannel:stop() don't stop always... — Gideros Forum

SoundChannel:stop() don't stop always...

GregBUGGregBUG Guru
edited January 2012 in General questions
hey guys i'm "fine tuning" my game
but some time SoundChannel:stop() dosn't stop the sound...

i double checked my code but when game ends i use SoundChannel:stop()

to stop music channel but sometime it's not stop... (i seems random)

but it happens only if compiled and installed and real device (android);

on pc or wifi under android players it works fine...

it's possible that the player and the compiled game behave differently?

has already happened to someone?

thanks.
TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
www.tntengine.com

Comments

  • Sorry, i have no eclipse installed. Have to do this soon.
  • i built and installed music player example, and it works fine.
  • @hnim
    yes me too...

    the examples work fine.. also for me
    it's in my game that don't work ... :(
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • sorry, i cant get that. it works fine when i change scene or press back button.
    how do you loop background music? i use sound:play(0, 1000), is that enough? :D
  • yes i use the same... :((
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • GregBUGGregBUG Guru
    edited January 2012

    Ok. I tried to understand the problem ... because in my game some time sound do not stop...

    i don't know if i misunderstood the use of play, stop and channel system
    but....
    if i use:
    musicTrack = Sound.new("music.mp3")
    musicChannel = musicTrack:play()
    music start and play ok...
    	musicChannel:stop()
    music stop ok.

    but if i start to play two or tree times the music channel with
     musicTrack:play()
     musicTrack:play()
    the music start to play 2 times
    but
     musicTrack:stop()
    the music do not stop...

    but if the channel is in play is not enough just say stop?

    i coded a little example to test:

    http://www.4shared.com/zip/bQxJiZcI/soundTest1.html

    what do you think?
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • atilimatilim Maintainer
    edited January 2012
    If you're creating multiple channels, then you should keep the variables of them separately:
    -- create 2 channels
    musicChannel1 = musicTrack:play()
    musicChannel2 = musicTrack:play()
     
    -- stop these channels
    musicChannel1:stop()
    musicChannel2:stop()
    If you are doing this:
    musicChannel = musicTrack:play()
    musicChannel = musicTrack:play()
     
    musicChannel:stop() --> stop the 2nd channel
    musicChannel:stop() --> does nothing because 2nd channel is not playing already
    you only stop the 2nd channel.

    On the other hand, after your bug report, we've improved the mp3 playing on Android when there are multiple mp3 files loading simultaneously. And after this fix, I haven't seen any mp3 playing issues with your game. Thank you.

    (I cannot connect 4shared.com, you can upload it somewhere else?)
  • gorkemgorkem Maintainer
    @atilim sending you the zip file now
  • GregBUGGregBUG Guru
    edited January 2012
    thanks guys...

    i don't know why but i was thinking that
    musicChannel = musicTrack:play()
    musicChannel = musicTrack:play()
     
    musicChannel:stop()
    musicChannel:stop()
    refer to the same sound channel...
    and that recalling musicChannel = musicTrack:play()
    don't create a new sound channel but stop the previous and restart!!

    but not why passing the channel to play() stop() etc. to avoid unwanted multiple channel play?

    like:
    musicTrack:play(musicChannel)
    musicTrack:stop(musicChannel)
    ?
    :D
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • atilimatilim Maintainer
    edited January 2012
    Oh I see :)

    But you can always stop the previous one and start playing again:
    musicChannel = musicTrack:play() --> start playing
    musicChannel:stop()              --> stop the current playing channel
    musicChannel = musicTrack:play() --> start playing again with the new channel
Sign In or Register to comment.