Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: muellmusik/SST
base: 16ab9254a0
...
head fork: muellmusik/SST
compare: 8a9f75d493
  • 5 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 84 additions and 16 deletions.
  1. +4 −1 SST Wrapper GUIs.sc
  2. +6 −3 SST tests.rtf
  3. +74 −12 SuperSimpleTimeline.sc
View
5 SST Wrapper GUIs.sc
@@ -47,6 +47,7 @@ SSTItemWrapperGUI : AbstractSSTWrapperGUI {
parent.findWindow.onClose = parent.findWindow.onClose.addFunc({onClose.value});
textView.font = Font(Font.defaultMonoFace, 12);
textView.string = wrapper.wrapped.asCompileString;
+ textView.enterInterpretsSelection = true;
resetButton.action = { textView.string = wrapper.wrapped.asCompileString; };
applyButton.action = { wrapper.wrapped = textView.string.interpret; };
}
@@ -87,6 +88,7 @@ SSTTextWrapperGUI : AbstractSSTWrapperGUI {
parent.findWindow.onClose = parent.findWindow.onClose.addFunc({onClose.value});
textView.font = Font(Font.defaultMonoFace, 12);
textView.string = wrapper.text;
+ textView.enterInterpretsSelection = true;
resetButton.action = { textView.string = wrapper.text; };
applyButton.action = { wrapper.text = textView.string; };
}
@@ -128,6 +130,7 @@ SSTEnvelopedBufferWrapperGUI : AbstractSSTWrapperGUI {
parent.findWindow.onClose = parent.findWindow.onClose.addFunc({onClose.value});
textView.font = Font(Font.defaultMonoFace, 12);
textView.string = wrapper.eventCode;
+ textView.enterInterpretsSelection = true;
resetButton.action = {
textView.string = wrapper.eventCode;
envView.setEnv(wrapper.env);
@@ -180,7 +183,7 @@ SSTEnvelopedBufferWrapperGUI : AbstractSSTWrapperGUI {
sfView.readFile(sf, 0, sf.numFrames, 64, true);
sfView.timeCursorOn = true;
- oscFunc = OSCFunc({|msg| {sfView.timeCursorPosition = msg[3]}.defer; }, '/tr', argTemplate: [nil, wrapper.id, nil]);
+ oscFunc = OSCFunc({|msg| {sfView.timeCursorPosition = msg[3]}.defer; }, '/tr', argTemplate: [nil, wrapper.id, nil]).fix;
onClose = onClose.addFunc({oscFunc.free});
^compView
}
View
9 SST tests.rtf
@@ -85,13 +85,13 @@ g.groupColoursFromHex_([\cf5 "#DADADA"\cf0 , \cf5 "#F7C090"\cf0 , \cf5 "#CDEDE8"
\cf2 // vintage chair\cf0 \
g.groupColoursFromHex_([\cf5 "#1BF6DC"\cf0 , \cf5 "#16DD72"\cf0 , \cf5 "#A3DD16"\cf0 , \cf5 "#FA8936"\cf0 , \cf5 "#F3ED4F"\cf0 ])\
\
-// two items at 0 seems to be a problem.\
+// problem with gui opening for file event\
\
//// Buffer\
s.boot;\
p = Platform.resourceDir +/+ "sounds/a11wlk01.wav";\
b = Buffer.read(s, p);\
-\cf3 f = SSTEnvelopedBufferWrapper(0.1, b);\
+\cf3 f = SSTEnvelopedBufferWrapper(0.0, b);\
\
\cf0 (\
t = \cf3 SuperSimpleTimeline\cf0 .new;\
@@ -103,4 +103,7 @@ t.addItem(f);\
t.createGroup(\cf4 \\file\cf0 , [f]);\
\
g = \cf3 SSTGUI\cf0 (t)\
-)}
+)\
+\
+\
+t.asDocument}
View
86 SuperSimpleTimeline.sc
@@ -29,8 +29,8 @@ SuperSimpleTimeline {
}
addItem {|item|
- items.add(item);
groups['Ungrouped'].addItem(item);
+ items.add(item);
}
// we schedule one event at a time, that way we can ignore a scheduled event if its time has changed
@@ -153,6 +153,42 @@ SuperSimpleTimeline {
currentTime_ {|time| if(playing, {this.play(time)}, { pauseTime = time }); this.changed(\time, time) }
+ asRoutineCode {
+ var resultString, lastEventTime = 0;
+
+ resultString = "/////// Routine Generated from SuperSimpleTimeline\n\n// Resource code\n\n(\n";
+ SSTItemWrapper.startResourceCollect;
+ items.do({|wrapper|
+ var resourceString;
+ resourceString = wrapper.resourceCode;
+ resourceString.notNil.if({
+ resultString = resultString ++ resourceString;
+ });
+ });
+ SSTItemWrapper.cleanUpResourceCollect;
+
+ // now events
+ resultString = resultString ++ ")\n\n// Event Code \n\n(\nRoutine({\n\n";
+
+ items.do({|wrapper|
+ var wait, thisEventCode;
+ wait = wrapper.time - lastEventTime;
+ if(wait > 0, {
+ resultString = resultString ++ "\n\t" ++ wait ++ ".wait;\n\n";
+ });
+ thisEventCode = wrapper.eventCode;
+ if(thisEventCode.last != $;, {thisEventCode = thisEventCode ++ $;});
+ resultString = resultString ++ "\t" ++ thisEventCode ++ "\n";
+ lastEventTime = wrapper.time;
+ });
+
+ resultString = resultString ++ "\n}).play;\n)"
+ ^resultString;
+ }
+
+ asDocument {
+ Document.new("SST -> Routine", this.asRoutineCode).syntaxColorize;
+ }
}
SSTGroup {
@@ -183,10 +219,14 @@ SSTItemWrapper {
var <time;
var <>wrapped; // the thing that's executed
var <group;
- var <resources; // a collection of buffers, etc.
+ classvar <resources; // a collection of buffers, etc.
*new {|time, wrapped| ^super.newCopyArgs(max(time, 0), wrapped); }
+ *cleanUpResourceCollect { resources = nil }
+
+ *startResourceCollect { resources = IdentityDictionary.new }
+
time_ {|newTime| time = max(newTime, 0); group.sort;}
group_ {|newGroup| group !? {|oldGroup| oldGroup.removeItem(this)}; group = newGroup }
@@ -194,10 +234,10 @@ SSTItemWrapper {
gui {|parent, origin, name| ^SSTItemWrapperGUI(this, parent, origin, name) }
// initialisation code for things like buffers and defs
- resourceCode { }
+ resourceCode { ^nil }
// the code which causes the actual event
- eventCode { }
+ eventCode { ^(wrapped.asCompileString ++ ".value;") }
//execute the event
value { wrapped.value }
@@ -217,9 +257,6 @@ SSTTextWrapper : SSTItemWrapper {
gui {|parent, origin, name| ^SSTTextWrapperGUI(this, parent, origin, name) }
- // initialisation code for things like buffers and defs
- resourceCode { }
-
// the code which causes the actual event
eventCode { ^text }
@@ -236,8 +273,8 @@ SSTEnvelopedBufferWrapper : SSTItemWrapper {
init {
env = Env([1, 1], [wrapped.duration]);
- defName = "SST-" ++ this.identityHash;
id = (this.identityHash%(2.pow(16))).asInteger;
+ defName = "SST-" ++ id;
this.addDef;
eventCode = "Synth(" ++ defName.asCompileString ++ ", [out: 0, rate: 1, mul: 1], target: " ++ wrapped.server.asCompileString ++ ");";
}
@@ -256,10 +293,35 @@ SSTEnvelopedBufferWrapper : SSTItemWrapper {
gui {|parent, origin, name| ^SSTEnvelopedBufferWrapperGUI(this, parent, origin, name) }
// initialisation code for things like buffers and defs
- resourceCode { }
-
- // the code which causes the actual event
- //eventCode { }
+ resourceCode {
+ var bufKey, resourceString = "";
+ // problem if multiple files with the same name
+ bufKey = ("sst_buf_" ++ wrapped.path.basename.splitext[0]).asSymbol;
+
+ // only add buffers once
+ if(resources[bufKey].isNil, {
+ resources[bufKey] = wrapped;
+ resourceString = resourceString
+ ++ $~
+ ++ bufKey
+ ++ " = Buffer.read("
+ ++ wrapped.server.asCompileString
+ ++ ", "
+ ++ wrapped.path.asCompileString
+ ++ ");\n\n";
+ });
+
+ // use PlayBuf here instead of PlayBufSendIndex
+ resourceString = resourceString ++
+ "SynthDef(%, {|out, rate, mul|
+ var output;
+ output = PlayBuf.ar(%, ~%, rate);
+ output = output * EnvGen.ar(%, timeScale: rate.reciprocal, levelScale: mul, doneAction: 2);
+ Out.ar(out, output);
+}).add;\n\n".format(defName.asCompileString, wrapped.numChannels, bufKey, env.asCompileString);
+
+ ^resourceString
+ }
//execute the event
value { eventCode.interpret }

No commit comments for this range

Something went wrong with that request. Please try again.