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

Levente Uzonyi leves at elte.hu
Sat Dec 4 17:10:15 UTC 2010


On Sat, 4 Dec 2010, Kouma wrote:

>
> Thank you, now it raise another problem:
> After playing the sound with SampledSound, I can't stop it midway. The sound
> will be played from start to finish and can't be stop even when I cancel the
> project.
> I didn't find any hint to stop it in SampledSound class. Any idea?

Send #pause to the sound to stop playing it. After that you can use 
#resumePlaying to continue playing the sound where you stopped it, or you 
can send #play again to start playing it from the beginning. For example:

| sound |
sound := PluckedSound chromaticScale.
sound play.
1 seconds asDelay wait.
sound pause.
1 seconds asDelay wait.
sound resumePlaying.
1 seconds asDelay wait.
sound play

This will start playing a chromatic scale. It will pause after a second, 
then after another second it will start playing from where it was stopped. 
Then after a second it will stop and immediately start playing it from the 
beginning.


Levente

>
> Cheers.
> -- 
> View this message in context: http://forum.world.st/Getting-directory-path-tp3071614p3072223.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