Page 1 of 1

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

Posted: Thu Aug 11, 2016 11:38 am
by DR White
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

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

Posted: Thu Aug 11, 2016 2:23 pm
by Mikey
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

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

Posted: Wed Aug 17, 2016 3:21 pm
by DR White
Mikey,

That works GREAT!!

Thanks,

David