Need best way to make sound when button are touched - Solved

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Need best way to make sound when button are touched - Solved

Post by DR White » Thu Aug 11, 2016 11:38 am

Working to get IOS app approved and need best way (deliver the sound immediately and if possible without using the "Play" command that I am already using to play a mp3 file - I am using LC 8.02) to make sound when buttons are touched.
An example code or guidance on where to find this info would be very much appreciated.

Thanks,

David
Last edited by DR White on Wed Aug 17, 2016 3:22 pm, edited 1 time in total.

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Need best way to make sound when buttons are touched

Post by Mikey » Thu Aug 11, 2016 2:23 pm

on ios you have to include the sounds you want to play, so in the "copy files" standalone setting, you point to them.

Then, you can use something like this:

Code: Select all

on goodbeep howMany
   if howMany is empty then put 1 into howMany
   set the beepSound to path()&"goodbeep.m4a"
   beep howMany
end goodbeep



on badbeep howMany
   if howMany is empty then put 1 into howMany
   set the beepSound to path()&"badbeep.m4a"
   beep howMany
end badbeep



function path
   put the filename of this stack  into tFilename
   set the itemDelimiter to slash
   put item 1 to -2 of tFilename & slash into tPath
   return tPath
end path

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: Need best way to make sound when buttons are touched

Post by DR White » Wed Aug 17, 2016 3:21 pm

Mikey,

That works GREAT!!

Thanks,

David

Post Reply