Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Extracting out stuff that will be shared with the receiver patch

  • Loading branch information...
commit 3ffcfbb940a33e46737cbda5431aa0304376e3e2 1 parent 77fcd5a
Jonathan del Strother authored
View
14 BBOSC.xcodeproj/project.pbxproj
@@ -30,8 +30,9 @@
FC5209AC1056853800FE3004 /* BBOSCPluginReceiver.m in Sources */ = {isa = PBXBuildFile; fileRef = FC5209AB1056853800FE3004 /* BBOSCPluginReceiver.m */; };
FC520AD61056B6F200FE3004 /* BWToolkitFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC520AD51056B6F200FE3004 /* BWToolkitFramework.framework */; };
FC520AD91056B6FD00FE3004 /* BWToolkitFramework.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = FC520AD51056B6F200FE3004 /* BWToolkitFramework.framework */; };
- FC520B0A1056B90000FE3004 /* BBOSCSender.xib in Resources */ = {isa = PBXBuildFile; fileRef = FC520AC11056B56400FE3004 /* BBOSCSender.xib */; };
+ FC520B0A1056B90000FE3004 /* BBOSCSettings.xib in Resources */ = {isa = PBXBuildFile; fileRef = FC520AC11056B56400FE3004 /* BBOSCSettings.xib */; };
FC520BFC1057E69B00FE3004 /* NSArrayExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = FC520BFB1057E69B00FE3004 /* NSArrayExtensions.m */; };
+ FC520CFB1058085100FE3004 /* BBOSCViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FC520CFA1058085100FE3004 /* BBOSCViewController.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -116,10 +117,12 @@
FC52093910567D6200FE3004 /* Target-QCPlugin.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "Target-QCPlugin.xcconfig"; path = "/Code/Config/Target-QCPlugin.xcconfig"; sourceTree = "<absolute>"; };
FC5209AA1056853800FE3004 /* BBOSCPluginReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BBOSCPluginReceiver.h; sourceTree = "<group>"; };
FC5209AB1056853800FE3004 /* BBOSCPluginReceiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BBOSCPluginReceiver.m; sourceTree = "<group>"; };
- FC520AC11056B56400FE3004 /* BBOSCSender.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BBOSCSender.xib; sourceTree = "<group>"; };
+ FC520AC11056B56400FE3004 /* BBOSCSettings.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BBOSCSettings.xib; sourceTree = "<group>"; };
FC520AD51056B6F200FE3004 /* BWToolkitFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = BWToolkitFramework.framework; path = lib/BWToolkitFramework.framework; sourceTree = "<group>"; };
FC520BFA1057E69B00FE3004 /* NSArrayExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSArrayExtensions.h; sourceTree = "<group>"; };
FC520BFB1057E69B00FE3004 /* NSArrayExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSArrayExtensions.m; sourceTree = "<group>"; };
+ FC520CF91058085100FE3004 /* BBOSCViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BBOSCViewController.h; sourceTree = "<group>"; };
+ FC520CFA1058085100FE3004 /* BBOSCViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BBOSCViewController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -165,7 +168,7 @@
isa = PBXGroup;
children = (
8D5B49B7048680CD000E48DA /* Info.plist */,
- FC520AC11056B56400FE3004 /* BBOSCSender.xib */,
+ FC520AC11056B56400FE3004 /* BBOSCSettings.xib */,
);
name = Resources;
sourceTree = "<group>";
@@ -179,6 +182,8 @@
FC5209AB1056853800FE3004 /* BBOSCPluginReceiver.m */,
FC520BFA1057E69B00FE3004 /* NSArrayExtensions.h */,
FC520BFB1057E69B00FE3004 /* NSArrayExtensions.m */,
+ FC520CF91058085100FE3004 /* BBOSCViewController.h */,
+ FC520CFA1058085100FE3004 /* BBOSCViewController.m */,
);
name = Classes;
sourceTree = "<group>";
@@ -313,7 +318,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- FC520B0A1056B90000FE3004 /* BBOSCSender.xib in Resources */,
+ FC520B0A1056B90000FE3004 /* BBOSCSettings.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -343,6 +348,7 @@
16BA95420A7EB2EB001E4983 /* BBOSCPlugInSender.m in Sources */,
FC5209AC1056853800FE3004 /* BBOSCPluginReceiver.m in Sources */,
FC520BFC1057E69B00FE3004 /* NSArrayExtensions.m in Sources */,
+ FC520CFB1058085100FE3004 /* BBOSCViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
6 BBOSCPlugInSender.h
@@ -8,12 +8,6 @@
#import <Quartz/Quartz.h>
-@interface BBOSCPlugInSenderViewController : QCPlugInViewController {}
-@property (nonatomic, readonly, assign) IBOutlet NSPopUpButton* portTypeDropDown;
-@property (nonatomic, readonly, assign) IBOutlet NSArrayController* portArrayController;
--(IBAction)addNewPort:(id)sender;
-@end
-
@class OSCManager, OSCOutPort;
@interface BBOSCPlugInSender : QCPlugIn {
View
92 BBOSCPlugInSender.m
@@ -10,25 +10,13 @@
#import <OpenGL/CGLMacro.h>
#import "vvosc/FrameworkSrc/VVOSC.h"
+#import "BBOSCViewController.h"
#import "BBOSCPlugInSender.h"
#import "NSArrayExtensions.h"
#define kQCPlugIn_Name @"BBOSC Sender"
#define kQCPlugIn_Description @"Best Before Open Sound Control sender plugin"
-NSString* BBOSCTypeKey=@"BBOSCType";
-NSString* BBOSCPortKey=@"BBOSCPortKey";
-
-typedef enum {
- BBOSCTypeInt,
- BBOSCTypeFloat,
- BBOSCTypeBool,
- BBOSCTypeString,
- BBOSCTypeArrayOfInt,
- BBOSCTypeArrayOfFloat,
- BBOSCTypeArrayOfBool,
- BBOSCTypeCount
-} BBOSCType;
@interface OSCMessage(BBExtensions)
-(void)addNSValue:(id)newValue withBias:(BBOSCType)bias;
@@ -67,54 +55,6 @@ -(void)addNSValue:(id)newValue withBias:(BBOSCType)bias {
}
@end
-@interface BBOSCTypeToStringTransformer : NSValueTransformer
-+ (id) transformer;
-@end
-@implementation BBOSCTypeToStringTransformer
-+ (id) transformer {
- return [[[self alloc] init] autorelease];
-}
-+ (Class)transformedValueClass { return [NSString class]; }
-+ (BOOL)allowsReverseTransformation { return NO; }
-- (id)transformedValue:(id)value {
- switch ([value intValue]) {
- case BBOSCTypeInt: return @"Integer";
- case BBOSCTypeFloat: return @"Float";
- case BBOSCTypeBool: return @"Boolean";
- case BBOSCTypeString: return @"String";
- case BBOSCTypeArrayOfInt: return @"Array w/ Int bias";
- case BBOSCTypeArrayOfFloat: return @"Array w/ Float bias";
- case BBOSCTypeArrayOfBool: return @"Array w/ Bool bias";
- }
- NSAssert1(NO, @"Bad OSC type value %@", value);
-}
-@end
-
-@implementation BBOSCPlugInSenderViewController
-@synthesize portTypeDropDown, portArrayController;
-
--(void)setPortTypeDropDown:(NSPopUpButton*)popup {
- // Initialize the popup with all our port types
- portTypeDropDown = popup;
- [portTypeDropDown removeAllItems];
- NSMutableArray* portTypes = [NSMutableArray array];
- BBOSCTypeToStringTransformer* transformer = [BBOSCTypeToStringTransformer transformer];
- for(int i=0; i<BBOSCTypeCount; i++) {
- [portTypes addObject:[transformer transformedValue:[NSNumber numberWithInt:i]]];
- }
- [portTypeDropDown addItemsWithTitles:portTypes];
-}
-
--(void)addNewPort:(id)sender {
- NSMutableDictionary* newPort = [NSMutableDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithInt:[portTypeDropDown indexOfSelectedItem]],BBOSCTypeKey,
- [[NSProcessInfo processInfo] globallyUniqueString], BBOSCPortKey, nil
- ];
- [portArrayController addObject:newPort];
-}
-
-@end
-
@interface BBOSCPlugInSender ()
@@ -128,12 +68,6 @@ @implementation BBOSCPlugInSender
@synthesize oscManager, oscPort, oscParameters;
@dynamic inputBroadcastPort, inputBroadcastPath;
-+(void)initialize {
- if (self == [BBOSCPlugInSender class]) {
- [NSValueTransformer setValueTransformer:[BBOSCTypeToStringTransformer transformer] forName:@"BBOSCTypeToStringTransformer"];
- }
-}
-
+ (NSDictionary*) attributes
{
/*
@@ -206,8 +140,8 @@ - (void) dealloc
- (QCPlugInViewController*) createViewController
{
- return [[BBOSCPlugInSenderViewController alloc] initWithPlugIn:self
- viewNibName:@"BBOSCSender"];
+ return [[BBOSCViewController alloc] initWithPlugIn:self
+ viewNibName:@"BBOSCSettings"];
}
+ (NSArray*) plugInKeys {
@@ -230,28 +164,10 @@ -(void)setOscParameters:(NSArray*)params {
for(NSDictionary* port in oscParameters) {
NSString* key = [port objectForKey:BBOSCPortKey];
NSNumber* oscType = [port objectForKey:BBOSCTypeKey];
- NSString* qcType;
- switch([oscType intValue]) {
- case BBOSCTypeBool:
- qcType = QCPortTypeBoolean;
- break;
- case BBOSCTypeInt:
- qcType = QCPortTypeIndex;
- break;
- case BBOSCTypeFloat:
- qcType = QCPortTypeNumber;
- break;
- case BBOSCTypeString:
- qcType = QCPortTypeString;
- break;
- default:
- qcType = QCPortTypeStructure;
- break;
- }
NSString* name = [NSString stringWithFormat:@"OSC-%@", [[BBOSCTypeToStringTransformer transformer] transformedValue:oscType]];
NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:name, QCPortAttributeNameKey, nil];
- [self addInputPortWithType:qcType forKey:key withAttributes:attributes];
+ [self addInputPortWithType:QCTypeForOSCType([oscType intValue]) forKey:key withAttributes:attributes];
}
}
View
0  BBOSCSender.xib → BBOSCSettings.xib
File renamed without changes
View
35 BBOSCViewController.h
@@ -0,0 +1,35 @@
+//
+// BBOSCViewController.h
+// BBOSC
+//
+// Created by Jonathan del Strother on 09/09/2009.
+// Copyright 2009 Best Before Media Ltd. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+extern NSString* BBOSCTypeKey;
+extern NSString* BBOSCPortKey;
+
+typedef enum {
+ BBOSCTypeInt,
+ BBOSCTypeFloat,
+ BBOSCTypeBool,
+ BBOSCTypeString,
+ BBOSCTypeArrayOfInt,
+ BBOSCTypeArrayOfFloat,
+ BBOSCTypeArrayOfBool,
+ BBOSCTypeCount
+} BBOSCType;
+
+@interface BBOSCViewController : QCPlugInViewController {}
+@property (nonatomic, readonly, assign) IBOutlet NSPopUpButton* portTypeDropDown;
+@property (nonatomic, readonly, assign) IBOutlet NSArrayController* portArrayController;
+-(IBAction)addNewPort:(id)sender;
+@end
+
+@interface BBOSCTypeToStringTransformer : NSValueTransformer
++ (id) transformer;
+@end
+
+NSString* QCTypeForOSCType(BBOSCType oscType);
View
73 BBOSCViewController.m
@@ -0,0 +1,73 @@
+//
+// BBOSCViewController.m
+// BBOSC
+//
+// Created by Jonathan del Strother on 09/09/2009.
+// Copyright 2009 Best Before Media Ltd. All rights reserved.
+//
+
+#import "BBOSCViewController.h"
+
+NSString* BBOSCTypeKey=@"BBOSCType";
+NSString* BBOSCPortKey=@"BBOSCPortKey";
+
+@implementation BBOSCTypeToStringTransformer
++ (id) transformer {
+ return [[[self alloc] init] autorelease];
+}
++ (Class)transformedValueClass { return [NSString class]; }
++ (BOOL)allowsReverseTransformation { return NO; }
+- (id)transformedValue:(id)value {
+ switch ([value intValue]) {
+ case BBOSCTypeInt: return @"Integer";
+ case BBOSCTypeFloat: return @"Float";
+ case BBOSCTypeBool: return @"Boolean";
+ case BBOSCTypeString: return @"String";
+ case BBOSCTypeArrayOfInt: return @"Array w/ Int bias";
+ case BBOSCTypeArrayOfFloat: return @"Array w/ Float bias";
+ case BBOSCTypeArrayOfBool: return @"Array w/ Bool bias";
+ }
+ NSAssert1(NO, @"Bad OSC type value %@", value);
+}
+@end
+
+@implementation BBOSCViewController
+@synthesize portTypeDropDown, portArrayController;
+
++(void)initialize {
+ if (self == [BBOSCViewController class]) {
+ [NSValueTransformer setValueTransformer:[BBOSCTypeToStringTransformer transformer] forName:@"BBOSCTypeToStringTransformer"];
+ }
+}
+
+-(void)setPortTypeDropDown:(NSPopUpButton*)popup {
+ // Initialize the popup with all our port types
+ portTypeDropDown = popup;
+ [portTypeDropDown removeAllItems];
+ NSMutableArray* portTypes = [NSMutableArray array];
+ BBOSCTypeToStringTransformer* transformer = [BBOSCTypeToStringTransformer transformer];
+ for(int i=0; i<BBOSCTypeCount; i++) {
+ [portTypes addObject:[transformer transformedValue:[NSNumber numberWithInt:i]]];
+ }
+ [portTypeDropDown addItemsWithTitles:portTypes];
+}
+
+-(void)addNewPort:(id)sender {
+ NSMutableDictionary* newPort = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithInt:[portTypeDropDown indexOfSelectedItem]],BBOSCTypeKey,
+ [[NSProcessInfo processInfo] globallyUniqueString], BBOSCPortKey, nil
+ ];
+ [portArrayController addObject:newPort];
+}
+
+@end
+
+NSString* QCTypeForOSCType(BBOSCType oscType) {
+ switch(oscType) {
+ case BBOSCTypeBool: return QCPortTypeBoolean;
+ case BBOSCTypeInt: return QCPortTypeIndex;
+ case BBOSCTypeFloat: return QCPortTypeNumber;
+ case BBOSCTypeString: return QCPortTypeString;
+ default: return QCPortTypeStructure;
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.