Yes create a command that does the same thing. have it check the environment first. Now you have a one liner you can call in your code. The principle applies to ALL programming: If you use a bit of code repeatedly, create a command or function for it.
Bob On Feb 21, 2012, at 3:49 AM, 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@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode