Skip to content

Commit

Permalink
don't try to serialize Patch instances
Browse files Browse the repository at this point in the history
  • Loading branch information
colinsullivan committed May 20, 2018
1 parent 5336dc9 commit 63df3de
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.swp
node_modules
.supercollider.yaml
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "lib/index.js",
"browser": "lib/index_browser.js",
"scripts": {
"test": "mocha --compilers js:babel-register",
"test": "mocha --timeout 10000 --slow 4000 --compilers js:babel-register",
"build": "rm -Rf lib && babel src --out-dir lib"
},
"repository": {
Expand Down
10 changes: 9 additions & 1 deletion quarks/supercollider-redux/classes/ReduxEventStreamPlayer.sc
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,18 @@ ReduxEventStreamPlayer : EventStreamPlayer {
nextBeat: nextBeatAbs
)
);
// filter out keys that don't serialize over supercolliderjs
outEvent.keysValuesDo({
arg key, val;

if (['id', 'msgFunc', 'server', 'midiout', 'uid'].includes(key) == false, {
if ([
'id',
'msgFunc',
'server',
'midiout',
'uid',
'patch'
].includes(key) == false, {
action.payload[key] = val;
});

Expand Down
5 changes: 5 additions & 0 deletions quarks/supercollider-redux/classes/StateStore.sc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* dispatches actions back up to the primary state store and publishes
* state updates to all local subscriber functions.
**/

StateStore {
classvar <>instance;
var state,
Expand Down Expand Up @@ -87,7 +88,9 @@ StateStore {
var actionPairs = action.getPairs(),
payloadPairs = [],
msg;

if (action.payload != nil, {
//"[supercollider-redux]: Preparing payload...".postln();
payloadPairs = action.payload.getPairs();
actionPairs = ['type', action.type];
msg = (["/dispatch"] ++ actionPairs ++ ['payload'] ++ payloadPairs);
Expand All @@ -96,6 +99,8 @@ StateStore {
});
dispatchSocketsDict.keysValuesDo({
arg socketName, socket;
//"[supercollider-redux]: Dispatching message: ".postln();
//("[supercollider-redux]: " ++ msg).postln();
socket.sendRaw(msg.asRawOSC());
});
}
Expand Down

0 comments on commit 63df3de

Please sign in to comment.