-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathHotkeyAction.m
58 lines (49 loc) · 867 Bytes
/
HotkeyAction.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
//
// HotkeyAction.m
// Kimidi
//
// Created by Richard Schreiber on 19.09.11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "HotkeyAction.h"
@implementation HotkeyAction
- (void) setController: (MIDIController *) c
{
controller = c;
}
- (void) setChannel: (int) c
{
channel = c;
}
- (void) setKey: (int) k
{
key = k;
}
- (void) setValue: (int) v
{
value = v;
}
- (void) pressed
{
//NSLog(@"HotKey pressed");
[self execute];
}
- (void) released
{
NSLog(@"HotKey released");
//NSLog(timer);
// if this is a note-on event (first byte is 0x9), then send note-off (0x80)
if ((channel == 0x90) | 0)
{
// send note off event
[controller send:0x80:key:0];
}
}
- (void) execute
{
NSLog(@"HotKey action");
NSLog(@"MIDI-message: %d", key);
//[controller sendMIDINote:1:127];
[controller send:channel:key:value];
}
@end