Creating system sounds

Apprentice
Posts: 17
Joined: 2010.01
Post: #1
I have 4 view controller classes and I need to have all my sound effects accessible to each view controller, does anyone know how to do that.
Quote this message in a reply
Moderator
Posts: 3,571
Joined: 2003.06
Post: #2
Use global variables! Make a globals.h file:

Code:
extern int mySoundID;

Make a globals.c file:

Code:
int mySoundID;

Include globals.h in whatever needs access to those sounds.

There are, of course, many different ways to use globals. They could be maintained in your sound engine just as well, but this is a trivial problem to solve with globals.
Quote this message in a reply
Apprentice
Posts: 17
Joined: 2010.01
Post: #3
Did you mean a global.m file? Is there any sample code that you could point me to?
Quote this message in a reply
Moderator
Posts: 3,571
Joined: 2003.06
Post: #4
Sure you can name it .m too, it doesn't matter. The code I posted above *was* the sample code Wink
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Releasing System sounds MacSteve85 3 2,393 Jan 30, 2010 06:15 PM
Last Post: MacSteve85