Wait until the sound is done

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bbalmerTotalFluency
Posts: 84
Joined: Mon Apr 06, 2020 1:19 pm
Contact:

Wait until the sound is done

Post by bbalmerTotalFluency » Tue Jan 11, 2022 9:08 am

Hello:

The code in the subject line is not working for me on OSX Monterey using the livecode audio player object.

Is it me? Is it Monterey? Is it Livecode? I feel like a seagull covered in oil and am wondering if there is a way back to the skies. I've seen nothing on line to tell me what's up or what to do and thus I turn to the learned, the experienced and the helpful.

Bruce

Klaus
Posts: 14190
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Wait until the sound is done

Post by Klaus » Tue Jan 11, 2022 10:15 am

Hi Bruce,

this will only work if you started your sound with -> play audioclip "the_sound.xxx"
It does not work with the player object.


Best

Klaus

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Wait until the sound is done

Post by jmburnod » Tue Jan 11, 2022 11:45 am

Hi Bruce,
What Klaus said
Works also with sound file.
Best
Jean-Marc
https://alternatic.ch

bbalmerTotalFluency
Posts: 84
Joined: Mon Apr 06, 2020 1:19 pm
Contact:

Re: Wait until the sound is done

Post by bbalmerTotalFluency » Tue Jan 11, 2022 1:29 pm

Klaus:

If my life were a hotdog - you would be the mustard relish that makes it all worthwhile. Thank you.

I thought that play had been deprecated and we were meant to use the player object these days?

Should I have been able to find this out for myself or is it just experience on your part?

Bruce

Klaus
Posts: 14190
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Wait until the sound is done

Post by Klaus » Tue Jan 11, 2022 1:46 pm

Hi Bruce,
bbalmerTotalFluency wrote:
Tue Jan 11, 2022 1:29 pm
Klaus:

If my life were a hotdog - you would be the mustard relish that makes it all worthwhile. Thank you.
LOL :-D
You're welcome!
bbalmerTotalFluency wrote:
Tue Jan 11, 2022 1:29 pm
I thought that play had been deprecated and we were meant to use the player object these days?
No, PLAY AC is still supported. But since this only supports a very limited fileformats (UNCOMPRESSED wav and aiff files and the compressed-by-nature AU format, it may be seldom used.
bbalmerTotalFluency wrote:
Tue Jan 11, 2022 1:29 pm
Should I have been able to find this out for myself or is it just experience on your part?
Well, the dictionary does not explicitely mention this anywhere, so "thou shalt be forgiven" for not finding it! :-)


Best

Klaus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Wait until the sound is done

Post by jacque » Tue Jan 11, 2022 6:30 pm

If you want to know when the player is finished you can handle the playStopped message.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Klaus
Posts: 14190
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Wait until the sound is done

Post by Klaus » Tue Jan 11, 2022 6:34 pm

jacque wrote:
Tue Jan 11, 2022 6:30 pm
If you want to know when the player is finished you can handle the playStopped message.
Exactly! :D

And if you need to knwo if the sound really finished you can:

Code: Select all

...
put the duration of player "your sound here" into tDur
put the currenttime of player "your sound here" into tCur
if tDur = tCur then
  ## sound is really "done"
  ## do your thing...
end if
...
Just in case your user can stop the sound manually.

Post Reply