10 Commits

4 changed files with 535 additions and 228 deletions

View File

@@ -39,6 +39,94 @@
"subpatcher_template" : "",
"assistshowspatchername" : 0,
"boxes" : [ {
"box" : {
"id" : "obj-50",
"linecount" : 2,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 86.75, 1045.0, 150.0, 33.0 ],
"text" : "bang out wave types, waves and functions"
}
}
, {
"box" : {
"id" : "obj-42",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"patching_rect" : [ 35.0, 1017.0, 55.0, 22.0 ],
"text" : "del 2000"
}
}
, {
"box" : {
"id" : "obj-29",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 3,
"outlettype" : [ "bang", "bang", "bang" ],
"patching_rect" : [ 35.0, 1045.0, 42.0, 22.0 ],
"text" : "t b b b"
}
}
, {
"box" : {
"id" : "obj-19",
"maxclass" : "button",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"parameter_enable" : 0,
"patching_rect" : [ 517.0, 1149.0, 24.0, 24.0 ]
}
}
, {
"box" : {
"id" : "obj-79",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"patching_rect" : [ 35.0, 989.0, 58.0, 22.0 ],
"text" : "loadbang"
}
}
, {
"box" : {
"id" : "obj-69",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 4,
"outlettype" : [ "", "", "", "" ],
"patching_rect" : [ 844.0, 1136.5, 56.0, 22.0 ],
"restore" : {
"umenu" : [ 1 ],
"umenu[1]" : [ 0 ],
"umenu[2]" : [ 1 ],
"umenu[3]" : [ 0 ],
"userFunction1" : [ 1000.0, 0.0, 100.0, 0.0, 0.0, 0, 549.512830503443411, 0.0, 0, 549.512830503443411, 100.0, 0, 859.042553191489333, 0.0, 0, 916.534107099188191, 100.0, 0, 1000.0, 62.666666666666664, 0, "linear" ],
"userFunction2" : [ 1000.0, 0.0, 100.0, 0.0, 0.0, 0, 108.474576271186436, 100.0, 0, 108.474576271186436, 100.0, 0, 1000.0, 0.0, 0, "linear" ],
"userFunction3" : [ 1000.0, 0.0, 100.0, 0.0, 0.0, 0, 390.95744680851061, 0.0, 0, 390.95744680851061, 82.666666666666671, 0, 638.418079096045176, 100.0, 0, 881.355932203389784, 51.851851851851855, 0, "linear" ],
"userFunction4" : [ 1000.0, 0.0, 100.0, 0.0, 62.666666666666664, 0, 101.694915254237287, 100.0, 0, 230.363894333230689, 0.0, 0, 549.512830503443411, 0.0, 0, 861.016949152542338, 100.0, 0, 1000.0, 0.0, 0, "linear" ],
"userWave1" : [ 1, 1, 1, 1, 1, 1, 112, 112, 112, 112, 112, 110, 107, 107, 105, 103, 103, 0, 0, 0, 0, 2, 9, 15, 24, 31, 37, 44, 51, 64, 69, 73, 78, 90, 97, 107, 111, 115, 122, 0, 51, 90, 1, 1, 1, 1, 1, 1, 1, 1 ],
"userWave2" : [ 1, 1, 1, 1, 1, 1, 1, 54, 66, 68, 76, 81, 85, 88, 90, 95, 100, 103, 105, 105, 105, 103, 98, 95, 88, 78, 71, 64, 56, 46, 37, 29, 20, 10, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ],
"userWave3" : [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 44, 51, 54, 59, 61, 66, 68, 73, 76, 81, 83, 85, 87, 90, 93, 93, 95, 98, 98, 100, 100, 100, 100, 100, 100, 98, 90, 85, 81, 73, 64, 56, 46, 39, 24, 17, 2, 0, 1 ],
"userWave4" : [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 73, 77, 83, 93, 100, 107, 115, 117, 120, 122, 122, 100, 51, 59, 66, 73, 83, 90, 90, 93, 37, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
}
,
"text" : "autopattr",
"varname" : "u828007405"
}
}
, {
"box" : {
"id" : "obj-57",
"maxclass" : "newobj",
@@ -85,19 +173,6 @@
"text" : "route debug"
}
}
, {
"box" : {
"id" : "obj-19",
"linecount" : 7,
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 330.0, 1659.0, 332.0, 102.0 ],
"text" : "userFunction 2 0. 9. 18. 28. 37. 46. 55. 65. 74. 83. 92. 100. 99. 98. 96. 95. 94. 93. 92. 91. 90. 89. 87. 86. 85. 84. 83. 82. 81. 80. 79. 77. 76. 75. 74. 73. 72. 71. 70. 68. 67. 66. 65. 64. 63. 62. 61. 59. 58. 57. 56. 55. 54. 53. 52. 50. 49. 48. 47. 46. 45. 44. 43. 42. 40. 39. 38. 37. 36. 35. 34. 33. 31. 30. 29. 28. 27. 26. 25. 24. 22. 21. 20. 19. 18. 17. 16. 15. 13. 12. 11. 10. 9. 8. 7. 6. 4. 3. 2. 1. 0."
}
}
, {
"box" : {
@@ -118,7 +193,7 @@
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 727.0, 1373.0, 119.0, 22.0 ],
"text" : "userDefinedType 4 0"
"text" : "userDefinedType 3 1"
}
}
@@ -947,6 +1022,7 @@
"box" : {
"addpoints" : [ 0.0, 0.0, 0, 108.474576271186436, 100.0, 0, 108.474576271186436, 100.0, 0, 1000.0, 0.0, 0 ],
"classic_curve" : 1,
"hidden" : 1,
"id" : "obj-143",
"maxclass" : "function",
"numinlets" : 1,
@@ -970,7 +1046,7 @@
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"parameter_enable" : 0,
"patching_rect" : [ 58.0, 1407.0, 24.0, 24.0 ]
"patching_rect" : [ 35.0, 1399.0, 24.0, 24.0 ]
}
}
@@ -1318,7 +1394,8 @@
"parameter_enable" : 0,
"patching_rect" : [ 844.0, 1185.0, 106.0, 22.0 ],
"presentation" : 1,
"presentation_rect" : [ 192.0, 148.0, 106.0, 22.0 ]
"presentation_rect" : [ 192.0, 148.0, 106.0, 22.0 ],
"varname" : "umenu[3]"
}
}
@@ -1345,7 +1422,8 @@
"parameter_enable" : 0,
"patching_rect" : [ 735.0, 1185.0, 106.0, 22.0 ],
"presentation" : 1,
"presentation_rect" : [ 16.0, 148.0, 106.0, 22.0 ]
"presentation_rect" : [ 16.0, 148.0, 106.0, 22.0 ],
"varname" : "umenu[2]"
}
}
@@ -1372,7 +1450,8 @@
"parameter_enable" : 0,
"patching_rect" : [ 626.0, 1185.0, 106.0, 22.0 ],
"presentation" : 1,
"presentation_rect" : [ 192.0, 36.0, 106.0, 22.0 ]
"presentation_rect" : [ 192.0, 36.0, 106.0, 22.0 ],
"varname" : "umenu[1]"
}
}
@@ -1737,7 +1816,8 @@
"parameter_enable" : 0,
"patching_rect" : [ 517.0, 1185.0, 106.0, 22.0 ],
"presentation" : 1,
"presentation_rect" : [ 16.0, 36.0, 106.0, 22.0 ]
"presentation_rect" : [ 16.0, 36.0, 106.0, 22.0 ],
"varname" : "umenu"
}
}
@@ -1790,19 +1870,7 @@
}
, {
"box" : {
"id" : "obj-55",
"linecount" : 3,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 411.0, 965.0, 251.0, 47.0 ],
"text" : "on opening on new computer, nothing is loaded. start with template dictionary with basic buttons etc available"
}
}
, {
"box" : {
"addpoints" : [ 0.0, 0.0, 0, 128.81355932203391, 100.0, 0, 230.363894333230689, 0.0, 0, 390.95744680851061, 82.666666666666671, 0, 549.512830503443411, 0.0, 0, 613.342617737485966, 100.0, 0, 859.042553191489333, 0.0, 0, 916.534107099188191, 100.0, 0, 1000.0, 62.666666666666664, 0 ],
"addpoints" : [ 0.0, 0.0, 0, 549.512830503443411, 0.0, 0, 549.512830503443411, 100.0, 0, 859.042553191489333, 0.0, 0, 916.534107099188191, 100.0, 0, 1000.0, 62.666666666666664, 0 ],
"classic_curve" : 1,
"id" : "obj-7",
"maxclass" : "function",
@@ -1875,15 +1943,15 @@
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 1148.0, 42.0, 134.0, 22.0 ],
"patching_rect" : [ 915.0, 121.0, 277.0, 22.0 ],
"saved_object_attributes" : {
"client_rect" : [ 100, 172, 454, 300 ],
"client_rect" : [ 113, 112, 658, 432 ],
"parameter_enable" : 0,
"parameter_mappable" : 0,
"storage_rect" : [ 583, 69, 1034, 197 ]
"storage_rect" : [ 1282, 626, 1887, 1000 ]
}
,
"text" : "pattrstorage myStorage",
"text" : "pattrstorage myStorage @savemode 3 @greedy 1",
"varname" : "myStorage"
}
@@ -1900,7 +1968,7 @@
"data" : {
"enumArrays" : [ [ 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ "1", "1", "4", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "2", "2", "2", 2, "2", "2", "2", "2", "2", "2" ], [ "attenuation", "attenuation", "meter", "NONE", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation" ] ],
"enumMats" : [ [ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ "0", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] ], [ [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "4 4", "3 4", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ] ] ],
"modArrays" : [ [ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ "Noise", "Noise", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO" ], [ "1", "4", "4", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "SawDown", "Custom_1", "Custom_3", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine" ], [ "Rand", "Rand", "Rand", "Rand", "Rand", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int." ], [ "metriclarity", "event_length", "pulse_length", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE" ], [ "2s", "4.3hz", "5s", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz" ], [ "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ], [ "3", "1", "1.5", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ], [ 0.501999999999999, 0.517199999999974, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0.698985982223206, 0.806437435585266, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0.327266857513609, 0.735965365669296, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]
"modArrays" : [ [ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ "Noise", "Noise", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO" ], [ "1", "4", "4", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "SawDown", "Custom_1", "Custom_3", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine" ], [ "Rand", "Rand", "Rand", "Rand", "Rand", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int." ], [ "metriclarity", "event_length", "pulse_length", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE" ], [ "2s", "4.3hz", "5s", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz" ], [ "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ], [ "3", "1", "1.5", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ], [ 0.500999999999999, 0.108599999999996, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0.910608408902102, 0.527575869952469, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0.580088996266698, 0.294573880986049, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]
}
}
@@ -1922,7 +1990,7 @@
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 411.0, 930.0, 252.0, 33.0 ],
"patching_rect" : [ 410.5, 912.0, 252.0, 33.0 ],
"text" : "make automatic saving, make automatic load on changing snapshot"
}
@@ -1961,7 +2029,6 @@
"candicane7" : [ 0.878431, 0.243137, 0.145098, 1.0 ],
"candicane8" : [ 0.027451, 0.447059, 0.501961, 1.0 ],
"contdata" : 1,
"hidden" : 1,
"id" : "obj-61",
"maxclass" : "multislider",
"numinlets" : 1,
@@ -1978,17 +2045,6 @@
"varname" : "userWave2"
}
}
, {
"box" : {
"id" : "obj-29",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 411.0, 908.0, 251.0, 20.0 ],
"text" : "add function object support"
}
}
, {
"box" : {
@@ -2211,7 +2267,7 @@
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"parameter_enable" : 0,
"patching_rect" : [ 144.0, 1140.0, 24.0, 24.0 ]
"patching_rect" : [ 144.0, 1123.0, 24.0, 24.0 ]
}
}
@@ -2326,7 +2382,7 @@
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 490.0, 722.0, 84.0, 35.0 ],
"text" : "metriclarity 1.169025"
"text" : "metriclarity 1.655165"
}
}
@@ -2433,7 +2489,7 @@
"data" : {
"enumArrays" : [ [ 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ "1", "1", "4", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "2", "2", "2", 2, "2", "2", "2", "2", "2", "2" ], [ "attenuation", "attenuation", "meter", "NONE", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation", "attenuation" ] ],
"enumMats" : [ [ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ "0", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] ], [ [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "4 4", "3 4", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ], [ "param", "param", "param", "param", "param", "param", "param", "param", "param", "param" ] ] ],
"modArrays" : [ [ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ "Noise", "Noise", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO" ], [ "1", "4", "4", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "SawDown", "Custom_1", "Custom_3", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine" ], [ "Rand", "Rand", "Rand", "Rand", "Rand", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int." ], [ "metriclarity", "event_length", "pulse_length", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE" ], [ "2s", "4.3hz", "5s", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz" ], [ "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ], [ "3", "1", "1.5", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ], [ 0.501999999999999, 0.517199999999974, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0.698985982223206, 0.806437435585266, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0.327266857513609, 0.735965365669296, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]
"modArrays" : [ [ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ "Noise", "Noise", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO", "LFO" ], [ "1", "4", "4", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "SawDown", "Custom_1", "Custom_3", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine", "Sine" ], [ "Rand", "Rand", "Rand", "Rand", "Rand", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int.", "Sine Int." ], [ "metriclarity", "event_length", "pulse_length", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE" ], [ "2s", "4.3hz", "5s", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz", "1hz" ], [ "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ], [ "3", "1", "1.5", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1" ], [ "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ], [ 0.500999999999999, 0.108599999999996, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0.910608408902102, 0.527575869952469, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0.580088996266698, 0.294573880986049, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]
}
}
@@ -2840,6 +2896,31 @@
, {
"patchline" : {
"destination" : [ "obj-124", 0 ],
"order" : 3,
"source" : [ "obj-126", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-139", 0 ],
"order" : 2,
"source" : [ "obj-126", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-144", 0 ],
"order" : 1,
"source" : [ "obj-126", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-149", 0 ],
"order" : 0,
"source" : [ "obj-126", 0 ]
}
@@ -2876,15 +2957,6 @@
, {
"patchline" : {
"destination" : [ "obj-154", 0 ],
"order" : 1,
"source" : [ "obj-141", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-19", 1 ],
"order" : 0,
"source" : [ "obj-141", 0 ]
}
@@ -3030,6 +3102,38 @@
"source" : [ "obj-16", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-3", 0 ],
"order" : 3,
"source" : [ "obj-19", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-88", 0 ],
"order" : 2,
"source" : [ "obj-19", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-91", 0 ],
"order" : 1,
"source" : [ "obj-19", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-96", 0 ],
"order" : 0,
"source" : [ "obj-19", 0 ]
}
}
, {
"patchline" : {
@@ -3088,6 +3192,27 @@
"source" : [ "obj-27", 3 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-126", 0 ],
"source" : [ "obj-29", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-19", 0 ],
"source" : [ "obj-29", 2 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-43", 0 ],
"source" : [ "obj-29", 1 ]
}
}
, {
"patchline" : {
@@ -3170,10 +3295,42 @@
"source" : [ "obj-40", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-29", 0 ],
"source" : [ "obj-42", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-115", 0 ],
"order" : 0,
"source" : [ "obj-43", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-117", 0 ],
"order" : 1,
"source" : [ "obj-43", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-33", 0 ],
"order" : 3,
"source" : [ "obj-43", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-61", 0 ],
"order" : 2,
"source" : [ "obj-43", 0 ]
}
@@ -3385,6 +3542,102 @@
"source" : [ "obj-63", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-115", 0 ],
"order" : 6,
"source" : [ "obj-69", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-117", 0 ],
"order" : 7,
"source" : [ "obj-69", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-143", 0 ],
"order" : 8,
"source" : [ "obj-69", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-148", 0 ],
"order" : 5,
"source" : [ "obj-69", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-153", 0 ],
"order" : 2,
"source" : [ "obj-69", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-3", 0 ],
"order" : 4,
"source" : [ "obj-69", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-33", 0 ],
"order" : 10,
"source" : [ "obj-69", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-61", 0 ],
"order" : 9,
"source" : [ "obj-69", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-7", 0 ],
"order" : 11,
"source" : [ "obj-69", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-88", 0 ],
"order" : 3,
"source" : [ "obj-69", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-91", 0 ],
"order" : 1,
"source" : [ "obj-69", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-96", 0 ],
"order" : 0,
"source" : [ "obj-69", 0 ]
}
}
, {
"patchline" : {
@@ -3420,6 +3673,13 @@
"source" : [ "obj-76", 2 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-42", 0 ],
"source" : [ "obj-79", 0 ]
}
}
, {
"patchline" : {

View File

@@ -3,12 +3,31 @@
--unlocked-color: #ff5153;
}
:root {
--background: ivory;
--active: royalblue;
--nonactive: lightsteelblue;
--alert: red;
--textcolor: #737373;
}
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
html {
background-color: var(--background);
}
body {
font-family: "Poppins", sans-serif;
}
html, body {
width: 100%;
height: 100%;
margin: 0px;
border: 0;
overflow: hidden; /* Disable scrollbars */
overflow-x: hidden; /* no horizontal scrollbar*/
overflow-y: scroll;
display: block; /* No floating content on sides */
}
@@ -24,6 +43,9 @@ li {
float: left;
}
table {
overflow: scroll;
}
input[type=number] {
width: 50px;
@@ -183,7 +205,15 @@ h5 {
#pulse {
animation: pulse-animation 0.2s normal;
}
/* :::::::::::::: SELECTING MODULATORS/ENUMERATORS */
.highlighted-button {
background-color: gray;
}
.unhighlighted-button {
background-color: white;
}
/* :::::::::::::: LOCK CSS */
.locked-component {
@@ -192,10 +222,10 @@ h5 {
color : white;
}
.container {
.header {
display: flex;
width: 100%;
justify-content: space-between;
flex-direction: flex;
}
/* Locked */

306
lfogui.js
View File

@@ -4,50 +4,50 @@ var log;
if (DEBUG)
log = console.log;
else
log = (msg) => {window.max.outlet("debug " + msg)};
log = (msg) => { window.max.outlet("debug " + msg) };
const e = React.createElement;
let lfos = [];
const MAXLFOS = 20;
const MAXENUMS = 20;
const MAXLFOS = 200;
const MAXENUMS = 200;
const MAXENUMPOINTS = 10;
const MAXUSERDEFINED = 4;
const ViewModes = Object.freeze({
MOD: 0,
ENUM: 1
MOD: 0,
ENUM: 1
});
const LockModes = Object.freeze({
UNLOCK: 0,
LOCK: 1
UNLOCK: 0,
LOCK: 1
});
var modPhases = Array(MAXLFOS).fill(0);
var firstUpdateTime = Date.now();
const MODULATORLABELS = ["inst", "-type-", "---shape---", "-------param-------", "--timebase--", "-min-", "-max", "-phase-", "center"];
const ENUMERATORLABELS = ["inst", "---parameter---", "-# points-"];
const MODULATORLABELS = ["inst", "type", "shape", "param", "timebase", "min", "max", "phase", "center"];
const ENUMERATORLABELS = ["inst", "parameter", "# points"];
function parseLfoTimeNonMusical(lfoTime){
if (lfoTime.slice(-2) == "hz"){
function parseLfoTimeNonMusical(lfoTime) {
if (lfoTime.slice(-2) == "hz") {
return parseFloat(lfoTime.slice(0, -2));
}
else if (lfoTime.slice(-2) == "ms"){
else if (lfoTime.slice(-2) == "ms") {
return 1000 / parseFloat(lfoTime.slice(0, -2));
}
else if (lfoTime.slice(-1) == "s"){
else if (lfoTime.slice(-1) == "s") {
return 1 / parseFloat(lfoTime.slice(0, -1));
}
else if ((lfoTime.match(/:/g) || []).length == 2){
else if ((lfoTime.match(/:/g) || []).length == 2) {
return 1 / moment.duration(lfoTime).asSeconds();
}
else if ((lfoTime.match(/\./g) || []).length == 2){
else if ((lfoTime.match(/\./g) || []).length == 2) {
return 0; // ignore musical timings
}
else {
@@ -55,24 +55,18 @@ function parseLfoTimeNonMusical(lfoTime){
}
}
function nnFreqToHzString(num){
function nnFreqToHzString(num) {
return `${num}hz`;
}
function MasterLfoHandler(){
function MasterLfoHandler() {
let initVisArr = Array(MAXLFOS).fill(false);
initVisArr[0] = true;
const [viewMode, setViewMode] = React.useState(ViewModes.MOD);
const toggleViewMode = () => {
if (viewMode === ViewModes.MOD)
setViewMode(ViewModes.ENUM);
else
setViewMode(ViewModes.MOD);
};
const [lockMode, setLockMode] = React.useState(LockModes.LOCK);
const [lockMode, setLockMode] = React.useState(LockModes.UNLOCK);
const toggleLockMode = () => {
if (lockMode === LockModes.UNLOCK)
setLockMode(LockModes.LOCK);
@@ -80,12 +74,24 @@ function MasterLfoHandler(){
setLockMode(LockModes.UNLOCK);
};
const [enabled, setEnabled] = React.useState(false);
const toggleEnabled = () => {
setEnabled(!enabled);
};
const displayIfEnabled = (content) => {
if (enabled)
return content
}
let toggleEnabledText = enabled ? "Hide" : "Show";
/// MODULATOR ARRAYS
let userDefinedWavesBase = [];
let userDefinedFunctionsBase = [];
let userDefinedTypesBase = [0, 0, 0, 0]; //0 = wave, 1 = function
for (let i=0; i<MAXUSERDEFINED; i++){
for (let i = 0; i < MAXUSERDEFINED; i++) {
userDefinedWavesBase.push(Array(50).fill(0));
userDefinedFunctionsBase.push(Array(101).fill(0));
}
@@ -96,14 +102,14 @@ function MasterLfoHandler(){
const [modTypeArr, setModTypeArr] = React.useState(Array(MAXLFOS).fill('LFO'));
const [modInstanceNumArr, setModInstanceNumArr] = React.useState(Array(MAXLFOS).fill('1'));
const [modCenterVals, setModCenterVals] = React.useState({'1':{}, '2':{}, '3':{}, '4':{}});
const [modCenterVals, setModCenterVals] = React.useState({ '1': {}, '2': {}, '3': {}, '4': {} });
const [ticks, setTicks] = React.useState(0);
const [beatsInMeasure, setBeatsInMeasure] = React.useState(4);
const [noiseTypeArr, setNoiseTypeArr] = React.useState(Array(MAXLFOS).fill('Sine Int.'));
const [shapeArr, setShapeArr] = React.useState(Array(MAXLFOS).fill('Sine'));
const [djParamArr, setDjParamArr] = React.useState(Array(MAXLFOS).fill('NONE'));
const [djParamArr, setDjParamArr] = React.useState(Array(MAXLFOS).fill('NONE'));
const [freqArr, setFreqArr] = React.useState(Array(MAXLFOS).fill('1hz'));
@@ -116,7 +122,7 @@ function MasterLfoHandler(){
const [cachedNoiseValueArr1, setCachedNoiseValueArr1] = React.useState(Array(MAXLFOS).fill(0));
const [cachedNoiseValueArr2, setCachedNoiseValueArr2] = React.useState(Array(MAXLFOS).fill(0));
const allModArrays = [modVisibleArr, modTypeArr, modInstanceNumArr, shapeArr, noiseTypeArr, djParamArr, freqArr, minArr, maxArr, initPhaseArr, lastPhaseArr, cachedNoiseValueArr1, cachedNoiseValueArr2];
const allModSetters = [setModVisibleArr, setModTypeArr, setModInstanceNumArr, setShapeArr, setNoiseTypeArr, setDjParamArr, setFreqArr, setMinArr, setMaxArr, setInitPhaseArr, setLastPhaseArr, setCachedNoiseValueArr1, setCachedNoiseValueArr2];
@@ -127,27 +133,27 @@ function MasterLfoHandler(){
const [enumVisibleArr, setEnumVisibleArr] = React.useState(initVisArr);
const [enumInstanceNumArr, setEnumInstanceNumArr] = React.useState(Array(MAXLFOS).fill('1'));
const [enumItemCounts, setEnumItemCounts] = React.useState(Array(MAXENUMPOINTS).fill('2'));
const [enumDjParamArr, setEnumDjParamArr] = React.useState(Array(MAXENUMPOINTS).fill('NONE'));
const [enumDjParamArr, setEnumDjParamArr] = React.useState(Array(MAXENUMPOINTS).fill('NONE'));
let baseEnumBreakpoints = Array(MAXENUMS).fill(0).map(x => Array(MAXENUMPOINTS+ 1).fill(0));
for (let i = 0; i < MAXENUMS; i++){
for (let j=0; j < MAXENUMPOINTS + 1; j++){
let baseEnumBreakpoints = Array(MAXENUMS).fill(0).map(x => Array(MAXENUMPOINTS + 1).fill(0));
for (let i = 0; i < MAXENUMS; i++) {
for (let j = 0; j < MAXENUMPOINTS + 1; j++) {
baseEnumBreakpoints[i][j] = j - 0.5;
}
}
const [enumBreakPoints, setEnumBreakPoints] = React.useState(baseEnumBreakpoints);
const [enumBreakPoints, setEnumBreakPoints] = React.useState(baseEnumBreakpoints);
const getBlankEnumBreakPointRow = () => {
let arr = []
for (let i=0; i< MAXENUMPOINTS + 1; i++)
for (let i = 0; i < MAXENUMPOINTS + 1; i++)
arr.push(i - 0.5)
return arr;
}
const getBlankEnumNameRow = () => {return Array(MAXENUMPOINTS).fill('param')};
const getBlankEnumNameRow = () => { return Array(MAXENUMPOINTS).fill('param') };
let baseEnumNames = Array(MAXENUMS).fill(0).map(x => Array(MAXENUMPOINTS).fill('param'));
const [enumNames, setEnumNames] = React.useState(baseEnumNames);
const [enumNames, setEnumNames] = React.useState(baseEnumNames);
const allEnumArrays = [enumVisibleArr, enumInstanceNumArr, enumItemCounts, enumDjParamArr];
const allEnumArrSetters = [setEnumVisibleArr, setEnumInstanceNumArr, setEnumItemCounts, setEnumDjParamArr];
@@ -165,14 +171,14 @@ function MasterLfoHandler(){
React.useEffect(() => {
function handleLoad(event) {
window.max.getDict(event.detail, (dict) => {
for (let i = 0; i<dict.data.modArrays.length; i++) {
for (let i = 0; i < dict.data.modArrays.length; i++) {
allModSetters[i](dict.data.modArrays[i]);
}
for (let i = 0; i<allEnumArrays.length; i++) {
for (let i = 0; i < allEnumArrays.length; i++) {
allEnumArrSetters[i](dict.data.enumArrays[i]);
}
for (let i = 0; i<allEnumMats.length; i++) {
for (let i = 0; i < allEnumMats.length; i++) {
allEnumMatSetters[i](dict.data.enumMats[i]);
}
})
@@ -180,36 +186,36 @@ function MasterLfoHandler(){
function handleSave(event) {
let data = {
'modArrays' : allModArrays,
'enumArrays' : allEnumArrays,
'enumMats' : allEnumMats
'modArrays': allModArrays,
'enumArrays': allEnumArrays,
'enumMats': allEnumMats
}
window.max.setDict(event.detail, {"data" : data});
window.max.setDict(event.detail, { "data": data });
window.max.outlet("saved");
}
// only called internally by 1. Handler after modulator processing 2. LFO outputs
function handleEnum(event){
function handleEnum(event) {
let inst = event.detail[0];
let name = event.detail[1];
let val = event.detail[2];
// if none of the Enums use this param, then we output it
let i = 0;
while (i < MAXENUMS){
while (i < MAXENUMS) {
if (enumVisibleArr[i] && enumDjParamArr[i] == name && enumInstanceNumArr[i] == inst)
break;
i++
}
if (i == MAXENUMS){
if (i == MAXENUMS) {
window.max.outlet(inst + ' ' + name + ' ' + val);
}
else {
enumerate(name, inst, val, enumItemCounts[i], enumBreakPoints[i], enumNames[i]);
}
}
@@ -219,45 +225,45 @@ function MasterLfoHandler(){
let val = event.detail[2];
// CHECK FOR INDEX OF THIS NAME IN ENUM MATRIX, AND IF IT IS THERE DENUMERATE
let index = -1;
for (let i = 0; i < MAXENUMS; i++){
for (let i = 0; i < MAXENUMS; i++) {
if (enumDjParamArr[i] == name && enumInstanceNumArr[i] == inst)
index = i;
}
if (index != -1){
if (index != -1) {
val = denumerate(val, enumItemCounts[index], enumBreakPoints[index], enumNames[index]);
}
// if none of the LFOs use this param, then we send it straight to the enum
let i = 0;
while (i < MAXLFOS){
while (i < MAXLFOS) {
if (modVisibleArr[i] && djParamArr[i] == name && modInstanceNumArr[i] == inst)
break;
i++;
}
if (i == MAXLFOS){
window.dispatchEvent(new CustomEvent('enum', {'detail' : [inst, name, val]}));
if (i == MAXLFOS) {
window.dispatchEvent(new CustomEvent('enum', { 'detail': [inst, name, val] }));
}
modCenterVals[inst][name] = val;
setModCenterVals(modCenterVals);
rerender(!render); // BAD! SHOULD NOT BE DOING THIS!
}
function handleTick(event) {
let time = (Date.now() - firstUpdateTime) / 1000;
let noiseData = {lastPhaseArr, setLastPhaseArr, cachedNoiseValueArr1, setCachedNoiseValueArr1, cachedNoiseValueArr2, setCachedNoiseValueArr2, noiseTypeArr};
let noiseData = { lastPhaseArr, setLastPhaseArr, cachedNoiseValueArr1, setCachedNoiseValueArr1, cachedNoiseValueArr2, setCachedNoiseValueArr2, noiseTypeArr };
operateModulators(modVisibleArr, modTypeArr, modInstanceNumArr, djParamArr, modCenterVals, freqArr, minArr, maxArr, shapeArr, initPhaseArr, noiseData, userDefinedWaves, userDefinedFunctions, userDefinedTypes, time, beatsInMeasure, ticks);
}
function handleTimeSig(event) {
setBeatsInMeasure(parseFloat(event.detail[0]) * parseFloat(event.detail[1])/ 4);
setBeatsInMeasure(parseFloat(event.detail[0]) * parseFloat(event.detail[1]) / 4);
}
function handleChangeUserWave(event){
function handleChangeUserWave(event) {
userDefinedWaves[event.detail.index] = event.detail.points;
setUserDefinedWaves(userDefinedWaves);
}
@@ -268,66 +274,66 @@ function MasterLfoHandler(){
}
function handleChangeUserDefinedType(event) {
userDefinedTypes[event.detail.index-1] = event.detail.type;
userDefinedTypes[event.detail.index - 1] = event.detail.type;
setUserDefinedTypes(userDefinedTypes);
}
function handleMaxTicks(event){
function handleMaxTicks(event) {
setTicks(event.detail);
}
function setNN(event){
for (let i=0; i<MAXLFOS; i++){
function setNN(event) {
for (let i = 0; i < MAXLFOS; i++) {
freqArr[i] = nnFreqToHzString(event.detail[i]);
}
setFreqArr(freqArr)
for (let i=MAXLFOS; i<MAXLFOS * 2; i++){
for (let i = MAXLFOS; i < MAXLFOS * 2; i++) {
minArr[i - MAXLFOS] = event.detail[i];
}
setMinArr(minArr);
for (let i=MAXLFOS*2; i<MAXLFOS * 3; i++){
maxArr[i - MAXLFOS*2] = event.detail[i];
for (let i = MAXLFOS * 2; i < MAXLFOS * 3; i++) {
maxArr[i - MAXLFOS * 2] = event.detail[i];
}
setMaxArr(maxArr);
for (let i=MAXLFOS*3; i<MAXLFOS * 4; i++){
initPhaseArr[i - MAXLFOS*3] = parseFloat(event.detail[i]);
for (let i = MAXLFOS * 3; i < MAXLFOS * 4; i++) {
initPhaseArr[i - MAXLFOS * 3] = parseFloat(event.detail[i]);
}
setInitPhaseArr(initPhaseArr);
for (let i=MAXLFOS*4; i<MAXLFOS * 5; i++){
let index = i - MAXLFOS*4;
for (let i = MAXLFOS * 4; i < MAXLFOS * 5; i++) {
let index = i - MAXLFOS * 4;
let inst = modInstanceNumArr[index];
let param = djParamArr[index];
modCenterVals[inst][param] = parseFloat(event.detail[i]);
}
setModCenterVals(modCenterVals);
rerender(!render); // BAD! SHOULD NOT BE DOING THIS!
}
function dumpNN(event){
function dumpNN(event) {
let allNNData = [];
freqArr.forEach(element => {
allNNData.push(parseLfoTimeNonMusical(element));
});
});
allNNData = allNNData.concat(minArr);
allNNData = allNNData.concat(maxArr);
allNNData = allNNData.concat(initPhaseArr);
let lfoMatchedCenterVals = [];
for (let i=0; i<MAXLFOS; i++){
for (let i = 0; i < MAXLFOS; i++) {
let inst = modInstanceNumArr[i];
let param = djParamArr[i];
lfoMatchedCenterVals.push(modCenterVals[inst][param]);
if (!lfoMatchedCenterVals[i])
lfoMatchedCenterVals[i] = 0
}
allNNData = allNNData.concat(lfoMatchedCenterVals);
window.max.outlet("NNdata " + allNNData.join(" "));
@@ -364,8 +370,8 @@ function MasterLfoHandler(){
}, [...allModArrays, ...allEnumArrays, ...allEnumMats, userDefinedWaves, userDefinedFunctions, userDefinedTypes, modCenterVals, render, beatsInMeasure, ticks]);
function CheckLinked(inst, param, checkInstArr, checkParamArr){
for (let i = 0; i < checkInstArr.length; i++){
function CheckLinked(inst, param, checkInstArr, checkParamArr) {
for (let i = 0; i < checkInstArr.length; i++) {
if (checkInstArr[i] == inst && checkParamArr[i] == param)
return true;
}
@@ -376,14 +382,14 @@ function MasterLfoHandler(){
// Generate Modulators
///////
let modContents = []
for (var i = 0; i<MAXLFOS; i++){
for (var i = 0; i < MAXLFOS; i++) {
let id = i;
modContents.push(
e(LfoRow, {
locked : lockMode,
instanceNum : modInstanceNumArr[i],
locked: lockMode,
instanceNum: modInstanceNumArr[i],
setInstanceNum: CreateParamChanger(modInstanceNumArr, setModInstanceNumArr, i),
type: modTypeArr[i],
@@ -404,7 +410,7 @@ function MasterLfoHandler(){
//setAmp: CreateParamChanger(ampArr, setAmpArr, i),
min: minArr[i],
setMin : CreateParamChanger(minArr, setMinArr, i),
setMin: CreateParamChanger(minArr, setMinArr, i),
max: maxArr[i],
setMax: CreateParamChanger(maxArr, setMaxArr, i),
@@ -414,14 +420,14 @@ function MasterLfoHandler(){
linked: CheckLinked(modInstanceNumArr[i], djParamArr[i], enumInstanceNumArr, enumDjParamArr),
addLfo: () => {
if (id < MAXLFOS - 1){
if (modVisibleArr[id + 1]){
if (id < MAXLFOS - 1) {
if (modVisibleArr[id + 1]) {
let emptyIndex = modVisibleArr.findIndex((item) => !item);
if (emptyIndex != -1){
for (var j = 0; j < allModArrays.length; j++){
if (emptyIndex != -1) {
for (var j = 0; j < allModArrays.length; j++) {
let array = allModArrays[j];
// remove from all arrays
array.splice(emptyIndex, 1);
@@ -432,27 +438,27 @@ function MasterLfoHandler(){
}
}
else {
for (var j = 0; j < allModArrays.length; j++){ // no space below, easy.
for (var j = 0; j < allModArrays.length; j++) { // no space below, easy.
let array = allModArrays[j];
array[id + 1] = modBlankVals[j];
allModSetters[j](array);
}
}
rerender(!render);
}
},
removeLfo: () => {
if (modVisibleArr.filter(x=>x).length > 1){
if (modVisibleArr.filter(x => x).length > 1) {
let newArr = modVisibleArr.slice();
newArr[id] = false;
setModVisibleArr(newArr);
}
}
},
null));
},
null));
}
@@ -460,13 +466,13 @@ function MasterLfoHandler(){
// Generate Enumerators
///////
let enumContents = []
for (var i = 0; i<MAXLFOS; i++){
for (var i = 0; i < MAXLFOS; i++) {
let id = i;
enumContents.push(
e(EnumeratorRow, {
index: i,
locked : lockMode,
instanceNum : enumInstanceNumArr[i],
locked: lockMode,
instanceNum: enumInstanceNumArr[i],
setInstanceNum: CreateParamChanger(enumInstanceNumArr, setEnumInstanceNumArr, i),
enumItems: enumItemCounts[i],
setEnumItemCounts: CreateParamChanger(enumItemCounts, setEnumItemCounts, i),
@@ -479,11 +485,11 @@ function MasterLfoHandler(){
setDjParam: CreateParamChanger(enumDjParamArr, setEnumDjParamArr, i),
linked: CheckLinked(enumInstanceNumArr[i], enumDjParamArr[i], modInstanceNumArr, djParamArr),
addEnum: () => {
if (id < MAXLFOS - 1){
if (enumVisibleArr[id + 1]){ // if we need to open up space
if (id < MAXLFOS - 1) {
if (enumVisibleArr[id + 1]) { // if we need to open up space
let emptyIndex = enumVisibleArr.findIndex((item) => !item);
if (emptyIndex != -1){
for (var j = 0; j < allEnumArrays.length; j++){
if (emptyIndex != -1) {
for (var j = 0; j < allEnumArrays.length; j++) {
let array = allEnumArrays[j];
// remove from all arrays
array.splice(emptyIndex, 1);
@@ -494,7 +500,7 @@ function MasterLfoHandler(){
// Now do the same with matrices
for (var j = 0; j < allEnumMats.length; j++){
for (var j = 0; j < allEnumMats.length; j++) {
let mat = allEnumMats[j];
mat.splice(emptyIndex, 1);
mat.splice(id + 1, 0, 0);
@@ -504,15 +510,15 @@ function MasterLfoHandler(){
}
}
else {
for (var j = 0; j < allEnumArrays.length; j++){
for (var j = 0; j < allEnumArrays.length; j++) {
let array = allEnumArrays[j];
array[id+1] = enumBlankVals[j];
array[id + 1] = enumBlankVals[j];
allEnumArrSetters[j](array);
}
// Now do the same with matrices
for (var j = 0; j < allEnumMats.length; j++){
for (var j = 0; j < allEnumMats.length; j++) {
let mat = allEnumMats[j];
mat[id + 1] = allGetEnumMatBlankVals[j]();
allEnumMatSetters[j](mat);
@@ -522,7 +528,7 @@ function MasterLfoHandler(){
}
},
removeEnum: () => {
if (enumVisibleArr.filter(x=>x).length > 1){
if (enumVisibleArr.filter(x => x).length > 1) {
let newArr = enumVisibleArr.slice();
newArr[id] = false;
setEnumVisibleArr(newArr);
@@ -534,45 +540,55 @@ function MasterLfoHandler(){
var grid;
var title;
var modButtonClass;
var enumButtonClass;
var labels;
if (viewMode === ViewModes.MOD){
if (viewMode === ViewModes.MOD) {
grid = modContents;
title = "MODULATORS";
modButtonClass = "highlighted-button";
enumButtonClass = "unhighlighted-button";
labels = MODULATORLABELS;
}
else {
grid = enumContents;
title = "ENUMERATORS";
modButtonClass = "unhighlighted-button";
enumButtonClass = "highlighted-button";
labels = ENUMERATORLABELS;
}
let lockClass;
if (lockMode == LockModes.LOCK){
if (lockMode == LockModes.LOCK) {
lockClass = 'lock';
}
}
else {
lockClass = 'lock unlocked';
}
return e('div', null,
e('div', {className: 'container'},
e(Switch, {ontoggle: toggleViewMode}, null),
e('span', {className: lockClass, onClick: toggleLockMode}, null)),
e('h5', null, title),
e('ul', null, ...labels.map(x => ListItem(Label(x)))),
e('div', {id: 'grid'}, ...grid)
return e('div', null,
e('div', { className: 'header' },
displayIfEnabled(e('button', { onClick: () => setViewMode(ViewModes.MOD), className: modButtonClass}, 'Modulators')),
displayIfEnabled(e('button', { onClick: () => setViewMode(ViewModes.ENUM), className: enumButtonClass }, 'Enumerators')),
e('button', { onClick: toggleEnabled, }, toggleEnabledText),
//allows lock mode
//e('span', { className: lockClass, onClick: toggleLockMode }, null)
),
displayIfEnabled(
e('table', { id: 'table' },
e('thead', null, e('tr', { id: 'headers' }, ...labels.map(x => e('th', null, x)))),
e('tbody', null, ...grid)
))
);
}
if (!DEBUG){
if (!DEBUG) {
window.max.bindInlet("load", (dictId) => {
window.dispatchEvent(new CustomEvent('loadDict', {'detail' : dictId}));
window.dispatchEvent(new CustomEvent('loadDict', { 'detail': dictId }));
});
window.max.bindInlet("save", (dictId) => {
window.dispatchEvent(new CustomEvent('saveDict', {'detail' : dictId}));
window.dispatchEvent(new CustomEvent('saveDict', { 'detail': dictId }));
});
window.max.bindInlet("dumpNN", () => {
@@ -580,35 +596,35 @@ if (!DEBUG){
});
window.max.bindInlet("setNN", (...data) => {
window.dispatchEvent(new CustomEvent('setNN', {'detail' : data}));
window.dispatchEvent(new CustomEvent('setNN', { 'detail': data }));
});
window.max.bindInlet("param", (inst, paramName, val) => {
window.dispatchEvent(new CustomEvent('param', {'detail' : [inst, paramName, val]}));
window.dispatchEvent(new CustomEvent('param', { 'detail': [inst, paramName, val] }));
});
window.max.bindInlet("timesig", (top, bottom) => {
window.dispatchEvent(new CustomEvent('timesig', {'detail' : [top, bottom]}));
window.dispatchEvent(new CustomEvent('timesig', { 'detail': [top, bottom] }));
});
window.max.bindInlet("ticks", (val) => {
window.dispatchEvent(new CustomEvent('maxTicks', {'detail' : val}));
window.dispatchEvent(new CustomEvent('maxTicks', { 'detail': val }));
});
window.max.bindInlet("userWave", (index, ...points) => {
let data = {points, index};
window.dispatchEvent(new CustomEvent('userWave', {'detail' : data}));
let data = { points, index };
window.dispatchEvent(new CustomEvent('userWave', { 'detail': data }));
});
window.max.bindInlet("userFunction", (index, ...points) => {
//list of 101 points between 0-100
let data = {points, index};
window.dispatchEvent(new CustomEvent('userFunction', {'detail': data}));
let data = { points, index };
window.dispatchEvent(new CustomEvent('userFunction', { 'detail': data }));
});
window.max.bindInlet("userDefinedType", (index, type) => {
let data = {index, type};
window.dispatchEvent(new CustomEvent('userDefinedType', {'detail': data}));
let data = { index, type };
window.dispatchEvent(new CustomEvent('userDefinedType', { 'detail': data }));
})
setInterval(() => {

View File

@@ -22,7 +22,9 @@ function ControlType(){
return e('select', {className: 'control-type'}, Option("LFO"));
}
function DataCell(element) {
return e('td', null, element);
}
function LfoRow(props){
@@ -34,27 +36,27 @@ function LfoRow(props){
let typeOption = null;
if (props.type == "LFO"){
typeOption = ListItem(DropDown({locked:props.locked, onChange: props.setShape, value:props.shape, options: SHAPETYPES}));
typeOption = DataCell(DropDown({locked:props.locked, onChange: props.setShape, value:props.shape, options: SHAPETYPES}));
}
else if (props.type == "Noise"){
typeOption = ListItem(DropDown({locked:props.locked, onChange: props.setNoise, value:props.noise, options: NOISETYPES}));
typeOption = DataCell(DropDown({locked:props.locked, onChange: props.setNoise, value:props.noise, options: NOISETYPES}));
}
let content = e('ul', {className: 'lfo-item'},
ListItem(DropDown({locked:props.locked, onChange: props.setInstanceNum, value:props.instanceNum, options: INSTANCEOPTIONS})),
ListItem(DropDown({locked:props.locked, options: TYPEOPTIONS, onChange: props.setType, value:props.type})),
let content = e('tr', {className: 'lfo-item'},
DataCell(DropDown({locked:props.locked, onChange: props.setInstanceNum, value:props.instanceNum, options: INSTANCEOPTIONS})),
DataCell(DropDown({locked:props.locked, options: TYPEOPTIONS, onChange: props.setType, value:props.type})),
typeOption,
ListItem(DropDown({locked:props.locked, onChange: props.setDjParam, value: props.djParam, options: MODPARAMOPTIONS})),
ListItem(e("input", {onChange:props.setFreq, value:props.freq, className:"timeInput"}, null)),
ListItem(e(NumberBox, {onChange:props.setMin, value:props.min, step:0.1}, null)),
ListItem(e(NumberBox, {onChange:props.setMax, value:props.max, step:0.1}, null)),
//ListItem(e(NumberBox, {onChange:props.setAmp, value:props.amp, step:0.1}, null)),
ListItem(e(NumberBox, {onChange:props.setPhase, value:props.phase, step:0.1}, null)),
ListItem(e("div", {className:"base-val"}, center.toString())),
ListItem(e("input", {type: 'range', min: 0, max: 1, step: 0.01, readonly: true, id: `slider-${props.instanceNum}-${props.djParam}`})),
ListItem(e(Button, {text:'+', onClick: props.addLfo, locked: props.locked}, null)),
ListItem(e(Button, {text:'-', onClick: props.removeLfo, locked: props.locked}, null)),
ListItem(e("div", {className:"linked"}, linkedText)),
DataCell(DropDown({locked:props.locked, onChange: props.setDjParam, value: props.djParam, options: MODPARAMOPTIONS})),
DataCell(e("input", {onChange:props.setFreq, value:props.freq, className:"timeInput"}, null)),
DataCell(e(NumberBox, {onChange:props.setMin, value:props.min, step:0.1}, null)),
DataCell(e(NumberBox, {onChange:props.setMax, value:props.max, step:0.1}, null)),
//DataCell(e(NumberBox, {onChange:props.setAmp, value:props.amp, step:0.1}, null)),
DataCell(e(NumberBox, {onChange:props.setPhase, value:props.phase, step:0.1}, null)),
DataCell(e("div", {className:"base-val"}, center.toString())),
DataCell(e("input", {type: 'range', min: 0, max: 1, step: 0.01, readonly: true, id: `slider-${props.instanceNum}-${props.djParam}`})),
DataCell(e(Button, {text:'+', onClick: props.addLfo, locked: props.locked}, null)),
DataCell(e(Button, {text:'-', onClick: props.removeLfo, locked: props.locked}, null)),
DataCell(e("div", {className:"linked"}, linkedText)),
);
if (props.visible){
return content;
@@ -65,7 +67,6 @@ function indexUserWave(phase, index, userDefinedWaves){
return parseFloat(userDefinedWaves[index][Math.floor(phase * 50)]) / 127;
}
//TODO doesn't work well yet
function indexUserFunction(phase, index, userDefinedFunctions){
return parseFloat(userDefinedFunctions[index][Math.floor(phase * 101)]) / 127;
}