From fc32faba5139163ca37bdf0f6bbd1d438431ca97 Mon Sep 17 00:00:00 2001 From: mwinter Date: Mon, 6 Nov 2023 18:58:15 +0100 Subject: [PATCH] making end measure in live utilities app --- .../openstagecontrol/mixer_transport.json | 18 ++-- .../openstagecontrol/transport.json | 87 ++++++++++++++++++- .../supercollider/live_utilities.scd | 23 +++-- 3 files changed, 113 insertions(+), 15 deletions(-) diff --git a/live_utilities/openstagecontrol/mixer_transport.json b/live_utilities/openstagecontrol/mixer_transport.json index da3ede4..6f04f2e 100644 --- a/live_utilities/openstagecontrol/mixer_transport.json +++ b/live_utilities/openstagecontrol/mixer_transport.json @@ -185,7 +185,8 @@ "props": { "variables": { "piece": "berger", - "tempo": 60 + "tempo": 60, + "endmeasure": -1 } }, "address": "auto", @@ -364,7 +365,8 @@ "props": { "variables": { "piece": "robinson", - "tempo": 60 + "tempo": 60, + "endmeasure": -1 } }, "address": "auto", @@ -545,7 +547,8 @@ "props": { "variables": { "piece": "penrose", - "tempo": 120 + "tempo": 120, + "endmeasure": -1 } }, "address": "auto", @@ -724,7 +727,8 @@ "props": { "variables": { "piece": "ammann", - "tempo": 60 + "tempo": 60, + "endmeasure": -1 } }, "address": "auto", @@ -905,7 +909,8 @@ "props": { "variables": { "piece": "kari", - "tempo": 45 + "tempo": 45, + "endmeasure": -1 } }, "address": "auto", @@ -1085,7 +1090,8 @@ "props": { "variables": { "piece": "jaendel", - "tempo": 60 + "tempo": 60, + "endmeasure": -1 } }, "address": "auto", diff --git a/live_utilities/openstagecontrol/transport.json b/live_utilities/openstagecontrol/transport.json index c1f01c5..31433b7 100644 --- a/live_utilities/openstagecontrol/transport.json +++ b/live_utilities/openstagecontrol/transport.json @@ -215,7 +215,7 @@ }, { "type": "input", - "top": "10%", + "top": "7%", "left": "calc(80% + 50px)", "lock": false, "id": "tempo/@{parent.variables.piece}", @@ -223,7 +223,7 @@ "interaction": true, "comments": "", "width": "calc(20% - 50px)", - "height": "15%", + "height": "7%", "expand": "false", "colorText": "auto", "colorWidget": "auto", @@ -265,7 +265,7 @@ "visible": true, "comments": "", "width": "calc(20% - 50px)", - "height": "10%", + "height": "7%", "expand": "false", "colorText": "auto", "colorWidget": "auto", @@ -336,7 +336,86 @@ "ignoreDefaults": false, "bypass": false, "onCreate": "", - "onValue": "if(value === 1){\n //setVar('main_panel', 'editable', false)\n send(\"/transport\", 1, getProp(\"parent\", \"variables\").piece, get(\"measure\"), get(\"beat\"), get(\"tempo/\" + getProp(\"parent\", \"variables\").piece));\n} else {\n //setVar('main_panel', 'editable', true)\n send(\"/transport\", 0, getProp(\"parent\", \"variables\").piece, get(\"measure\"), get(\"beat\"), get(\"tempo/\" + getProp(\"parent\", \"variables\").piece));\n}" + "onValue": "if(value === 1){\n //setVar('main_panel', 'editable', false)\n send(\"/transport\", 1, getProp(\"parent\", \"variables\").piece, get(\"measure\"), get(\"beat\"), get(\"tempo/\" + getProp(\"parent\", \"variables\").piece), get(\"endmeasure/\" + getProp(\"parent\", \"variables\").piece));\n} else {\n //setVar('main_panel', 'editable', true)\n send(\"/transport\", 0, getProp(\"parent\", \"variables\").piece, get(\"measure\"), get(\"beat\"), get(\"tempo/\" + getProp(\"parent\", \"variables\").piece), get(\"endmeasure/\" + getProp(\"parent\", \"variables\").piece));\n}" + }, + { + "type": "text", + "top": "15%", + "left": "calc(80% + 50px)", + "lock": false, + "id": "endmeasure_label", + "visible": true, + "comments": "", + "width": "calc(20% - 50px)", + "height": "7%", + "expand": "false", + "colorText": "auto", + "colorWidget": "auto", + "colorStroke": "auto", + "colorFill": "auto", + "alphaStroke": "auto", + "alphaFillOff": "auto", + "alphaFillOn": "auto", + "lineWidth": "auto", + "borderRadius": "auto", + "padding": "auto", + "html": "", + "css": ":host{\n font-size: 15rem\n}", + "value": "end measure", + "default": "", + "linkId": "", + "address": "auto", + "preArgs": "", + "target": "", + "onCreate": "", + "onValue": "", + "vertical": false, + "wrap": false, + "align": "center", + "decimals": 2 + }, + { + "type": "input", + "top": "22%", + "left": "calc(80% + 50px)", + "lock": false, + "id": "endmeasure/@{parent.variables.piece}", + "visible": true, + "interaction": true, + "comments": "", + "width": "calc(20% - 50px)", + "height": "7%", + "expand": "false", + "colorText": "auto", + "colorWidget": "auto", + "colorStroke": "auto", + "colorFill": "auto", + "alphaStroke": "auto", + "alphaFillOff": "auto", + "alphaFillOn": "auto", + "lineWidth": "auto", + "borderRadius": "auto", + "padding": "auto", + "html": "", + "css": ":host{\n font-size: 20rem\n}", + "align": "center", + "unit": "", + "asYouType": false, + "numeric": true, + "validation": "", + "maxLength": "", + "value": "@{parent.variables.endmeasure}", + "default": "", + "linkId": "", + "address": "auto", + "preArgs": "", + "typeTags": "", + "decimals": 2, + "target": "", + "ignoreDefaults": false, + "bypass": false, + "onCreate": "", + "onValue": "" } ], "tabs": [] diff --git a/live_utilities/supercollider/live_utilities.scd b/live_utilities/supercollider/live_utilities.scd index 05ebce7..1cd5af0 100644 --- a/live_utilities/supercollider/live_utilities.scd +++ b/live_utilities/supercollider/live_utilities.scd @@ -349,7 +349,7 @@ s.waitForBoot({ clickCreateSynthForLive.value; group = Group.new; - berger = Synth.tail(group, \berger); + //berger = Synth.tail(group, \berger); mixer = Synth.tail(group, \mixer); playbackData = Dictionary.new(n: 6); @@ -394,14 +394,26 @@ s.waitForBoot({ [msg, time, addr, port].postln; if(msg[1] == 0, { //need some work here to make sure all synths are getting cutoff correctly - group.set(\release, 2); - group.set(\gate, 0); + //group.set(\release, 2); + //group.set(\gate, 0); + //group.release; player.stop; }, { var pbinds, transportData, measureLengths, patterns, stream, offset, offsetStream, terminationStream; # pbinds, transportData, measureLengths = playbackData[msg[2]]; - //patterns = Ppar(pbinds.postln.add(createTransportPattern.value(addr, transportData).postln)); - patterns = Ptpar([0, createTransportPattern.value(addr, transportData), 1 * msg[5]/60.0, createClickPattern.value(transportData, group), 8 + (msg[5]/60.0), Ppar(pbinds)]); + //patterns = Ptpar([0, createTransportPattern.value(addr, transportData), 1 * msg[5]/60.0, createClickPattern.value(transportData, group), 8 + (msg[5]/60.0), Ppar(pbinds)]); + + if((msg[6].postln != -1) && (msg[2].postln != "jaendel"), { + var lastItem; + "this still ran".postln; + lastItem = transportData.detectIndex({arg item; item[0] > msg[6]}); + lastItem.postln; + transportData = transportData.keep(lastItem + 1); + }); + patterns = Pfpar([ + createTransportPattern.value(addr, transportData), + Ptpar([1 * msg[5]/60.0, createClickPattern.value(transportData, group), 8 + (msg[5]/60.0), Ppar(pbinds)]) + ]); stream = patterns.asStream; if(msg[3] == 1, { @@ -414,6 +426,7 @@ s.waitForBoot({ terminationStream = Routine({addr.sendMsg("/transport", 0)}); player = EventStreamPlayer(offsetStream ++ stream ++ terminationStream); + //player = EventStreamPlayer(offsetStream ++ stream); tempoClock = TempoClock(msg[5]/60.0); player.play(tempoClock); //player.play(tempoClock, quant: Quant.new(0, 0, -2));