iPhone audio calls

Paul Hibbert lc at pbh.on-rev.com
Tue Feb 21 09:26:33 EST 2012


As with most things in LiveCode there are many ways to tackle most problems, I haven't done any mobile development yet, but I assume the custom properties work the same, if so a quick fix for this could be to use a custom property that is set to true on preOpenStack and then check that custom property at each command, something like...

--Stack Script
on preOpenStack
    if the environment is "mobile" then set the cMobile of this stack to "true"
end preOpenStack

on closeStack
    set the cMobile of this stack to empty // avoids the stack being saved with the custom property set to true
end closeStack
--

then your command could be…

--Control script
if the cMobile of this stack then iPhoneSetSoundChannelVolume "Ch_1","80"
--

You could fix most of this with a find & replace for the whole stack by finding "iPhoneSetSoundChannelVolume" and replacing with "if the cMobile of this stack then iPhoneSetSoundChannelVolume"

I'm not saying this is the best approach, but it should work and is very quick and easy to implement or remove.

Paul


On 21 Feb 2012, at 11:49, Richard MacLemale wrote:

> In our latest app (which is for iOS) we use a lot of iphone audio calls to set volume channels and play sounds, like:
> 
> iPhoneSetSoundChannelVolume "Ch_1","80"
> 
> and so on.  The annoying thing is that since the Mac doesn't understand those commands, you get nonstop errors in the development environment unless you do something like:
> 
> if the environment is "mobile" then
>   iPhoneSetSoundChannelVolume "Ch_1","80"
> end if
> 
> This gets tedious when you have dozens of audio calls throughout an app.  Does anyone have a more clever way to do this?  Now that our latest app is practically done, I don't feel like rewriting all of those calls, but next time I'm thinking maybe I write a handler for it like:
> 
> on callAudio daSound daChannel
>   if the environment is "mobile" then
>      iPhonePlaySoundOnChannel daSound, daChannel, "now"
>   else
>      -- do nothing
>   end if
> end callAudio
> 
> Is that the best method, or would there be a better way?  It's a small thing but it would be nice if LiveCode just ignored these calls or something...
> 
> ---
> Richard MacLemale
> Music = http://www.richardmac.com
> Programming = http://www.macandchee.se
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list