Created
July 9, 2011 23:17
-
-
Save taicki/1074042 to your computer and use it in GitHub Desktop.
copied from somewhere
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Cocoa/Cocoa.h> | |
@interface Delegate : NSObject { } | |
@end | |
@implementation Delegate | |
- (void) sound: (NSSound *) sound didFinishPlaying: (BOOL) aBool | |
{ | |
[[NSApplication sharedApplication] terminate: nil]; | |
} | |
@end | |
int main (int argc, char *argv[]) | |
{ | |
if(argc!=2) { | |
NSLog(@"usage: %s cowbell.wav", argv[0]); | |
exit(1); | |
} | |
[[NSAutoreleasePool alloc] init]; | |
NSSound *sound = [[NSSound alloc] | |
initWithContentsOfFile: | |
[NSString stringWithCString: argv[1]] | |
byReference: YES]; | |
[sound setDelegate: [[[Delegate alloc] init] autorelease]]; | |
[sound play]; | |
[[NSRunLoop currentRunLoop] run]; | |
return 1; // failed | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment