Skip to content

Instantly share code, notes, and snippets.

@scztt
Created May 20, 2024 18:09
Show Gist options
  • Save scztt/eef6f74c01d4fb670fd6b02da920ff03 to your computer and use it in GitHub Desktop.
Save scztt/eef6f74c01d4fb670fd6b02da920ff03 to your computer and use it in GitHub Desktop.
Pmonophonic : Pattern {
embedInStream {
|inEvent|
var id, offEvent;
var event = inEvent.copy;
var cleanup = EventStreamCleanup();
cleanup.addFunction(event, {
offEvent.play;
});
event.putAll((
gate: 1,
sendGate: false,
callback: event[\callback].addFunc({
id = ~id;
offEvent = (
type: \off,
id: ~id,
server: ~server,
hasGate: ~hasGate,
schedBundleArray: ~schedBundleArray,
schedBundle: ~schedBundle
);
})
));
inEvent = event.yield;
while {inEvent.notNil} {
event = inEvent.copy;
cleanup.update(event);
event.putAll((
id: id,
gate: 1,
type: \set,
args: event[\args] ?? {[]} // get args from synthdef
));
inEvent = event.yield;
};
^cleanup.exit(inEvent);
}
}
+Pbind {
*mono {
|...pairs|
^Pmonophonic() <> Pbind(*pairs)
}
mono {
|...pairs|
^Pmonophonic() <> Pbind(*pairs)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment