Skip to content

Commit c2e2595

Browse files
committed
small updates
version bump (0.4.3.2)- notarization and signing updates for catalina
1 parent 6ee6f49 commit c2e2595

File tree

9 files changed

+292
-29
lines changed

9 files changed

+292
-29
lines changed

MIDIOSCQueryHelper/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
<key>CFBundlePackageType</key>
3535
<string>APPL</string>
3636
<key>CFBundleShortVersionString</key>
37-
<string>0.4.3.0</string>
37+
<string>0.4.3.2</string>
3838
<key>CFBundleVersion</key>
39-
<string>0.4.3.0</string>
39+
<string>0.4.3.2</string>
4040
<key>LSMinimumSystemVersion</key>
4141
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
4242
<key>NSHumanReadableCopyright</key>

MIDIOSCQueryHelper/MIDIOSCQueryHelperAppDelegate.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
#import "MOQHMIDIManager.h"
55
#import "VVKQueueCenter.h"
66

7-
@interface MIDIOSCQueryHelperAppDelegate : NSObject <NSApplicationDelegate,VVOSCQueryServerDelegate,VVKQueueCenterDelegate> {
7+
@interface MIDIOSCQueryHelperAppDelegate : NSObject <NSApplicationDelegate,VVOSCQueryServerDelegate,VVKQueueCenterDelegate,VVMIDIDelegateProtocol> {
88
IBOutlet MOQHOSCManager *oscm; // osc manager- creates an OSC input, messages sent to that input are dispatched to the address space
99
IBOutlet MOQHMIDIManager *midim; // midi manager- creates a virtual destination (appears as a device to other apps) and also lets the user select a destination. MIDI messages will be sent to both.
1010

1111
NSMutableArray *delegates; // array of QueryServerNodeDelegate instances. each of these is a delegate of an OSCNode (the node gets a message and passes it to its delegate)
12+
NSMutableDictionary *midiAddressToOSCAddressDict; // key is MIDI address, value is an NSMutableArray containing the OSC addresses that correspond to the key
1213

1314
NSString *loadedFilePath; // the path of the currently loaded file.
1415
IBOutlet NSTextField *fileStatusField; // this displays the name of the currently-loaded file in the UI

MIDIOSCQueryHelper/MIDIOSCQueryHelperAppDelegate.m

Lines changed: 136 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ - (id) init {
5555
[[NSNotificationCenter defaultCenter] removeObserver:as name:NSApplicationWillTerminateNotification object:nil];
5656

5757
delegates = [[NSMutableArray alloc] init];
58+
midiAddressToOSCAddressDict = [[NSMutableDictionary alloc] init];
5859
loadedFilePath = nil;
5960
fileChangeCoalesceTimer = nil;
6061

@@ -75,6 +76,9 @@ - (id) init {
7576
}
7677
return self;
7778
}
79+
- (void) awakeFromNib {
80+
[self->midim setDelegate:self];
81+
}
7882
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
7983
// check to see if there's a "SampleDocument.json" in ~/Documents/OSCQuery Helper
8084
NSFileManager *fm = [NSFileManager defaultManager];
@@ -117,6 +121,7 @@ - (void)applicationWillTerminate:(NSNotification *)aNotification {
117121
[as removeDelegate:tmpDelegate forPath:[tmpDelegate address]];
118122
}
119123
[delegates removeAllObjects];
124+
[midiAddressToOSCAddressDict removeAllObjects];
120125
}
121126
- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename {
122127
NSLog(@"%s ... %@",__func__,filename);
@@ -324,6 +329,9 @@ - (BOOL) _loadAbletonProject:(NSString *)fullPath {
324329
}
325330
[delegates removeAllObjects];
326331

332+
// clear out the midi-address-to-osc-address mapping dict
333+
[midiAddressToOSCAddressDict removeAllObjects];
334+
327335
// clear out the OSC address space
328336
NSArray *baseNodes = [[as nodeContents] lockCreateArrayCopy];
329337
for (OSCNode *baseNode in baseNodes) {
@@ -436,6 +444,14 @@ - (BOOL) _loadAbletonProject:(NSString *)fullPath {
436444
}
437445
[newNode addDelegate:tmpDelegate];
438446
[self->delegates addObject:tmpDelegate];
447+
448+
NSMutableArray *tmpArray = nil;
449+
tmpArray = [self->midiAddressToOSCAddressDict objectForKey:[tmpDelegate midiTypeAsString]];
450+
if (tmpArray == nil) {
451+
tmpArray = [[NSMutableArray alloc] init];
452+
[self->midiAddressToOSCAddressDict setObject:tmpArray forKey:[tmpDelegate midiTypeAsString]];
453+
}
454+
[tmpArray addObject:objFullPath];
439455
}
440456

441457
// run through the contents, calling this block recursively on each object
@@ -495,6 +511,9 @@ - (BOOL) _loadJSONFile:(NSString *)fullPath {
495511
}
496512
[delegates removeAllObjects];
497513

514+
// clear out the midi-address-to-osc-address mapping dict
515+
[midiAddressToOSCAddressDict removeAllObjects];
516+
498517
// clear out the OSC address space
499518
NSArray *baseNodes = [[as nodeContents] lockCreateArrayCopy];
500519
for (OSCNode *baseNode in baseNodes) {
@@ -570,7 +589,7 @@ - (BOOL) _loadJSONFile:(NSString *)fullPath {
570589
[newNode setExtendedType:objExtType];
571590
//if (objAccess != nil && [objAccess isKindOfClass:[NSNumber class]]) {
572591
//[newNode setAccess:[objAccess intValue]]; // don't do this, access is always write-only in this application (we can't read the remote app's OSC address space)
573-
[newNode setAccess:2];
592+
[newNode setAccess:3];
574593
//}
575594
if (objRange != nil && [objRange isKindOfClass:[NSArray class]])
576595
[newNode setRange:objRange];
@@ -601,6 +620,14 @@ - (BOOL) _loadJSONFile:(NSString *)fullPath {
601620
}
602621
[newNode addDelegate:tmpDelegate];
603622
[self->delegates addObject:tmpDelegate];
623+
624+
NSMutableArray *tmpArray = nil;
625+
tmpArray = [self->midiAddressToOSCAddressDict objectForKey:[tmpDelegate midiTypeAsString]];
626+
if (tmpArray == nil) {
627+
tmpArray = [[NSMutableArray alloc] init];
628+
[self->midiAddressToOSCAddressDict setObject:tmpArray forKey:[tmpDelegate midiTypeAsString]];
629+
}
630+
[tmpArray addObject:baseObjPath];
604631
}
605632

606633
// run through the contents, calling this block recursively on each object
@@ -699,6 +726,111 @@ - (void) targetAppHostInfoChangedNotification:(NSNotification *)note {
699726
}
700727

701728

729+
#pragma mark -------------------------- VVMIDIDelegate
730+
731+
732+
- (void) setupChanged {
733+
//NSLog(@"%s",__func__);
734+
}
735+
- (void) receivedMIDI:(NSArray *)a fromNode:(VVMIDINode *)n {
736+
//if ([a count]==1)
737+
// NSLog(@"%s ... %@, %@",__func__,[a objectAtIndex:0],n);
738+
//else
739+
// NSLog(@"%s ... %@, %@",__func__,a,n);
740+
741+
OSCAddressSpace *as = [OSCAddressSpace mainAddressSpace];
742+
// run through the midi messages
743+
for (VVMIDIMessage *msg in a) {
744+
// create a midi string that describes the msg- this is the key in 'midiAddressToOSCAddressDict'
745+
NSString *midiMsgKey = [QueryServerNodeDelegate stringForMidiChannel:[msg channel] type:[msg type] voice:[msg data1]];
746+
// get the array of osc destinations that correspond to this address- run through each osc destination
747+
NSArray *oscDests = [midiAddressToOSCAddressDict objectForKey:midiMsgKey];
748+
// get a normalized double value for the MIDI message, we'll use it later to calculate a non-normalized val
749+
double normMIDIVal = [msg doubleValue];
750+
751+
// run through every OSC address that this MIDI address is associated with
752+
for (NSString *oscDest in oscDests) {
753+
// get the OSC node for this address
754+
OSCNode *tmpNode = [as findNodeForAddress:oscDest createIfMissing:NO];
755+
if (tmpNode == nil)
756+
continue;
757+
// make a new OSC message- this is what we're going to populate, and dispatch to the server
758+
OSCMessage *newMsg = [OSCMessage createWithAddress:oscDest];
759+
NSArray *ranges = [tmpNode range];
760+
NSDictionary *range = (ranges==nil || [ranges count]!=1) ? nil : [ranges objectAtIndex:0];
761+
double nonNormVal = normMIDIVal;
762+
if (range == nil) {
763+
nonNormVal = normMIDIVal;
764+
}
765+
else {
766+
NSNumber *tmpMin = [range objectForKey:@"MIN"];
767+
NSNumber *tmpMax = [range objectForKey:@"MAX"];
768+
if (tmpMin == nil || tmpMax == nil) {
769+
nonNormVal = normMIDIVal;
770+
}
771+
else {
772+
double tmpMinVal = [tmpMin doubleValue];
773+
double tmpMaxVal = [tmpMax doubleValue];
774+
nonNormVal = (normMIDIVal * (tmpMaxVal-tmpMinVal)) + tmpMinVal;
775+
}
776+
}
777+
NSString *nodeType = [tmpNode typeTagString];
778+
unichar nodeTypeChar = (nodeType==nil) ? 'f' : [nodeType characterAtIndex:0];
779+
switch (nodeTypeChar) {
780+
case 'i':
781+
[newMsg addInt:(int)nonNormVal];
782+
break;
783+
case 'f':
784+
[newMsg addFloat:(float)nonNormVal];
785+
break;
786+
//case 's':
787+
//case 'S':
788+
// break;
789+
case 'd':
790+
[newMsg addDouble:nonNormVal];
791+
break;
792+
//case 'c':
793+
// break;
794+
//case 'r':
795+
// break;
796+
case 'T': // true
797+
[newMsg addValue:[OSCValue createWithBool:YES]];
798+
break;
799+
case 'F': // false
800+
[newMsg addValue:[OSCValue createWithBool:NO]];
801+
break;
802+
case 'N': // nil
803+
[newMsg addValue:[OSCValue createWithNil]];
804+
break;
805+
case 'I': // infinity
806+
[newMsg addValue:[OSCValue createWithInfinity]];
807+
break;
808+
case 'h': // 64 bit int
809+
[newMsg addValue:[OSCValue createWithLongLong:(long long)nonNormVal]];
810+
break;
811+
case '[':
812+
case ']':
813+
break;
814+
//case 'b': // blob
815+
// break;
816+
//case 't': // time tag
817+
// break;
818+
//case 'm': // midi
819+
// break;
820+
}
821+
822+
// ...at this point i've populated the OSC message- pass it back to the query server so anything listening to it will get it
823+
824+
OSCPacket *newPacket = [OSCPacket createWithContent:newMsg];
825+
[server
826+
sendOSCPacketData:[newPacket payload]
827+
sized:[newPacket bufferLength]
828+
toClientsListeningToOSCAddress:oscDest];
829+
}
830+
}
831+
}
832+
833+
702834
#pragma mark -------------------------- VVKQueueCenterDelegate
703835

704836

@@ -742,7 +874,6 @@ - (VVOSCQueryReply *) hostInfoQueryFromServer:(VVOSCQueryServer *)s {
742874
// supply an extensions array if there isn't already one
743875
NSDictionary *extDict = @{
744876
kVVOSCQ_OptAttr_Tags : @YES,
745-
//kVVOSCQ_ReqAttr_Type : @YES,
746877
kVVOSCQ_OptAttr_Access : @YES,
747878
kVVOSCQ_OptAttr_Value : @YES,
748879
kVVOSCQ_OptAttr_Range : @YES,
@@ -751,8 +882,8 @@ - (VVOSCQueryReply *) hostInfoQueryFromServer:(VVOSCQueryServer *)s {
751882
kVVOSCQ_OptAttr_Critical : @NO,
752883
kVVOSCQ_OptAttr_Overloads : @NO,
753884
kVVOSCQ_OptAttr_HTML : @YES,
754-
kVVOSCQ_WSAttr_Cmd_Listen : @NO,
755-
kVVOSCQ_WSAttr_Cmd_Ignore : @NO,
885+
kVVOSCQ_WSAttr_Cmd_Listen : @YES,
886+
kVVOSCQ_WSAttr_Cmd_Ignore : @YES,
756887
kVVOSCQ_WSAttr_Cmd_PathChanged : @YES,
757888
kVVOSCQ_WSAttr_Cmd_PathRenamed : @NO,
758889
kVVOSCQ_WSAttr_Cmd_PathRemoved : @NO,
@@ -800,7 +931,7 @@ - (void) server:(VVOSCQueryServer *)s receivedOSCPacket:(const void*)packet size
800931
- (BOOL) server:(VVOSCQueryServer *)s wantsToListenTo:(NSString *)address {
801932
//NSLog(@"%s ... %@, %@",__func__,s,address);
802933
// intentionally blank- we can't stream values because we don't have direct access to the remote app's address space (or data model corresponding to an address space)
803-
return NO;
934+
return YES;
804935
}
805936
- (void) server:(VVOSCQueryServer *)s wantsToIgnore:(NSString *)address {
806937
//NSLog(@"%s ... %@, %@",__func__,s,address);

MIDIOSCQueryHelper/MOQHMIDIManager.m

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,6 @@ - (void) awakeFromNib {
1818
lastSelectedName = tmpString;
1919
}
2020
}
21-
- (void) createVirtualNodes {
22-
//NSLog(@"%s",__func__);
23-
24-
// we only want to create the "sender" virtual node (the one that pretends i'm a "MIDI device")
25-
26-
/*
27-
make the sender- this node "owns" the destination: it is responsible for telling
28-
any endpoints connected to this destination that it has received midi data
29-
*/
30-
if (virtualDest != nil) {
31-
virtualDest = nil;
32-
}
33-
virtualDest = [[[self sendingNodeClass] alloc] initSenderWithName:[self sendingNodeName]];
34-
if (virtualDest != nil)
35-
[virtualDest setDelegate:self];
36-
}
3721
- (void) setupChanged {
3822
//NSLog(@"%s",__func__);
3923
[super setupChanged];

MIDIOSCQueryHelper/QueryServerNodeDelegate.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
double maxVal;
2828
}
2929

30+
+ (NSString *) stringForMidiChannel:(int)mc type:(VVMIDIMsgType)mt voice:(int)mv;
31+
3032
- (id) initWithMIDIManager:(VVMIDIManager *)n forAddress:(NSString *)a;
3133

3234
// once we compose a VVMIDIMessage, pass it to this method to dispatch it to the appropriate MIDI devices
@@ -44,4 +46,6 @@
4446
@property BOOL hasMax;
4547
@property double maxVal;
4648

49+
- (NSString *) midiTypeAsString;
50+
4751
@end

MIDIOSCQueryHelper/QueryServerNodeDelegate.m

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ - (void) node:(id)n receivedOSCMessage:(OSCMessage *)msg {
7474
}
7575
else {
7676
msgNormVal = [oscVal calculateDoubleValue];
77-
msgIntVal = [oscVal calculateIntValue];
77+
//msgIntVal = [oscVal calculateIntValue];
78+
msgIntVal = msgNormVal * 127.0;
7879
}
7980
break;
8081
case OSCValBool:
@@ -180,4 +181,88 @@ - (void) nodeDeleted:(id)node {
180181
@synthesize maxVal;
181182

182183

184+
+ (NSString *) stringForMidiChannel:(int)mc type:(VVMIDIMsgType)mt voice:(int)mv {
185+
switch (mt) {
186+
// status byte
187+
case VVMIDINoteOffVal:
188+
case VVMIDINoteOnVal:
189+
return [NSString stringWithFormat:@"ch.%hhd,Note%hhd",mc+1,mv];
190+
break;
191+
case VVMIDIAfterTouchVal:
192+
return [NSString stringWithFormat:@"ch.%hhd,Aftertouch",mc+1];
193+
break;
194+
case VVMIDIControlChangeVal:
195+
return [NSString stringWithFormat:@"ch.%hhd,CC%hhd",mc+1,mv];
196+
break;
197+
case VVMIDIProgramChangeVal:
198+
return [NSString stringWithFormat:@"ch.%hhd,PgmChg",mc+1];
199+
break;
200+
case VVMIDIChannelPressureVal:
201+
return [NSString stringWithFormat:@"ch.%hhd,ChPrs",mc+1];
202+
break;
203+
case VVMIDIPitchWheelVal:
204+
return [NSString stringWithFormat:@"ch.%hhd,PtchWhl",mc+1];
205+
break;
206+
// common messages
207+
case VVMIDIMTCQuarterFrameVal:
208+
return [NSString stringWithFormat:@"ch.%hhd,QrtrFrm",mc+1];
209+
break;
210+
case VVMIDISongPosPointerVal:
211+
return [NSString stringWithFormat:@"ch.%hhd,SPP",mc+1];
212+
break;
213+
case VVMIDISongSelectVal:
214+
return [NSString stringWithFormat:@"ch.%hhd,SS",mc+1];
215+
break;
216+
case VVMIDIUndefinedCommon1Val:
217+
return @"Undefined common";
218+
break;
219+
case VVMIDIUndefinedCommon2Val:
220+
return @"Undefined common 2";
221+
break;
222+
case VVMIDITuneRequestVal:
223+
return @"Tune Request";
224+
break;
225+
// sysex!
226+
case VVMIDIBeginSysexDumpVal:
227+
return @"Sysex";
228+
break;
229+
// realtime messages- insert these immediately
230+
case VVMIDIClockVal:
231+
return @"Clock";
232+
break;
233+
case VVMIDITickVal:
234+
return @"Tick";
235+
break;
236+
case VVMIDIStartVal:
237+
return @"Start";
238+
break;
239+
case VVMIDIContinueVal:
240+
return @"Continue";
241+
break;
242+
case VVMIDIStopVal:
243+
return @"Stop";
244+
break;
245+
case VVMIDIUndefinedRealtime1Val:
246+
return @"Undefined Realtime";
247+
break;
248+
case VVMIDIActiveSenseVal:
249+
return @"Active Sense";
250+
break;
251+
case VVMIDIResetVal:
252+
return @"MIDI Reset";
253+
break;
254+
case VVMIDIMsgUnknown:
255+
return @"Unkn";
256+
break;
257+
case VVMIDIEndSysexDumpVal:
258+
return @"SysexEnd";
259+
break;
260+
}
261+
return @"???";
262+
}
263+
- (NSString *) midiTypeAsString {
264+
return [QueryServerNodeDelegate stringForMidiChannel:midiChannel type:midiMsgType voice:midiVoice];
265+
}
266+
267+
183268
@end

0 commit comments

Comments
 (0)