forked from kybernetyk/Zazen-for-Mac
/
FXAppDelegate.m
55 lines (43 loc) · 1.23 KB
/
FXAppDelegate.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
//
// FXAppDelegate.m
// zazen
//
// Created by Jaroslaw Szpilewski on 2/9/11.
// Copyright (c) 2011 Flux Forge. All rights reserved.
//
#import "FXAppDelegate.h"
#define kGongInterval 60.0f
@interface FXAppDelegate ()
- (void) zazen: (id) something;
@end
@implementation FXAppDelegate {
NSTimer *zazenTimer;
}
@synthesize window = _window;
@synthesize progressIndicator;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
[progressIndicator setMinValue: 0.0];
[progressIndicator setMaxValue: kGongInterval];
[progressIndicator setDoubleValue: kGongInterval];
}
- (IBAction)startTimer:(id)sender {
if (zazenTimer)
return;
zazenTimer = [NSTimer scheduledTimerWithTimeInterval: 0.5f target: self selector: @selector(zazen:) userInfo: nil repeats: YES];
}
- (IBAction)stopTimer:(id)sender {
[zazenTimer invalidate];
zazenTimer = nil;
}
- (void) zazen: (id) something {
if ([progressIndicator doubleValue] >= kGongInterval) {
NSSound *snd = [NSSound soundNamed: @"normal.aif"];
[snd stop]; //don't be retarded and set the interval < len(soundfile)
[snd play];
[progressIndicator setDoubleValue: 0.0];
}
[progressIndicator incrementBy: 0.5];
}
@end