vvopensource
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
VVMIDIManager.h
1 
2 #import <Cocoa/Cocoa.h>
3 #import <CoreMIDI/CoreMIDI.h>
4 #import <VVBasics/VVBasics.h>
5 #import <pthread.h>
6 #import "VVMIDINode.h"
7 
8 
9 
10 
11 @protocol VVMIDIDelegateProtocol
12 - (void) setupChanged;
13 - (void) receivedMIDI:(NSArray *)a fromNode:(VVMIDINode *)n;
14 @end
15 
16 
17 
18 
19 @interface VVMIDIManager : NSObject <VVMIDIDelegateProtocol> {
20  MutLockArray *sourceArray; // array of VVMIDINode objects (sources i can receive from)
21  MutLockArray *destArray; // array of VVMIDINode objects (destinations i can send to)
22 
23  VVMIDINode *virtualSource; // a dedicated receiver other apps can send to
24  VVMIDINode *virtualDest; // a dedicated source other apps can receive from
25 
26  id delegate;
27 }
28 
29 - (void) generalInit;
30 
31 - (NSMutableDictionary *) createSnapshot;
32 - (void) loadSnapshot:(NSDictionary *)d;
33 
34 - (void) loadMIDIInputSources;
35 - (void) loadMIDIOutputDestinations;
36 - (void) createVirtualNodes; // subclass around this to create a virtual destination with a different name
37 
38 - (void) setupChanged; // called when a midi device is plugged in or unplugged
39 - (void) receivedMIDI:(NSArray *)a;
40 - (void) receivedMIDI:(NSArray *)a fromNode:(VVMIDINode *)n; // called when one of my sources has midi data to hand off to me
41 
42 - (void) sendMsg:(VVMIDIMessage *)m;
43 - (void) sendMsgs:(NSArray *)a;
44 
45 - (VVMIDINode *) findDestNodeNamed:(NSString *)n; // finds a destination node with a given name
46 - (VVMIDINode *) findDestNodeWithFullName:(NSString *)n; // finds a destination node with a given name
47 - (VVMIDINode *) findDestNodeWithModelName:(NSString *)n;
48 - (VVMIDINode *) findDestNodeWithDeviceName:(NSString *)n;
49 - (VVMIDINode *) findSourceNodeNamed:(NSString *)n; // finds a source node with a given name
50 - (VVMIDINode *) findSourceNodeWithFullName:(NSString *)n;
51 - (VVMIDINode *) findSourceNodeWithModelName:(NSString *)n;
52 - (VVMIDINode *) findSourceNodeWithDeviceName:(NSString *)n;
53 
54 // Generates and returns an array of strings which correspond to the labels of this manager's out ports
55 - (NSArray *) destNodeNameArray;
56 - (NSArray *) destNodeFullNameArray;
57 - (NSArray *) sourceNodeNameArray;
58 - (NSArray *) sourceNodeFullNameArray;
59 - (NSArray *) deviceNameArray;
60 
61 // these methods exist so subclasses of me can override them to use custom subclasses of VVMIDINode
62 - (id) receivingNodeClass;
63 - (id) sendingNodeClass;
64 // these methods exist so subclasses of me can override them to change the name of the default midi destinations/receivers
65 - (NSString *) receivingNodeName;
66 - (NSString *) sendingNodeName;
67 
68 - (MutLockArray *) sourceArray;
69 - (MutLockArray *) destArray;
70 - (VVMIDINode *) virtualSource;
71 - (VVMIDINode *) virtualDest;
72 - (id) delegate;
73 - (void) setDelegate:(id)n;
74 
75 @end
Similar to NSMutableArray, but thread-safe. Internally, uses an NSMutableArray and a rwlock...
Definition: MutLockArray.h:20