diff --git a/SuperCollider.tmbundle/Commands/Clear post window.tmCommand b/SuperCollider.tmbundle/Commands/Clear post window.tmCommand index 298b819..15ad0c0 100644 --- a/SuperCollider.tmbundle/Commands/Clear post window.tmCommand +++ b/SuperCollider.tmbundle/Commands/Clear post window.tmCommand @@ -5,8 +5,8 @@ beforeRunningCommand nop command - require_cmd sc3ctrl -sc3ctrl -c + require_cmd sc3c +sc3c -c input none keyEquivalent @@ -15,6 +15,8 @@ sc3ctrl -c Clear post window output discard + scope + source.supercollider uuid 264ACF44-52AC-4AD4-8C13-0F49E0DAAA12 diff --git a/SuperCollider.tmbundle/Commands/Free all nodes.tmCommand b/SuperCollider.tmbundle/Commands/Free all nodes.tmCommand index 0e40d3f..4a4214d 100644 --- a/SuperCollider.tmbundle/Commands/Free all nodes.tmCommand +++ b/SuperCollider.tmbundle/Commands/Free all nodes.tmCommand @@ -5,8 +5,8 @@ beforeRunningCommand nop command - require_cmd sc3ctrl -sc3ctrl -s + require_cmd sc3c +sc3c -s input none keyEquivalent @@ -15,6 +15,8 @@ sc3ctrl -s Stop output discard + scope + source.supercollider uuid 81F7F82A-5C77-463E-BE36-15E0DAFF9930 diff --git a/SuperCollider.tmbundle/Commands/Help.tmCommand b/SuperCollider.tmbundle/Commands/Help.tmCommand index a5daddf..fdaaaf3 100644 --- a/SuperCollider.tmbundle/Commands/Help.tmCommand +++ b/SuperCollider.tmbundle/Commands/Help.tmCommand @@ -5,9 +5,8 @@ beforeRunningCommand nop command - require_cmd sc3ctrl -sc3ctrl -d $TM_SELECTED_TEXT - + require_cmd sc3c +sc3c -d $TM_SELECTED_TEXT fallbackInput word input @@ -17,7 +16,9 @@ sc3ctrl -d $TM_SELECTED_TEXT name Help output - discard + showAsTooltip + scope + source.supercollider uuid EAC732CB-6B38-4E0A-9BD4-D377562331D9 diff --git a/SuperCollider.tmbundle/Commands/Implementations of.tmCommand b/SuperCollider.tmbundle/Commands/Implementations of.tmCommand index 86935e4..02789a1 100644 --- a/SuperCollider.tmbundle/Commands/Implementations of.tmCommand +++ b/SuperCollider.tmbundle/Commands/Implementations of.tmCommand @@ -5,8 +5,8 @@ beforeRunningCommand nop command - require_cmd sc3ctrl -sc3ctrl -y $TM_SELECTED_TEXT + require_cmd sc3c +sc3c -y $TM_SELECTED_TEXT fallbackInput word input @@ -17,6 +17,8 @@ sc3ctrl -y $TM_SELECTED_TEXT Implementations of output discard + scope + source.supercollider uuid 3BAE7DE4-D06A-422B-94A3-7F542C47ED0F diff --git a/SuperCollider.tmbundle/Commands/Interpret code 2.tmCommand b/SuperCollider.tmbundle/Commands/Interpret code 2.tmCommand index 501e20c..3fb59a2 100644 --- a/SuperCollider.tmbundle/Commands/Interpret code 2.tmCommand +++ b/SuperCollider.tmbundle/Commands/Interpret code 2.tmCommand @@ -5,10 +5,9 @@ beforeRunningCommand nop command - #!/usr/bin/env ruby -cmd = ENV['TM_SELECTED_TEXT'] || ENV['TM_CURRENT_LINE'] -ENV['SC_INTERPRET_TEXT'] = cmd -%x{sc3ctrl -x} + require_cmd sc3c +export SC_INTERPRET_TEXT="${TM_SELECTED_TEXT:-$TM_CURRENT_LINE}" +sc3c -x SC_INTERPRET_TEXT; fallbackInput line input @@ -19,6 +18,8 @@ ENV['SC_INTERPRET_TEXT'] = cmd Interpret output showAsTooltip + scope + source.supercollider uuid FB64DE22-E1F3-48CC-AE67-21B7E008ADD5 diff --git a/SuperCollider.tmbundle/Commands/Open Class file.tmCommand b/SuperCollider.tmbundle/Commands/Open Class file.tmCommand index 682ae76..061c932 100644 --- a/SuperCollider.tmbundle/Commands/Open Class file.tmCommand +++ b/SuperCollider.tmbundle/Commands/Open Class file.tmCommand @@ -5,8 +5,8 @@ beforeRunningCommand nop command - require_cmd sc3ctrl -sc3ctrl -j $TM_SELECTED_TEXT + require_cmd sc3c +sc3c -j $TM_SELECTED_TEXT input selection keyEquivalent @@ -15,6 +15,8 @@ sc3ctrl -j $TM_SELECTED_TEXT Open Class file output discard + scope + source.supercollider uuid 293C4F9B-E1A4-4D01-83E7-0698112C7FA4 diff --git a/SuperCollider.tmbundle/Commands/References to.tmCommand b/SuperCollider.tmbundle/Commands/References to.tmCommand index d201c48..f6132e0 100644 --- a/SuperCollider.tmbundle/Commands/References to.tmCommand +++ b/SuperCollider.tmbundle/Commands/References to.tmCommand @@ -5,8 +5,8 @@ beforeRunningCommand nop command - require_cmd sc3ctrl -sc3ctrl -y $TM_SELECTED_TEXT + require_cmd sc3c +sc3c -Y $TM_SELECTED_TEXT input selection keyEquivalent @@ -15,6 +15,8 @@ sc3ctrl -y $TM_SELECTED_TEXT References to output discard + scope + source.supercollider uuid 22917CBF-054E-49ED-8AFA-7B72C0CFFA3A diff --git a/SuperCollider.tmbundle/Commands/Restart.tmCommand b/SuperCollider.tmbundle/Commands/Restart.tmCommand index 1fd2e3d..ff94c08 100644 --- a/SuperCollider.tmbundle/Commands/Restart.tmCommand +++ b/SuperCollider.tmbundle/Commands/Restart.tmCommand @@ -5,8 +5,8 @@ beforeRunningCommand saveActiveFile command - require_cmd sc3ctrl -sc3ctrl -k + require_cmd sc3c +sc3c -k input none keyEquivalent @@ -15,6 +15,8 @@ sc3ctrl -k Recompile class library output discard + scope + source.supercollider uuid 0EE79AEB-E9A7-4ABE-98A0-6CDBF3F3777A diff --git a/SuperCollider.tmbundle/Commands/untitled.tmCommand b/SuperCollider.tmbundle/Commands/untitled.tmCommand index 9c4a2b0..5e15dc6 100644 --- a/SuperCollider.tmbundle/Commands/untitled.tmCommand +++ b/SuperCollider.tmbundle/Commands/untitled.tmCommand @@ -5,8 +5,8 @@ beforeRunningCommand nop command - require_cmd sc3ctrl -sc3ctrl -p + require_cmd sc3c +sc3c -p input none keyEquivalent @@ -15,6 +15,8 @@ sc3ctrl -p Post window to front output discard + scope + source.supercollider uuid 81E4BC21-07E5-4E61-B5C8-3CC5B527C8CE diff --git a/SuperCollider.tmbundle/Snippets/Buffer_read.tmSnippet b/SuperCollider.tmbundle/Snippets/Buffer_read.tmSnippet index 27761ad..2b9befb 100644 --- a/SuperCollider.tmbundle/Snippets/Buffer_read.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/Buffer_read.tmSnippet @@ -6,6 +6,8 @@ Buffer.read(${1:s}, "${2:sounds/Amen.wav}"); name Buffer.read + scope + source.supercollider tabTrigger buf uuid diff --git a/SuperCollider.tmbundle/Snippets/Create Synth.tmSnippet b/SuperCollider.tmbundle/Snippets/Create Synth.tmSnippet index 94d127b..d7de140 100644 --- a/SuperCollider.tmbundle/Snippets/Create Synth.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/Create Synth.tmSnippet @@ -6,6 +6,8 @@ Synth(\\${1:foobar}, [\\${2:arg}, ${3:value}]); name Create Synth + scope + source.supercollider tabTrigger syn uuid diff --git a/SuperCollider.tmbundle/Snippets/Create SynthDef.tmSnippet b/SuperCollider.tmbundle/Snippets/Create SynthDef.tmSnippet index 851b1ef..1c0cf02 100644 --- a/SuperCollider.tmbundle/Snippets/Create SynthDef.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/Create SynthDef.tmSnippet @@ -8,6 +8,8 @@ }.play(s); name Create SynthDef + scope + source.supercollider tabTrigger sdef uuid diff --git a/SuperCollider.tmbundle/Snippets/Create function.tmSnippet b/SuperCollider.tmbundle/Snippets/Create function.tmSnippet index 6c23377..221559d 100644 --- a/SuperCollider.tmbundle/Snippets/Create function.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/Create function.tmSnippet @@ -8,6 +8,8 @@ name Create function + scope + source.supercollider tabTrigger { uuid diff --git a/SuperCollider.tmbundle/Snippets/EnvGen_kr.tmSnippet b/SuperCollider.tmbundle/Snippets/EnvGen_kr.tmSnippet index 11456fa..8eea43f 100644 --- a/SuperCollider.tmbundle/Snippets/EnvGen_kr.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/EnvGen_kr.tmSnippet @@ -6,6 +6,8 @@ EnvGen.kr(${1:env}, doneAction: ${2:2}) name EnvGen.kr + scope + source.supercollider tabTrigger egen uuid diff --git a/SuperCollider.tmbundle/Snippets/FlowLayout.tmSnippet b/SuperCollider.tmbundle/Snippets/FlowLayout.tmSnippet index 2cada67..ed7a224 100644 --- a/SuperCollider.tmbundle/Snippets/FlowLayout.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/FlowLayout.tmSnippet @@ -6,6 +6,8 @@ w.view.decorator = FlowLayout(w.view.bounds); name FlowLayout + scope + source.supercollider tabTrigger flow uuid diff --git a/SuperCollider.tmbundle/Snippets/Out_ar.tmSnippet b/SuperCollider.tmbundle/Snippets/Out_ar.tmSnippet index b623790..e759da3 100644 --- a/SuperCollider.tmbundle/Snippets/Out_ar.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/Out_ar.tmSnippet @@ -8,6 +8,8 @@ ); name Out.ar + scope + source.supercollider tabTrigger Out uuid diff --git a/SuperCollider.tmbundle/Snippets/Routine.tmSnippet b/SuperCollider.tmbundle/Snippets/Routine.tmSnippet index 57c0a4b..25d01f5 100644 --- a/SuperCollider.tmbundle/Snippets/Routine.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/Routine.tmSnippet @@ -9,6 +9,8 @@ }; name Routine + scope + source.supercollider tabTrigger rout uuid diff --git a/SuperCollider.tmbundle/Snippets/SCWindow_new.tmSnippet b/SuperCollider.tmbundle/Snippets/SCWindow_new.tmSnippet index 54b56e9..2e9f919 100644 --- a/SuperCollider.tmbundle/Snippets/SCWindow_new.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/SCWindow_new.tmSnippet @@ -6,6 +6,8 @@ SCWindow("${1:window title}", Rect(${2:x}, ${3:y}, ${4:width}, ${5:height})); name SCWindow.new + scope + source.supercollider tabTrigger win uuid diff --git a/SuperCollider.tmbundle/Snippets/Server_killAll.tmSnippet b/SuperCollider.tmbundle/Snippets/Server_killAll.tmSnippet index 1bc8d4c..0a5b92a 100644 --- a/SuperCollider.tmbundle/Snippets/Server_killAll.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/Server_killAll.tmSnippet @@ -6,6 +6,8 @@ Server.killAll; Server.default.boot name Server.killAll + scope + source.supercollider tabTrigger sk uuid diff --git a/SuperCollider.tmbundle/Snippets/_standardizePath.tmSnippet b/SuperCollider.tmbundle/Snippets/_standardizePath.tmSnippet index aff21c8..b6ff428 100644 --- a/SuperCollider.tmbundle/Snippets/_standardizePath.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/_standardizePath.tmSnippet @@ -6,6 +6,8 @@ .standardizePath$0 name .standardizePath + scope + source.supercollider tabTrigger .sp uuid diff --git a/SuperCollider.tmbundle/Snippets/do ___.tmSnippet b/SuperCollider.tmbundle/Snippets/do ___.tmSnippet index d33cf7c..a6fbb60 100644 --- a/SuperCollider.tmbundle/Snippets/do ___.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/do ___.tmSnippet @@ -8,6 +8,8 @@ }; name do ... + scope + source.supercollider tabTrigger do uuid diff --git a/SuperCollider.tmbundle/Snippets/if ___.tmSnippet b/SuperCollider.tmbundle/Snippets/if ___.tmSnippet index 7b5c412..4c7198c 100644 --- a/SuperCollider.tmbundle/Snippets/if ___.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/if ___.tmSnippet @@ -10,6 +10,8 @@ }; name if ... + scope + source.supercollider tabTrigger if uuid diff --git a/SuperCollider.tmbundle/Snippets/play.tmSnippet b/SuperCollider.tmbundle/Snippets/play.tmSnippet index 1431afc..f124089 100644 --- a/SuperCollider.tmbundle/Snippets/play.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/play.tmSnippet @@ -6,6 +6,8 @@ { ${1:SinOsc.ar} }.play name play + scope + source.supercollider tabTrigger play uuid diff --git a/SuperCollider.tmbundle/Snippets/untitled 2.tmSnippet b/SuperCollider.tmbundle/Snippets/untitled 2.tmSnippet index 6a943f0..924fa42 100644 --- a/SuperCollider.tmbundle/Snippets/untitled 2.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/untitled 2.tmSnippet @@ -6,6 +6,8 @@ s.queryAllNodes name s.queryAllNodes + scope + source.supercollider tabTrigger s.q uuid diff --git a/SuperCollider.tmbundle/Snippets/untitled 3.tmSnippet b/SuperCollider.tmbundle/Snippets/untitled 3.tmSnippet index 452863a..34c76d2 100644 --- a/SuperCollider.tmbundle/Snippets/untitled 3.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/untitled 3.tmSnippet @@ -6,6 +6,8 @@ .openHelpFile name .openHelpFile + scope + source.supercollider tabTrigger .h uuid diff --git a/SuperCollider.tmbundle/Snippets/untitled 4.tmSnippet b/SuperCollider.tmbundle/Snippets/untitled 4.tmSnippet index 45e914f..75eba35 100644 --- a/SuperCollider.tmbundle/Snippets/untitled 4.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/untitled 4.tmSnippet @@ -6,6 +6,8 @@ .openCodeFile name .openCodeFile + scope + source.supercollider tabTrigger .c uuid diff --git a/SuperCollider.tmbundle/Snippets/untitled 5.tmSnippet b/SuperCollider.tmbundle/Snippets/untitled 5.tmSnippet index bf029f8..1fe4af0 100644 --- a/SuperCollider.tmbundle/Snippets/untitled 5.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/untitled 5.tmSnippet @@ -6,6 +6,8 @@ ^super.new.init$0; name ^super.new.init + scope + source.supercollider tabTrigger rsup uuid diff --git a/SuperCollider.tmbundle/Snippets/untitled 6.tmSnippet b/SuperCollider.tmbundle/Snippets/untitled 6.tmSnippet index 103bbb7..dfbd4bb 100644 --- a/SuperCollider.tmbundle/Snippets/untitled 6.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/untitled 6.tmSnippet @@ -6,6 +6,8 @@ asCompileString name asCompileString + scope + source.supercollider tabTrigger ascs uuid diff --git a/SuperCollider.tmbundle/Snippets/untitled 7.tmSnippet b/SuperCollider.tmbundle/Snippets/untitled 7.tmSnippet index 0b7f82e..3869a3e 100644 --- a/SuperCollider.tmbundle/Snippets/untitled 7.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/untitled 7.tmSnippet @@ -6,6 +6,8 @@ doneAction: ${1:2}$2 name doneAction + scope + source.supercollider tabTrigger da uuid diff --git a/SuperCollider.tmbundle/Snippets/untitled.tmSnippet b/SuperCollider.tmbundle/Snippets/untitled.tmSnippet index 9ff29e5..be28fb6 100644 --- a/SuperCollider.tmbundle/Snippets/untitled.tmSnippet +++ b/SuperCollider.tmbundle/Snippets/untitled.tmSnippet @@ -6,6 +6,8 @@ .postln name .postln + scope + source.supercollider tabTrigger .p uuid diff --git a/SuperCollider.tmbundle/Support/bin/sc3c b/SuperCollider.tmbundle/Support/bin/sc3c new file mode 100755 index 0000000..b16f5d4 --- /dev/null +++ b/SuperCollider.tmbundle/Support/bin/sc3c @@ -0,0 +1,2 @@ +#!/usr/bin/env ruby +%x{'#{ENV['TM_BUNDLE_SUPPORT']}/sc3ctrl/sc3ctrl' #{$*.join(" ")}} diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/README b/SuperCollider.tmbundle/Support/sc3ctrl/README new file mode 100644 index 0000000..6900d4e --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/README @@ -0,0 +1,69 @@ +************************************************************************** +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +************************************************************************** + + +Introduction +============ + +sc3ctrl is a command line utility which uses OpenSoundControl to control +SuperCollider3.app in OSX. + +Consists of a small CoreFoundation bundle written in Objective-C and a +single SuperCollider class. + +Binary: http://www.trapdoor1.net/sc3/sc3ctrl.tar.gz +(as yet untested on anything other than 10.5) + +Source code: http://github.com/rfwatson/sc3ctrl + + +Installation +============ + +1) Drag the bundle into a suitable location on your machine + (e.g. /Application/Utilities/) + +2) cd /Application/Utilities/sc3ctrl/ + +3) sudo install.rb + +4) Start SuperCollider.app + + +Usage +===== + +sc3ctrl -x Execute the SC code in environment variable SC_INTERPRET_TEXT + +sc3ctrl -x VARIABLE_NAME Execute the SC code in environment variable VARIABLE_NAME + +sc3ctrl -d classname Open help file for classname + +sc3ctrl -j classname Open class definition for classname + +sc3ctrl -y methodname Examine implementations of methodname + +sc3ctrl -Y methodname Examine references to methodname + +sc3ctrl -s Stop server (CMD-PERIOD) + +sc3ctrl -c Clear post window + +sc3ctrl -p Post window to front + +sc3ctrl -k Recompile class library (requires recent build) + diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/SC3Controller.sc b/SuperCollider.tmbundle/Support/sc3ctrl/SC3Controller.sc new file mode 100644 index 0000000..eaf151f --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/SC3Controller.sc @@ -0,0 +1,140 @@ +// http://github.com/rfwatson/sc3ctrl + +SC3Controller { + classvar nodes; + + *initClass { + var postToFront; + nodes = List[]; + + Platform.case(\osx) { + postToFront = { + Document.listener.front; + }; + + StartUp.add { + this.addListeners; + } + } + } + + *addListeners { + var node; + if(nodes.isEmpty) { + node = OSCresponderNode(nil, '/sc3ctrl/cmd') { |t, r, msg| + msg[1].asString.interpretPrint; + { postToFront.() }.defer; + }.add; + nodes.add(node); + + node = OSCresponderNode(nil, '/sc3ctrl/help') { |t, r, msg| + { msg[1].asString.openHelpFile }.defer + }.add; + nodes.add(node); + + node = OSCresponderNode(nil, '/sc3ctrl/class') { |t, r, msg| + { msg[1].asString.interpret.openCodeFile }.defer + }.add; + nodes.add(node); + + node = OSCresponderNode(nil, '/sc3ctrl/implementations') { |t, r, msg| + { SC3Controller.methodTemplates(msg[1]) }.defer + }.add; + nodes.add(node); + + node = OSCresponderNode(nil, '/sc3ctrl/references') { |t, r, msg| + { SC3Controller.methodReferences(msg[1]) }.defer + }.add; + nodes.add(node); + + node = OSCresponderNode(nil, '/sc3ctrl/stop') { |t, r, msg| + thisProcess.stop; + }.add; + nodes.add(node); + + node = OSCresponderNode(nil, '/sc3ctrl/clear') { |t, r, msg| + { + Document.listener.string = ""; ""; + postToFront.(); + }.defer; + }.add; + nodes.add(node); + + node = OSCresponderNode(nil, '/sc3ctrl/postfront') { |t, r, msg| + { postToFront.() }.defer; + }.add; + nodes.add(node); + + node = OSCresponderNode(nil, '/sc3ctrl/recompile') { |t, r, msg| + { + thisProcess.recompile; + postToFront.(); + }.defer; + }.add; + nodes.add(node); + } + } + + *removeAllListeners { + nodes.do(_.remove); + } + + // adapated from Kernel.sc + *methodTemplates { |name| + var out, found = 0, namestring; + out = CollStream.new; + out << "Implementations of '" << name << "' :\n"; + Class.allClasses.do({ arg class; + class.methods.do({ arg method; + if (method.name == name, { + found = found + 1; + namestring = class.name ++ ":" ++ name; + out << " " << namestring << " : "; + if (method.argNames.isNil or: { method.argNames.size == 1 }, { + out << "this." << name; + if (name.isSetter, { out << "(val)"; }); + },{ + out << method.argNames.at(0); + if (name.asString.at(0).isAlpha, { + out << "." << name << "("; + method.argNames.do({ arg argName, i; + if (i > 0, { + if (i != 1, { out << ", " }); + out << argName; + }); + }); + out << ")"; + },{ + out << " " << name << " "; + out << method.argNames.at(1); + }); + }); + out.nl; + }); + }); + }); + if(found == 0) + { + Post << "\nNo implementations of '" << name << "'.\n"; + } + { + out.collection.newTextWindow(name.asString); + }; + } + + // adapted from Kernel.sc + *methodReferences { |name| + var out, references; + name = name.asSymbol; + out = CollStream.new; + references = Class.findAllReferences(name); + + if (references.notNil, { + out << "References to '" << name << "' :\n"; + references.do({ arg ref; out << " " << ref.asString << "\n"; }); + out.collection.newTextWindow(name.asString); + },{ + Post << "\nNo references to '" << name << "'.\n"; + }); + } +} \ No newline at end of file diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Headers b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Headers new file mode 120000 index 0000000..a177d2a --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Headers @@ -0,0 +1 @@ +Versions/Current/Headers \ No newline at end of file diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Resources b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/VVOSC b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/VVOSC new file mode 120000 index 0000000..c6a43b0 --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/VVOSC @@ -0,0 +1 @@ +Versions/Current/VVOSC \ No newline at end of file diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/AddressValPair.h b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/AddressValPair.h new file mode 100644 index 0000000..e8ab9ca --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/AddressValPair.h @@ -0,0 +1,28 @@ +// +// AddressValPair.h +// VVOSC +// +// Created by bagheera on 12/11/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#if IPHONE +#import +#else +#import +#endif + + + +@interface AddressValPair : NSObject { + NSString *address; + id val; +} + ++ (id) createWithAddress:(NSString *)a val:(id)v; +- (id) initWithAddress:(NSString *)a val:(id)v; + +- (NSString *) address; +- (id) val; + +@end diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCBundle.h b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCBundle.h new file mode 100644 index 0000000..712f13a --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCBundle.h @@ -0,0 +1,34 @@ +// +// OSCBundle.h +// OSC +// +// Created by bagheera on 9/20/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#if IPHONE +#import +#else +#import +#endif + +#import "OSCMessage.h" + + + + +@interface OSCBundle : NSObject { + NSMutableArray *elementArray; // array of messages or bundles +} + ++ (void) parseRawBuffer:(unsigned char *)b ofMaxLength:(int)l toInPort:(id)p; + ++ (id) create; + +- (void) addElement:(id)n; +- (void) addElementArray:(NSArray *)a; + +- (int) bufferLength; +- (void) writeToBuffer:(unsigned char *)b; + +@end diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCInPort.h b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCInPort.h new file mode 100644 index 0000000..3f1fa83 --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCInPort.h @@ -0,0 +1,93 @@ +// +// OSCInPort.h +// OSC +// +// Created by bagheera on 9/20/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#if IPHONE +#import +#else +#import +#endif + + +//#import +//#import +#import + +#import +#import "AddressValPair.h" +#import "OSCPacket.h" +#import "OSCBundle.h" +#import "OSCMessage.h" + + +@protocol OSCInPortDelegateProtocol +- (void) oscMessageReceived:(NSDictionary *)d; +- (void) receivedOSCVal:(id)v forAddress:(NSString *)a; +@end + +@protocol OSCDelegateProtocol +- (void) oscMessageReceived:(NSDictionary *)d; +- (void) receivedOSCVal:(id)v forAddress:(NSString *)a; +@end + + +@interface OSCInPort : NSObject { + BOOL deleted; // whether or not i'm deleted- ensures that socket gets closed + BOOL bound; // whether or not the socket is bound + int sock; // socket file descriptor. remember, everything in unix is files! + struct sockaddr_in addr; // struct that describes *my* address (this is an in port) + unsigned short port; // the port number i'm receiving from + BOOL running; // whether or not i should keep running + BOOL busy; + unsigned char buf[8192]; // the socket gets data and dumps it here immediately + + pthread_mutex_t lock; + NSTimer *threadTimer; + int threadTimerCount; + NSAutoreleasePool *threadPool; + + NSString *portLabel; // the "name" of the port (added to distinguish multiple osc input ports for bonjour) + NSNetService *zeroConfDest; // bonjour service for publishing this input's address...only active if there's a portLabel! + + NSMutableDictionary *scratchDict; // key of dict is address port; object at key is a mut. array. coalesced messaging. + NSMutableArray *scratchArray; // array of AddressValPair objects. used for serial messaging. + id delegate; // my delegate gets notified of incoming messages +} + ++ (id) createWithPort:(unsigned short)p; ++ (id) createWithPort:(unsigned short)p labelled:(NSString *)n; +- (id) initWithPort:(unsigned short)p; +- (id) initWithPort:(unsigned short)p labelled:(NSString *)n; + +- (void) prepareToBeDeleted; + +- (NSDictionary *) createSnapshot; + +- (BOOL) createSocket; +- (void) start; +- (void) stop; +- (void) launchOSCLoop:(id)o; +- (void) OSCThreadProc:(NSTimer *)t; +- (void) parseRawBuffer:(unsigned char *)b ofMaxLength:(int)l; + +// if the delegate im +- (void) handleParsedScratchDict:(NSDictionary *)d; +- (void) handleScratchArray:(NSArray *)a; + +- (void) addValue:(id)val toAddressPath:(NSString *)p; + +- (unsigned short) port; +- (void) setPort:(unsigned short)n; +- (NSString *) portLabel; +- (void) setPortLabel:(NSString *)n; +- (NSNetService *) zeroConfDest; +- (BOOL) bound; + +- (id) delegate; +- (void) setDelegate:(id)n; + +@end diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCManager.h b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCManager.h new file mode 100644 index 0000000..5673296 --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCManager.h @@ -0,0 +1,144 @@ +// +// OSCManager.h +// OSC +// +// Created by bagheera on 9/20/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#if IPHONE +#import +#else +#import +#endif + +#import "OSCZeroConfManager.h" +#import "OSCInPort.h" +#import "OSCOutPort.h" +#import + +/* + TOP-LEVEL OVERVIEW + + this osc manager class is all you need to add to your app. it has methods for + adding and removing ports. you can have as many osc managers as you like, but + you should really only need one instance. + + input ports have a delegate- delegate methods are called as the port receives data. + it's important to note that the delegate methods must be thread-safe: each input + port is running on its own (non-main) thread. + + data is sent via the output ports (convenience methods for doing this are built + into the osc manager). + + + + + GENERAL OSC STRUCTURE AND OVERVIEW + + this framework was written from the OSC spec found here: + http://opensoundcontrol.org/spec-1_0 + + - an OSC packet is the basic unit of transmitting OSC data. + - an OSC packet consists of: + - contents- contiguous block of binary data (either a bundle or a message), and then the + - size- number of 8-bit bytes that comprise 'contents'- ALWAYS multiple of 4! + - an OSC message consists of: + - an OSC address pattern (starting with '/'), followed by + - an OSC type tag string, followed by + - zero or more 'OSC arguments' + - an OSC bundle consists of: + - the OSC-string "#bundle", followed by + - an OSC time tag, followed by + - zero or more 'OSC bundle elements' + - an OSC bundle element consists of: + - 'size' (int32)- number of 8-bit bytes in the contents- ALWAYS multiple of 4! + - 'contents'- either another OSC bundle, or an OSC message + + + + + PORTS- SENDING AND RECEIVING UDP/TCP DATA + + some basic information, gleaned from: + http://beej.us/guide/bgnet/output/html/multipage/index.html + + struct sockaddr { + unsigned short sa_family; // address family, AF_xxx + char sa_data[14]; // 14 bytes of protocol address + } + struct sockaddr_in { + short int sin_family; // address family + unsigned short int sin_port; // port number + struct in_addr sin_addr; // internet address + unsigned char sin_zero[8]; // exists so sockaddr_in has same length as sockaddr + } + + recv(int sockfd, void *buf, int len, unsigned int flags); + - sockfd is the socket descriptor to read from + - buf is the buffer to read the information into + - len is the max length of the buffer + - flags can be set to 0 + recvfrom(int sockfd, void *buf, int len, unsigned int flags, struct sockaddr *from, int *fromlen); + - from is a pointer to a local struct sockaddr that will be filled with the IP & port of the originating machine + - fromlen is a pointer to a local int that should be initialized to a sizeof(struct sockaddr)- contains length of address actually stored in from on return + ...as well as the 4 params listed above in recv() + + int select(int numfds, fd_set *readrds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); +*/ + +@interface OSCManager : NSObject { + NSMutableArray *inPortArray; + NSMutableArray *outPortArray; + + pthread_rwlock_t inPortLock; + pthread_rwlock_t outPortLock; + + id delegate; + + OSCZeroConfManager *zeroConfManager; // bonjour/zero-configuration manager +} + +- (void) deleteAllInputs; +- (void) deleteAllOutputs; +// methods for creating input ports +- (OSCInPort *) createNewInputFromSnapshot:(NSDictionary *)s; +- (OSCInPort *) createNewInputForPort:(int)p withLabel:(NSString *)l; +- (OSCInPort *) createNewInputForPort:(int)p; +- (OSCInPort *) createNewInput; +// methods for creating output ports +- (OSCOutPort *) createNewOutputFromSnapshot:(NSDictionary *)s; +- (OSCOutPort *) createNewOutputToAddress:(NSString *)a atPort:(int)p withLabel:(NSString *)l; +- (OSCOutPort *) createNewOutputToAddress:(NSString *)a atPort:(int)p; +- (OSCOutPort *) createNewOutput; + +// typically, the manager is the input port's delegate- input ports tell delegates when they receive data +// this method is called and contains coalesced messages (grouped by address path) +- (void) oscMessageReceived:(NSDictionary *)d; +// this method is called every time any osc val is processed +- (void) receivedOSCVal:(id)v forAddress:(NSString *)a; + +// methods for working with ports +- (NSString *) getUniqueInputLabel; +- (NSString *) getUniqueOutputLabel; +- (OSCInPort *) findInputWithLabel:(NSString *)n; +- (OSCOutPort *) findOutputWithLabel:(NSString *)n; +- (OSCOutPort *) findOutputWithAddress:(NSString *)a andPort:(int)p; +- (OSCOutPort *) findOutputForIndex:(int)i; +- (OSCInPort *) findInputWithZeroConfName:(NSString *)n; +- (void) removeInput:(id)p; +- (void) removeOutput:(id)p; +- (NSArray *) outPortLabelArray; + +// subclassable methods for customizing +- (id) inPortClass; +- (NSString *) inPortLabelBase; +- (id) outPortClass; + +// misc +- (id) delegate; +- (void) setDelegate:(id)n; +- (NSMutableArray *) inPortArray; +- (NSMutableArray *) outPortArray; + +@end diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCMessage.h b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCMessage.h new file mode 100644 index 0000000..e86444c --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCMessage.h @@ -0,0 +1,43 @@ +// +// OSCMessage.h +// OSC +// +// Created by bagheera on 9/20/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#if IPHONE +#import +#else +#import +#endif + +#import + + + +@interface OSCMessage : NSObject { + NSString *address; + NSMutableArray *typeArray; + NSMutableArray *argArray; + pthread_rwlock_t lock; +} + ++ (void) parseRawBuffer:(unsigned char *)b ofMaxLength:(int)l toInPort:(id)p; ++ (id) createMessageToAddress:(NSString *)a; +- (id) initWithAddress:(NSString *)a; + +- (void) addInt:(int)n; +- (void) addFloat:(float)n; +#if IPHONE +- (void) addColor:(UIColor *)c; +#else +- (void) addColor:(NSColor *)c; +#endif +- (void) addBOOL:(BOOL)n; +- (void) addString:(NSString *)n; + +- (int) bufferLength; +- (void) writeToBuffer:(unsigned char *)b; + +@end diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCOutPort.h b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCOutPort.h new file mode 100644 index 0000000..859b046 --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCOutPort.h @@ -0,0 +1,58 @@ +// +// OSCOutPort.h +// OSC +// +// Created by bagheera on 9/20/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#if IPHONE +#import +#else +#import +#endif + + +#include + +#import "OSCPacket.h" +#import "OSCBundle.h" +#import "OSCMessage.h" + + + + +@interface OSCOutPort : NSObject { + BOOL deleted; + int sock; + struct sockaddr_in addr; + unsigned short port; + NSString *addressString; + NSString *portLabel; // used it to distinguish between multiple osc outputs +} + ++ (id) createWithAddress:(NSString *)a andPort:(unsigned short)p; ++ (id) createWithAddress:(NSString *)a andPort:(unsigned short)p labelled:(NSString *)l; +- (id) initWithAddress:(NSString *)a andPort:(unsigned short)p; +- (id) initWithAddress:(NSString *)a andPort:(unsigned short)p labelled:(NSString *)l; +- (void) prepareToBeDeleted; + +- (NSDictionary *) createSnapshot; + +- (BOOL) createSocket; + +- (void) sendThisBundle:(OSCBundle *)b; +- (void) sendThisMessage:(OSCMessage *)m; +- (void) sendThisPacket:(OSCPacket *)p; + +- (void) setAddressString:(NSString *)n; +- (void) setPort:(unsigned short)p; +- (void) setAddressString:(NSString *)n andPort:(unsigned short)p; + +- (NSString *) portLabel; +- (void) setPortLabel:(NSString *)n; + +- (unsigned short) port; +- (NSString *) addressString; + +@end diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCPacket.h b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCPacket.h new file mode 100644 index 0000000..4d79674 --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCPacket.h @@ -0,0 +1,37 @@ +// +// OSCPacket.h +// OSC +// +// Created by bagheera on 9/20/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#if IPHONE +#import +#else +#import +#endif + +#include +#import "OSCBundle.h" +#import "OSCMessage.h" + +/* + this class requires a bundle or message on create/init. the buffer/msg + is NOT retained by this class in any way- it's used to immediately create + the buffer which will be sent. +*/ + +@interface OSCPacket : NSObject { + int bufferLength; + unsigned char *payload; +} + ++ (void) parseRawBuffer:(unsigned char *)b ofMaxLength:(int)l toInPort:(id)p; ++ (id) createWithContent:(id)c; +- (id) initWithContent:(id)c; + +- (int) bufferLength; +- (unsigned char *) payload; + +@end diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCZeroConfDomain.h b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCZeroConfDomain.h new file mode 100644 index 0000000..22a94bc --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCZeroConfDomain.h @@ -0,0 +1,44 @@ +// +// OSCZeroConfDomain.h +// VVOSC +// +// Created by bagheera on 12/9/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#if IPHONE +#import +#else +#import +#endif + +#import +#import +#include + + + + +@interface OSCZeroConfDomain : NSObject { + NSString *domainString; + NSNetServiceBrowser *serviceBrowser; + + NSMutableArray *servicesArray; + pthread_rwlock_t servicesLock; + + id domainManager; +} + ++ (id) createWithDomain:(NSString *)d andDomainManager:(id)m; +- (id) initWithDomain:(NSString *)d andDomainManager:(id)m; + +// NSNetServiceBrowser delegate methods +- (void)netServiceBrowser:(NSNetServiceBrowser *)n didFindService:(NSNetService *)x moreComing:(BOOL)m; +- (void)netServiceBrowser:(NSNetServiceBrowser *)n didNotSearch:(NSDictionary *)err; +- (void)netServiceBrowser:(NSNetServiceBrowser *)n didRemoveService:(NSNetService *)s moreComing:(BOOL)m; + +// NSNetService delegate methods +- (void)netService:(NSNetService *)n didNotResolve:(NSDictionary *)err; +- (void)netServiceDidResolveAddress:(NSNetService *)n; + +@end diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCZeroConfManager.h b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCZeroConfManager.h new file mode 100644 index 0000000..21ddd7f --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/OSCZeroConfManager.h @@ -0,0 +1,39 @@ +// +// OSCZeroConfManager.h +// VVOSC +// +// Created by bagheera on 12/9/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#if IPHONE +#import +#else +#import +#endif + +#import "OSCZeroConfDomain.h" +#import + + + + +@interface OSCZeroConfManager : NSObject { + NSNetServiceBrowser *domainBrowser; + + NSMutableDictionary *domainDict; + pthread_rwlock_t domainLock; + + id oscManager; +} + +- (id) initWithOSCManager:(id)m; + +- (void) serviceRemoved:(NSNetService *)s; +- (void) serviceResolved:(NSNetService *)s; + +// NSNetServiceBrowser delegate methods +- (void)netServiceBrowser:(NSNetServiceBrowser *)n didFindDomain:(NSString *)d moreComing:(BOOL)m; +- (void)netServiceBrowser:(NSNetServiceBrowser *)n didNotSearch:(NSDictionary *)err; + +@end diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/VVOSC.h b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/VVOSC.h new file mode 100644 index 0000000..0248ef1 --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Headers/VVOSC.h @@ -0,0 +1,9 @@ + + +#import "AddressValPair.h" +#import "OSCManager.h" +#import "OSCZeroConfManager.h" +#import "OSCPacket.h" +#import "OSCBundle.h" +#import "OSCMessage.h" + diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Resources/English.lproj/InfoPlist.strings b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Resources/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..dea12de Binary files /dev/null and b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Resources/English.lproj/InfoPlist.strings differ diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Resources/Info.plist b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Resources/Info.plist new file mode 100644 index 0000000..5dfb179 --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/Resources/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + VVOSC + CFBundleGetInfoString + 0.1.2 + CFBundleIdentifier + com.vidvox.VVOSC + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + VVOSC + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 0.1.2 + + diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/VVOSC b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/VVOSC new file mode 100755 index 0000000..878f6e1 Binary files /dev/null and b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/A/VVOSC differ diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/Current b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/Current new file mode 120000 index 0000000..8c7e5a6 --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/VVOSC.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/install.rb b/SuperCollider.tmbundle/Support/sc3ctrl/install.rb new file mode 100755 index 0000000..c052a9a --- /dev/null +++ b/SuperCollider.tmbundle/Support/sc3ctrl/install.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +puts "Ready to install sc3ctrl." +puts "Press ENTER to continue." +gets + +puts "Creating executable in /usr/local/bin .." +%x{echo "`pwd`/sc3ctrl \\$1 \\$2" > /usr/local/bin/sc3ctrl} +%x{chmod a+x /usr/local/bin/sc3ctrl} +puts "Done." + +puts +puts "Copying SuperCollider class to Extensions folder .." +system 'cp SC3Controller.sc ~/Library/Application\ Support/SuperCollider/Extensions/' +puts "Done." + +puts \ No newline at end of file diff --git a/SuperCollider.tmbundle/Support/sc3ctrl/sc3ctrl b/SuperCollider.tmbundle/Support/sc3ctrl/sc3ctrl new file mode 100755 index 0000000..251521d Binary files /dev/null and b/SuperCollider.tmbundle/Support/sc3ctrl/sc3ctrl differ