#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
@interface SPSoundEffect : NSObject {
}
-(void) playWithWavFileName:(NSString *)fileName;
@end
#import "SPSoundEffect.h"
@implementation SPSoundEffect
- (void)playWithWavFileName:(NSString *)fileName
{
NSString *fpath = [[NSBundlemainBundle] pathForResource:fileName ofType:@"wav"];
SystemSoundID ssound;
AudioServicesCreateSystemSoundID((CFURLRef)[NSURLfileURLWithPath:fpath], &ssound);
AudioServicesPlaySystemSound(ssound);
}
@end
댓글 없음:
댓글 쓰기