forked from flit/MidiKeys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MidiKeyView.h
76 lines (60 loc) · 1.44 KB
/
MidiKeyView.h
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
//
// MidiKeyView.h
// MidiKeys
//
// Created by Chris Reed on Tue Oct 15 2002.
// Copyright (c) 2002 Chris Reed. All rights reserved.
//
#import <AppKit/AppKit.h>
//! Maximum number of keys to show.
#define KEY_COUNT 120
/*!
* @brief Information about a key on a musical keyboard.
*/
typedef struct _key_info {
int theOctave;
int octaveFirstNote;
int noteInOctave;
int isWhiteKey;
int isBlackKey;
int numWhiteKeys;
int numBlackKeys;
BOOL rightIsInset;
BOOL leftIsInset;
} key_info_t;
/*!
* @brief View class that displays a musical keyboard.
*/
@interface MidiKeyView : NSView
{
id mDelegate;
NSImage *octaveImage;
char midiKeyStates[KEY_COUNT];
BOOL inited;
int numOctaves;
int leftOctaves;
int firstMidiNote;
int lastMidiNote;
NSColor *mHighlightColour;
int mClickedNote;
NSImage *mOctaveDownImage;
NSImage *mOctaveUpImage;
int mOctaveOffset;
BOOL _showKeycaps;
}
- (void)setDelegate:(id)delegate;
- delegate;
- (void)turnMidiNoteOn:(int)note;
- (void)turnMidiNoteOff:(int)note;
- (NSColor *)highlightColour;
- (void)setHighlightColour:(NSColor *)theColour;
- (int)octaveOffset;
- (void)setOctaveOffset:(int)offset;
- (BOOL)showKeycaps;
- (void)setShowKeycaps:(BOOL)show;
@end
@interface NSObject (MidiKeyViewControllerMethods)
- (void)processMidiKeyWithCode:(int)keycode turningOn:(BOOL)isTurningOn;
- (void)processMidiKeyClickWithNote:(int)note turningOn:(BOOL)isTurningOn;
- (NSString *)characterForMidiNote:(int)note;
@end