Stopping a currently played sound (was: Re: [Newbies] Re: Getting directory path?)

Levente Uzonyi leves at elte.hu
Sun Dec 5 01:08:40 UTC 2010


On Sat, 4 Dec 2010, Kouma wrote:

>
> Hi Levente,
>
> Thank for your reply, but it'd be to pause a new sound, not the playing one.
> Earlier, I played a sound with
> (SampledSound fromWaveFileNamed: 'X:/Music/English/Lemon Tree') play.
>
> by clicking a button 'Play'. Now, with that song being played, I made a
> button called 'Stop' and will use it to stop the currently playing music.

If you store your sound object in a variable or an object, that's 
accessible by the actions of both buttons, then you can send the messages 
(#play and #pause) to the sound object.

If you don't want to store the sound object in your code, then your 
only option is to stop playing all sounds. This can be done by:

SoundPlayer stopPlayingAll.

>
> Should I create a new thing as "current playing music" for the method
> #pause? (we don't have #stop?)

If there were a #stop method, then what would be the difference between 
#pause and #stop?


Levente

> -- 
> View this message in context: http://forum.world.st/Getting-directory-path-tp3071614p3072779.html
> Sent from the Squeak - Beginners mailing list archive at Nabble.com.
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>


More information about the Beginners mailing list