From 40feb72c482654973704d22a451b39f0e2d4cb6a Mon Sep 17 00:00:00 2001 From: boblark Date: Thu, 14 Apr 2022 10:53:49 -0700 Subject: [PATCH] Got correct main.js --- docs/red/main.js | 45 ++++++--------------------------------------- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/docs/red/main.js b/docs/red/main.js index 28bbe4f..1475f51 100644 --- a/docs/red/main.js +++ b/docs/red/main.js @@ -49,7 +49,6 @@ var RED = (function() { name = name.replace(" ", "_").replace("+", "_").replace("-", "_"); return name } - function save(force) { RED.storage.update(); @@ -60,9 +59,9 @@ var RED = (function() { nns.sort(function(a,b){ return (a.x + a.y/250) - (b.x + b.y/250); }); //console.log(JSON.stringify(nns)); - //add the include files first - var cpp = "#include \n#include \n" - + "#include \n" + var cpp ="#include \"OpenAudio_ArduinoLibrary.h\"\n" + + "#include \"AudioStream_F32.h\"\n" + + "#include \n#include \n" + "#include \n#include \n#include \n\n" + "// GUItool: begin automatically generated code\n"; // generate code for all audio processing nodes @@ -91,13 +90,13 @@ var RED = (function() { if (wire) { var parts = wire.split(":"); if (parts.length == 2) { - cpp += "AudioConnection_F32 patchCord" + cordcount + "("; + cpp += "AudioConnection_F32 patchCord" + cordcount + "("; var src = RED.nodes.node(n.id); var dst = RED.nodes.node(parts[0]); var src_name = make_name(src); var dst_name = make_name(dst); if (j == 0 && parts[1] == 0 && src && src.outputs == 1 && dst && dst._def.inputs == 1) { - cpp += src_name + ", " + parts[0]; + cpp += src_name + ", " + dst_name; } else { cpp += src_name + ", " + j + ", " + dst_name + ", " + parts[1]; } @@ -122,37 +121,6 @@ var RED = (function() { } } cpp += "// GUItool: end automatically generated code\n"; - - // generate setup() - cpp += "\n"; - cpp += "\n"; - cpp += "//The setup function is called once when the system starts up\n"; - cpp += "void setup(void) {\n"; - cpp += "\t" + "//Start the USB serial link (to enable debugging)\n"; - cpp += "\t" + "Serial.begin(115200); delay(500);\n"; - cpp += "\t" + "Serial.println(\"Setup starting...\");\n"; - cpp += "\t" + "\n" - cpp += "\t" + "//Allocate dynamically shuffled memory for the audio subsystem\n"; - cpp += "\t" + "AudioMemory(10); AudioMemory_F32(10);\n"; - cpp += "\t" + "\n"; - - // Need to add "begin()" call for AudioControl objects!!! - - cpp += "\t" + "//Put your own setup code here\n"; - cpp += "\t" + "\n"; - cpp += "\t" + "//End of setup\n"; - cpp += "\t" + "Serial.println(\"Setup complete.\");\n"; - cpp += "};\n"; - - // generate loop() - cpp += "\n"; - cpp += "\n"; - cpp += "//After setup(), the loop function loops forever.\n"; - cpp += "//Note that the audio modules are called in the background.\n"; - cpp += "//They do not need to be serviced by the loop() function.\n" - cpp += "void loop(void) {\n"; - cpp += "\n"; - cpp += "};"; //console.log(cpp); RED.view.state(RED.state.EXPORT); @@ -165,7 +133,7 @@ var RED = (function() { return false; }); }).focus(); - $( "#dialog" ).dialog("option","title","Export to Arduino").dialog("option","width",600).dialog( "open" ); + $( "#dialog" ).dialog("option","title","Export to Arduino").dialog( "open" ); }); //RED.view.dirty(false); } else { @@ -210,7 +178,6 @@ var RED = (function() { } ] }); - // from http://css-tricks.com/snippets/javascript/get-url-variables/ function getQueryVariable(variable) { var query = window.location.search.substring(1);