-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCaculatorResource.m
77 lines (59 loc) · 2.51 KB
/
CaculatorResource.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//
// CaculatorResource.m
// dbm-mw-caculator
//
// Created by Patrick Deng on 13-2-18.
// Copyright (c) 2013年 Code Animal. All rights reserved.
//
#import "CaculatorResource.h"
static SystemSoundID s_caculatorButtonClickSoundID;
static SystemSoundID s_saveButtonClickSoundID;
static SystemSoundID s_switchButtonClickSoundID;
static SystemSoundID s_historyButtonClickSoundID;
static SystemSoundID s_helpButtonClickSoundID;
static NSString* s_localStoredFileFullName;
@implementation CaculatorResource
+(void) initialize
{
NSString* buttonWavPath = [[NSBundle mainBundle] pathForResource:@"button" ofType:@"wav"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:buttonWavPath], &s_caculatorButtonClickSoundID);
NSString* helpWavPath = [[NSBundle mainBundle] pathForResource:@"help" ofType:@"wav"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:helpWavPath], &s_helpButtonClickSoundID);
NSString* historyWavPath = [[NSBundle mainBundle] pathForResource:@"history" ofType:@"wav"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:historyWavPath], &s_historyButtonClickSoundID);
NSString* saveWavPath = [[NSBundle mainBundle] pathForResource:@"save" ofType:@"wav"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:saveWavPath], &s_saveButtonClickSoundID);
NSString* switchWavPath = [[NSBundle mainBundle] pathForResource:@"switch" ofType:@"wav"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:switchWavPath], &s_switchButtonClickSoundID);
NSString *Path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
s_localStoredFileFullName = [Path stringByAppendingPathComponent:LOCAL_STORE_FILE];
}
+(NSString*) localStoreFileFullName
{
return s_localStoredFileFullName;
}
+(void) playCaculatorButtonClickSound
{
AudioServicesPlaySystemSound(s_caculatorButtonClickSoundID);
}
+(void) playHelpButtonClickSound
{
AudioServicesPlaySystemSound(s_caculatorButtonClickSoundID);
}
+(void) playHistoryButtonClickSound
{
AudioServicesPlaySystemSound(s_caculatorButtonClickSoundID);
}
+(void) playSaveButtonClickSound
{
AudioServicesPlaySystemSound(s_caculatorButtonClickSoundID);
}
+(void) playSwitchButtonClickSound
{
AudioServicesPlaySystemSound(s_caculatorButtonClickSoundID);
}
+(void) playFormatButtonClickSound
{
AudioServicesPlaySystemSound(s_caculatorButtonClickSoundID);
}
@end