Source/GGBUtils.m
changeset 2 7b0441db81e5
parent 0 e9f7ba4718e1
child 7 428a194e3e59
     1.1 --- a/Source/GGBUtils.m	Fri Mar 07 11:43:02 2008 -0800
     1.2 +++ b/Source/GGBUtils.m	Mon Mar 10 17:32:04 2008 -0700
     1.3 @@ -20,6 +20,10 @@
     1.4  */
     1.5  #import "GGBUtils.h"
     1.6  
     1.7 +#if TARGET_OS_ASPEN
     1.8 +#import <AudioToolbox/AudioToolbox.h>
     1.9 +#endif
    1.10 +
    1.11  
    1.12  void setObj( id *variable, id newValue )
    1.13  {
    1.14 @@ -36,3 +40,28 @@
    1.15          *variable = [(id)newValue copy];
    1.16      }
    1.17  }
    1.18 +
    1.19 +
    1.20 +void PlaySound( NSString* name )
    1.21 +{
    1.22 +#if TARGET_OS_ASPEN
    1.23 +    NSURL *url = [NSURL fileURLWithPath: [@"/Library/Sounds/" stringByAppendingPathComponent: name]];
    1.24 +    SystemSoundID soundID;
    1.25 +    if( AudioServicesCreateSystemSoundID((CFURLRef)url,&soundID) != noErr ) {
    1.26 +        NSLog(@"Couldn't load sound %@",url);
    1.27 +        return;
    1.28 +    }
    1.29 +    AudioServicesPlaySystemSound(soundID);
    1.30 +#else
    1.31 +    [[NSSound soundNamed: name] play];
    1.32 +#endif
    1.33 +}
    1.34 +
    1.35 +void Beep()
    1.36 +{
    1.37 +#if TARGET_OS_ASPEN
    1.38 +    AudioServicesPlaySystemSound(kSystemSoundID_UserPreferredAlert);
    1.39 +#else
    1.40 +    NSBeep();
    1.41 +#endif
    1.42 +}