| @@ -0,0 +1,103 @@ | |||||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||||
| <!-- Created with Inkscape (http://www.inkscape.org/) --> | |||||
| <svg | |||||
| xmlns:dc="http://purl.org/dc/elements/1.1/" | |||||
| xmlns:cc="http://creativecommons.org/ns#" | |||||
| xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |||||
| xmlns:svg="http://www.w3.org/2000/svg" | |||||
| xmlns="http://www.w3.org/2000/svg" | |||||
| xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | |||||
| xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | |||||
| width="45.720001mm" | |||||
| height="128.5mm" | |||||
| viewBox="0 0 45.720001 128.5" | |||||
| version="1.1" | |||||
| id="svg4620" | |||||
| inkscape:version="0.92.3 (2405546, 2018-03-11)" | |||||
| sodipodi:docname="HostAudio.svg"> | |||||
| <defs | |||||
| id="defs4614"> | |||||
| <style | |||||
| id="style6" | |||||
| type="text/css"> | |||||
| .str0 {stroke:#565656;stroke-width:0.0966867} | |||||
| .str1 {stroke:#4F4F4F;stroke-width:0.193345} | |||||
| .fil0 {fill:none} | |||||
| .fil2 {fill:#2B2A29} | |||||
| .fil1 {fill:#6B6B6B} | |||||
| </style> | |||||
| </defs> | |||||
| <sodipodi:namedview | |||||
| id="base" | |||||
| pagecolor="#ffffff" | |||||
| bordercolor="#666666" | |||||
| borderopacity="1.0" | |||||
| inkscape:pageopacity="0.0" | |||||
| inkscape:pageshadow="2" | |||||
| inkscape:zoom="2.8" | |||||
| inkscape:cx="45.070423" | |||||
| inkscape:cy="318.0947" | |||||
| inkscape:document-units="mm" | |||||
| inkscape:current-layer="layer1" | |||||
| showgrid="false" | |||||
| inkscape:window-width="1920" | |||||
| inkscape:window-height="1015" | |||||
| inkscape:window-x="0" | |||||
| inkscape:window-y="0" | |||||
| inkscape:window-maximized="1" | |||||
| inkscape:pagecheckerboard="0" /> | |||||
| <metadata | |||||
| id="metadata4617"> | |||||
| <rdf:RDF> | |||||
| <cc:Work | |||||
| rdf:about=""> | |||||
| <dc:format>image/svg+xml</dc:format> | |||||
| <dc:type | |||||
| rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | |||||
| <dc:title /> | |||||
| </cc:Work> | |||||
| </rdf:RDF> | |||||
| </metadata> | |||||
| <g | |||||
| inkscape:label="Layer 1" | |||||
| inkscape:groupmode="layer" | |||||
| id="layer1" | |||||
| transform="translate(0,-168.5)"> | |||||
| <g | |||||
| style="fill-rule:evenodd" | |||||
| id="g5299" | |||||
| transform="matrix(6.342689,0,0,6.342689,5.4472535,175.6457)"> | |||||
| <g | |||||
| transform="translate(-1.6191379e-5,-0.08553947)" | |||||
| id="Layer_x0020_1" | |||||
| inkscape:label="Layer 1"> | |||||
| <metadata | |||||
| id="CorelCorpID_0Corel-Layer" /> | |||||
| </g> | |||||
| </g> | |||||
| <g | |||||
| aria-label="Cardinal" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" | |||||
| id="text5303" | |||||
| transform="translate(-0.09449404,0.14174107)"> | |||||
| <path | |||||
| id="path5319" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke-width:0.26458332" | |||||
| d="m 38.967278,176.43913 h 0.570508 v 4.82451 h -0.570508 z m -2.313037,3.07888 q -0.691431,0 -0.958081,0.15813 -0.26665,0.15813 -0.26665,0.5395 0,0.30386 0.198437,0.48369 0.201538,0.17674 0.545703,0.17674 0.47439,0 0.759644,-0.33487 0.288354,-0.33796 0.288354,-0.89606 v -0.12713 z m 1.137915,-0.23564 v 1.98127 h -0.570508 v -0.5271 q -0.195337,0.31626 -0.486792,0.46819 -0.291455,0.14883 -0.713135,0.14883 -0.5333,0 -0.84956,-0.29766 -0.313159,-0.30075 -0.313159,-0.80305 0,-0.58601 0.390674,-0.88367 0.393774,-0.29765 1.172021,-0.29765 h 0.799951 v -0.0558 q 0,-0.39378 -0.260449,-0.60772 -0.257349,-0.21704 -0.725537,-0.21704 -0.297656,0 -0.57981,0.0713 -0.282153,0.0713 -0.542602,0.21394 v -0.52709 q 0.313159,-0.12093 0.607715,-0.17984 0.294555,-0.062 0.573608,-0.062 0.753442,0 1.125513,0.39067 0.37207,0.39068 0.37207,1.18443 z m -3.854029,-0.11472 v 2.09599 h -0.570508 v -2.07739 q 0,-0.49299 -0.192236,-0.73794 -0.192236,-0.24495 -0.576709,-0.24495 -0.461987,0 -0.728638,0.29456 -0.26665,0.29455 -0.26665,0.80305 v 1.96267 h -0.573608 v -3.47265 h 0.573608 v 0.5395 q 0.204639,-0.31316 0.480591,-0.46819 0.279053,-0.15503 0.641821,-0.15503 0.598413,0 0.905371,0.37207 0.306958,0.36897 0.306958,1.08831 z m -4.650879,-1.37666 h 0.570508 v 3.47265 h -0.570508 z m 0,-1.35186 h 0.570508 v 0.72244 h -0.570508 z m -1.74563,1.87895 v -1.87895 h 0.570508 v 4.82451 h -0.570508 v -0.5209 q -0.179834,0.31006 -0.455786,0.46199 -0.272851,0.14883 -0.657324,0.14883 -0.629419,0 -1.026294,-0.5023 -0.393774,-0.50229 -0.393774,-1.32085 0,-0.81855 0.393774,-1.32085 0.396875,-0.50229 1.026294,-0.50229 0.384473,0 0.657324,0.15193 0.275952,0.14883 0.455786,0.45888 z m -1.944067,1.21233 q 0,0.62942 0.257349,0.98909 0.260449,0.35657 0.713134,0.35657 0.452686,0 0.713135,-0.35657 0.260449,-0.35967 0.260449,-0.98909 0,-0.62942 -0.260449,-0.98598 -0.260449,-0.35967 -0.713135,-0.35967 -0.452685,0 -0.713134,0.35967 -0.257349,0.35656 -0.257349,0.98598 z m -0.827856,-1.20612 q -0.09612,-0.0558 -0.21084,-0.0806 -0.111621,-0.0279 -0.248047,-0.0279 -0.483691,0 -0.744141,0.31626 -0.257348,0.31315 -0.257348,0.90227 v 1.82934 H 22.73571 v -3.47265 h 0.573609 v 0.5395 q 0.179834,-0.31626 0.468188,-0.46819 0.288355,-0.15503 0.700733,-0.15503 0.05891,0 0.130224,0.009 0.07131,0.006 0.15813,0.0217 z m -4.325318,1.19372 q -0.69143,0 -0.958081,0.15813 -0.26665,0.15813 -0.26665,0.5395 0,0.30386 0.198437,0.48369 0.201538,0.17674 0.545703,0.17674 0.47439,0 0.759644,-0.33487 0.288355,-0.33796 0.288355,-0.89606 v -0.12713 z m 1.137915,-0.23564 v 1.98127 h -0.570507 v -0.5271 q -0.195337,0.31626 -0.486792,0.46819 -0.291456,0.14883 -0.713135,0.14883 -0.533301,0 -0.849561,-0.29766 -0.313159,-0.30075 -0.313159,-0.80305 0,-0.58601 0.390674,-0.88367 0.393774,-0.29765 1.172021,-0.29765 h 0.799952 v -0.0558 q 0,-0.39378 -0.26045,-0.60772 -0.257348,-0.21704 -0.725537,-0.21704 -0.297656,0 -0.579809,0.0713 -0.282154,0.0713 -0.542603,0.21394 v -0.52709 q 0.313159,-0.12093 0.607715,-0.17984 0.294556,-0.062 0.573608,-0.062 0.753443,0 1.125513,0.39067 0.37207,0.39068 0.37207,1.18443 z m -3.658691,-2.29134 v 0.66043 q -0.31626,-0.29456 -0.675928,-0.44028 -0.356567,-0.14573 -0.759643,-0.14573 -0.79375,0 -1.21543,0.48679 -0.42168,0.48369 -0.42168,1.40146 0,0.91468 0.42168,1.40147 0.42168,0.48369 1.21543,0.48369 0.403076,0 0.759643,-0.14573 0.359668,-0.14572 0.675928,-0.44028 v 0.65422 q -0.328662,0.22325 -0.697632,0.33487 -0.365869,0.11162 -0.775146,0.11162 -1.051099,0 -1.655713,-0.64182 -0.604615,-0.64492 -0.604615,-1.75804 0,-1.11621 0.604615,-1.75803 0.604614,-0.64492 1.655713,-0.64492 0.415478,0 0.781347,0.11162 0.36897,0.10852 0.691431,0.32866 z m -6.332521,1.84418 a 2.7180897,2.7180897 0 0 1 -2.71809,2.71809 2.7180897,2.7180897 0 0 1 -2.7180896,-2.71809 2.7180897,2.7180897 0 0 1 2.7180896,-2.71809 2.7180897,2.7180897 0 0 1 2.71809,2.71809 z m -1.7085876,0 a 1.0095024,1.0095024 0 0 1 -1.0095024,1.0095 1.0095024,1.0095024 0 0 1 -1.0095024,-1.0095 1.0095024,1.0095024 0 0 1 1.0095024,-1.0095 1.0095024,1.0095024 0 0 1 1.0095024,1.0095 z" /> | |||||
| </g> | |||||
| <text | |||||
| xml:space="preserve" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58329964px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#808a8a;fill-opacity:1;stroke:none;stroke-width:0.26458299" | |||||
| x="9.2157211" | |||||
| y="188.65312" | |||||
| id="text845"><tspan | |||||
| sodipodi:role="line" | |||||
| id="tspan843" | |||||
| x="9.2157211" | |||||
| y="188.65312" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888998px;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#808a8a;fill-opacity:1;stroke-width:0.26458299">Host Audio</tspan></text> | |||||
| </g> | |||||
| </svg> | |||||
| @@ -13,13 +13,29 @@ | |||||
| "changelogUrl": "", | "changelogUrl": "", | ||||
| "modules": | "modules": | ||||
| [ | [ | ||||
| { | |||||
| "slug": "HostAudio2", | |||||
| "name": "Audio 2", | |||||
| "description": "Exposes host-provided audio ports in a module", | |||||
| "tags": [ | |||||
| "External" | |||||
| ] | |||||
| }, | |||||
| { | |||||
| "slug": "HostAudio8", | |||||
| "name": "Audio 8", | |||||
| "description": "Exposes host-provided audio ports in a module", | |||||
| "tags": [ | |||||
| "External" | |||||
| ] | |||||
| }, | |||||
| { | { | ||||
| "slug": "HostCV", | "slug": "HostCV", | ||||
| "disabled": false, | "disabled": false, | ||||
| "name": "Host CV", | "name": "Host CV", | ||||
| "description": "Exposes host-provided CV ports in a module", | "description": "Exposes host-provided CV ports in a module", | ||||
| "tags": [ | "tags": [ | ||||
| "Utility" | |||||
| "External" | |||||
| ] | ] | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -28,7 +44,7 @@ | |||||
| "name": "Host Parameters", | "name": "Host Parameters", | ||||
| "description": "Exposes host-controlled plugin parameters in a module", | "description": "Exposes host-controlled plugin parameters in a module", | ||||
| "tags": [ | "tags": [ | ||||
| "Utility" | |||||
| "External" | |||||
| ] | ] | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -37,7 +53,7 @@ | |||||
| "name": "Host Time", | "name": "Host Time", | ||||
| "description": "Exposes host-provided time/transport information in a module", | "description": "Exposes host-provided time/transport information in a module", | ||||
| "tags": [ | "tags": [ | ||||
| "Utility" | |||||
| "External" | |||||
| ] | ] | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -0,0 +1,133 @@ | |||||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||||
| <!-- Created with Inkscape (http://www.inkscape.org/) --> | |||||
| <svg | |||||
| xmlns:dc="http://purl.org/dc/elements/1.1/" | |||||
| xmlns:cc="http://creativecommons.org/ns#" | |||||
| xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |||||
| xmlns:svg="http://www.w3.org/2000/svg" | |||||
| xmlns="http://www.w3.org/2000/svg" | |||||
| xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | |||||
| xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | |||||
| width="45.720001mm" | |||||
| height="128.5mm" | |||||
| viewBox="0 0 45.720001 128.5" | |||||
| version="1.1" | |||||
| id="svg4620" | |||||
| inkscape:version="0.92.3 (2405546, 2018-03-11)" | |||||
| sodipodi:docname="HostAudio.svg"> | |||||
| <defs | |||||
| id="defs4614"> | |||||
| <style | |||||
| id="style6" | |||||
| type="text/css"> | |||||
| .str0 {stroke:#565656;stroke-width:0.0966867} | |||||
| .str1 {stroke:#4F4F4F;stroke-width:0.193345} | |||||
| .fil0 {fill:none} | |||||
| .fil2 {fill:#2B2A29} | |||||
| .fil1 {fill:#6B6B6B} | |||||
| </style> | |||||
| </defs> | |||||
| <sodipodi:namedview | |||||
| id="base" | |||||
| pagecolor="#ffffff" | |||||
| bordercolor="#666666" | |||||
| borderopacity="1.0" | |||||
| inkscape:pageopacity="0.0" | |||||
| inkscape:pageshadow="2" | |||||
| inkscape:zoom="2.8" | |||||
| inkscape:cx="45.070423" | |||||
| inkscape:cy="318.0947" | |||||
| inkscape:document-units="mm" | |||||
| inkscape:current-layer="layer1" | |||||
| showgrid="false" | |||||
| inkscape:window-width="1920" | |||||
| inkscape:window-height="1015" | |||||
| inkscape:window-x="0" | |||||
| inkscape:window-y="0" | |||||
| inkscape:window-maximized="1" | |||||
| inkscape:pagecheckerboard="0" /> | |||||
| <metadata | |||||
| id="metadata4617"> | |||||
| <rdf:RDF> | |||||
| <cc:Work | |||||
| rdf:about=""> | |||||
| <dc:format>image/svg+xml</dc:format> | |||||
| <dc:type | |||||
| rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | |||||
| <dc:title></dc:title> | |||||
| </cc:Work> | |||||
| </rdf:RDF> | |||||
| </metadata> | |||||
| <g | |||||
| inkscape:label="Layer 1" | |||||
| inkscape:groupmode="layer" | |||||
| id="layer1" | |||||
| transform="translate(0,-168.5)"> | |||||
| <g | |||||
| style="fill-rule:evenodd" | |||||
| id="g5299" | |||||
| transform="matrix(6.342689,0,0,6.342689,5.4472535,175.6457)"> | |||||
| <g | |||||
| transform="translate(-1.6191379e-5,-0.08553947)" | |||||
| id="Layer_x0020_1" | |||||
| inkscape:label="Layer 1"> | |||||
| <metadata | |||||
| id="CorelCorpID_0Corel-Layer" /> | |||||
| </g> | |||||
| </g> | |||||
| <g | |||||
| aria-label="Cardinal" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" | |||||
| id="text5303" | |||||
| transform="translate(-0.09449404,0.14174107)"> | |||||
| <path | |||||
| id="path5319" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke-width:0.26458332" | |||||
| d="m 38.967278,176.43913 h 0.570508 v 4.82451 h -0.570508 z m -2.313037,3.07888 q -0.691431,0 -0.958081,0.15813 -0.26665,0.15813 -0.26665,0.5395 0,0.30386 0.198437,0.48369 0.201538,0.17674 0.545703,0.17674 0.47439,0 0.759644,-0.33487 0.288354,-0.33796 0.288354,-0.89606 v -0.12713 z m 1.137915,-0.23564 v 1.98127 h -0.570508 v -0.5271 q -0.195337,0.31626 -0.486792,0.46819 -0.291455,0.14883 -0.713135,0.14883 -0.5333,0 -0.84956,-0.29766 -0.313159,-0.30075 -0.313159,-0.80305 0,-0.58601 0.390674,-0.88367 0.393774,-0.29765 1.172021,-0.29765 h 0.799951 v -0.0558 q 0,-0.39378 -0.260449,-0.60772 -0.257349,-0.21704 -0.725537,-0.21704 -0.297656,0 -0.57981,0.0713 -0.282153,0.0713 -0.542602,0.21394 v -0.52709 q 0.313159,-0.12093 0.607715,-0.17984 0.294555,-0.062 0.573608,-0.062 0.753442,0 1.125513,0.39067 0.37207,0.39068 0.37207,1.18443 z m -3.854029,-0.11472 v 2.09599 h -0.570508 v -2.07739 q 0,-0.49299 -0.192236,-0.73794 -0.192236,-0.24495 -0.576709,-0.24495 -0.461987,0 -0.728638,0.29456 -0.26665,0.29455 -0.26665,0.80305 v 1.96267 h -0.573608 v -3.47265 h 0.573608 v 0.5395 q 0.204639,-0.31316 0.480591,-0.46819 0.279053,-0.15503 0.641821,-0.15503 0.598413,0 0.905371,0.37207 0.306958,0.36897 0.306958,1.08831 z m -4.650879,-1.37666 h 0.570508 v 3.47265 h -0.570508 z m 0,-1.35186 h 0.570508 v 0.72244 h -0.570508 z m -1.74563,1.87895 v -1.87895 h 0.570508 v 4.82451 h -0.570508 v -0.5209 q -0.179834,0.31006 -0.455786,0.46199 -0.272851,0.14883 -0.657324,0.14883 -0.629419,0 -1.026294,-0.5023 -0.393774,-0.50229 -0.393774,-1.32085 0,-0.81855 0.393774,-1.32085 0.396875,-0.50229 1.026294,-0.50229 0.384473,0 0.657324,0.15193 0.275952,0.14883 0.455786,0.45888 z m -1.944067,1.21233 q 0,0.62942 0.257349,0.98909 0.260449,0.35657 0.713134,0.35657 0.452686,0 0.713135,-0.35657 0.260449,-0.35967 0.260449,-0.98909 0,-0.62942 -0.260449,-0.98598 -0.260449,-0.35967 -0.713135,-0.35967 -0.452685,0 -0.713134,0.35967 -0.257349,0.35656 -0.257349,0.98598 z m -0.827856,-1.20612 q -0.09612,-0.0558 -0.21084,-0.0806 -0.111621,-0.0279 -0.248047,-0.0279 -0.483691,0 -0.744141,0.31626 -0.257348,0.31315 -0.257348,0.90227 v 1.82934 H 22.73571 v -3.47265 h 0.573609 v 0.5395 q 0.179834,-0.31626 0.468188,-0.46819 0.288355,-0.15503 0.700733,-0.15503 0.05891,0 0.130224,0.009 0.07131,0.006 0.15813,0.0217 z m -4.325318,1.19372 q -0.69143,0 -0.958081,0.15813 -0.26665,0.15813 -0.26665,0.5395 0,0.30386 0.198437,0.48369 0.201538,0.17674 0.545703,0.17674 0.47439,0 0.759644,-0.33487 0.288355,-0.33796 0.288355,-0.89606 v -0.12713 z m 1.137915,-0.23564 v 1.98127 h -0.570507 v -0.5271 q -0.195337,0.31626 -0.486792,0.46819 -0.291456,0.14883 -0.713135,0.14883 -0.533301,0 -0.849561,-0.29766 -0.313159,-0.30075 -0.313159,-0.80305 0,-0.58601 0.390674,-0.88367 0.393774,-0.29765 1.172021,-0.29765 h 0.799952 v -0.0558 q 0,-0.39378 -0.26045,-0.60772 -0.257348,-0.21704 -0.725537,-0.21704 -0.297656,0 -0.579809,0.0713 -0.282154,0.0713 -0.542603,0.21394 v -0.52709 q 0.313159,-0.12093 0.607715,-0.17984 0.294556,-0.062 0.573608,-0.062 0.753443,0 1.125513,0.39067 0.37207,0.39068 0.37207,1.18443 z m -3.658691,-2.29134 v 0.66043 q -0.31626,-0.29456 -0.675928,-0.44028 -0.356567,-0.14573 -0.759643,-0.14573 -0.79375,0 -1.21543,0.48679 -0.42168,0.48369 -0.42168,1.40146 0,0.91468 0.42168,1.40147 0.42168,0.48369 1.21543,0.48369 0.403076,0 0.759643,-0.14573 0.359668,-0.14572 0.675928,-0.44028 v 0.65422 q -0.328662,0.22325 -0.697632,0.33487 -0.365869,0.11162 -0.775146,0.11162 -1.051099,0 -1.655713,-0.64182 -0.604615,-0.64492 -0.604615,-1.75804 0,-1.11621 0.604615,-1.75803 0.604614,-0.64492 1.655713,-0.64492 0.415478,0 0.781347,0.11162 0.36897,0.10852 0.691431,0.32866 z m -6.332521,1.84418 a 2.7180897,2.7180897 0 0 1 -2.71809,2.71809 2.7180897,2.7180897 0 0 1 -2.7180896,-2.71809 2.7180897,2.7180897 0 0 1 2.7180896,-2.71809 2.7180897,2.7180897 0 0 1 2.71809,2.71809 z m -1.7085876,0 a 1.0095024,1.0095024 0 0 1 -1.0095024,1.0095 1.0095024,1.0095024 0 0 1 -1.0095024,-1.0095 1.0095024,1.0095024 0 0 1 1.0095024,-1.0095 1.0095024,1.0095024 0 0 1 1.0095024,1.0095 z" /> | |||||
| </g> | |||||
| <g | |||||
| aria-label="Host Audio" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58329964px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#808a8a;fill-opacity:1;stroke:none;stroke-width:0.26458299" | |||||
| id="text845"> | |||||
| <path | |||||
| d="m 9.7004462,185.05265 h 0.4871368 v 1.47588 h 1.77009 v -1.47588 h 0.487137 v 3.60047 h -0.487137 v -1.71462 h -1.77009 v 1.71462 H 9.7004462 Z" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888998px;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#808a8a;fill-opacity:1;stroke-width:0.26458299" | |||||
| id="path832" /> | |||||
| <path | |||||
| d="m 14.441588,186.26326 q -0.356912,0 -0.564307,0.27974 -0.207395,0.27733 -0.207395,0.76206 0,0.48472 0.204983,0.76446 0.207395,0.27733 0.566719,0.27733 0.3545,0 0.561895,-0.27974 0.207395,-0.27974 0.207395,-0.76205 0,-0.47991 -0.207395,-0.75965 -0.207395,-0.28215 -0.561895,-0.28215 z m 0,-0.37621 q 0.578776,0 0.909161,0.37621 0.330384,0.3762 0.330384,1.0418 0,0.66318 -0.330384,1.04179 -0.330385,0.37621 -0.909161,0.37621 -0.581188,0 -0.911573,-0.37621 -0.327973,-0.37861 -0.327973,-1.04179 0,-0.6656 0.327973,-1.0418 0.330385,-0.37621 0.911573,-0.37621 z" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888998px;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#808a8a;fill-opacity:1;stroke-width:0.26458299" | |||||
| id="path834" /> | |||||
| <path | |||||
| d="m 18.136109,186.03175 v 0.41961 q -0.188102,-0.0965 -0.390674,-0.14469 -0.202572,-0.0482 -0.419613,-0.0482 -0.330385,0 -0.496783,0.10128 -0.163986,0.10129 -0.163986,0.30386 0,0.15434 0.118167,0.24357 0.118166,0.0868 0.475078,0.1664 l 0.151929,0.0338 q 0.472667,0.10128 0.670416,0.28697 0.20016,0.18328 0.20016,0.51367 0,0.3762 -0.299034,0.59565 -0.296623,0.21946 -0.817522,0.21946 -0.217041,0 -0.453374,-0.0434 -0.233922,-0.041 -0.494372,-0.1254 v -0.4582 q 0.24598,0.12781 0.484725,0.19293 0.238745,0.0627 0.472667,0.0627 0.313504,0 0.482314,-0.10611 0.16881,-0.10852 0.16881,-0.30386 0,-0.18087 -0.12299,-0.27733 -0.120579,-0.0965 -0.532957,-0.18569 l -0.15434,-0.0362 q -0.412378,-0.0868 -0.595657,-0.26528 -0.183279,-0.18086 -0.183279,-0.49437 0,-0.38103 0.270095,-0.58842 0.270096,-0.2074 0.766879,-0.2074 0.24598,0 0.463021,0.0362 0.217041,0.0362 0.40032,0.10852 z" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888998px;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#808a8a;fill-opacity:1;stroke-width:0.26458299" | |||||
| id="path836" /> | |||||
| <path | |||||
| d="m 19.428709,185.18529 v 0.76688 h 0.913984 v 0.34485 h -0.913984 v 1.46623 q 0,0.33039 0.08923,0.42444 0.09164,0.0941 0.36897,0.0941 h 0.455786 v 0.37138 h -0.455786 q -0.513664,0 -0.709001,-0.19051 -0.195337,-0.19293 -0.195337,-0.69936 v -1.46623 h -0.325562 v -0.34485 h 0.325562 v -0.76688 z" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888998px;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#808a8a;fill-opacity:1;stroke-width:0.26458299" | |||||
| id="path838" /> | |||||
| <path | |||||
| d="m 23.72371,185.53255 -0.660769,1.7918 h 1.32395 z m -0.274918,-0.4799 h 0.552248 l 1.372182,3.60047 h -0.506429 l -0.327973,-0.92363 h -1.622985 l -0.327973,0.92363 h -0.513664 z" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888998px;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#808a8a;fill-opacity:1;stroke-width:0.26458299" | |||||
| id="path840" /> | |||||
| <path | |||||
| d="m 25.831421,187.58721 v -1.63504 h 0.443728 v 1.61816 q 0,0.38344 0.149517,0.57636 0.149517,0.19052 0.448552,0.19052 0.359323,0 0.566718,-0.2291 0.209807,-0.2291 0.209807,-0.6246 v -1.53134 h 0.443728 v 2.70095 h -0.443728 v -0.41479 q -0.161575,0.24598 -0.376205,0.36656 -0.212218,0.11817 -0.494371,0.11817 -0.465433,0 -0.70659,-0.28939 -0.241156,-0.28939 -0.241156,-0.84646 z m 1.116555,-1.70016 z" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888998px;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#808a8a;fill-opacity:1;stroke-width:0.26458299" | |||||
| id="path842" /> | |||||
| <path | |||||
| d="m 30.789602,186.36213 v -1.46141 h 0.443729 v 3.7524 h -0.443729 v -0.40514 q -0.139871,0.24116 -0.3545,0.35932 -0.212218,0.11576 -0.511253,0.11576 -0.489548,0 -0.798228,-0.39068 -0.306269,-0.39067 -0.306269,-1.02732 0,-0.63666 0.306269,-1.02733 0.30868,-0.39068 0.798228,-0.39068 0.299035,0 0.511253,0.11817 0.214629,0.11576 0.3545,0.35691 z m -1.512053,0.94293 q 0,0.48954 0.20016,0.76929 0.202572,0.27733 0.554661,0.27733 0.352089,0 0.55466,-0.27733 0.202572,-0.27975 0.202572,-0.76929 0,-0.48955 -0.202572,-0.76688 -0.202571,-0.27974 -0.55466,-0.27974 -0.352089,0 -0.554661,0.27974 -0.20016,0.27733 -0.20016,0.76688 z" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888998px;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#808a8a;fill-opacity:1;stroke-width:0.26458299" | |||||
| id="path844" /> | |||||
| <path | |||||
| d="m 32.147315,185.95217 h 0.443729 v 2.70095 h -0.443729 z m 0,-1.05145 h 0.443729 v 0.5619 h -0.443729 z" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888998px;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#808a8a;fill-opacity:1;stroke-width:0.26458299" | |||||
| id="path846" /> | |||||
| <path | |||||
| d="m 34.563706,186.26326 q -0.356912,0 -0.564307,0.27974 -0.207395,0.27733 -0.207395,0.76206 0,0.48472 0.204983,0.76446 0.207395,0.27733 0.566719,0.27733 0.3545,0 0.561895,-0.27974 0.207395,-0.27974 0.207395,-0.76205 0,-0.47991 -0.207395,-0.75965 -0.207395,-0.28215 -0.561895,-0.28215 z m 0,-0.37621 q 0.578776,0 0.909161,0.37621 0.330384,0.3762 0.330384,1.0418 0,0.66318 -0.330384,1.04179 -0.330385,0.37621 -0.909161,0.37621 -0.581188,0 -0.911573,-0.37621 -0.327973,-0.37861 -0.327973,-1.04179 0,-0.6656 0.327973,-1.0418 0.330385,-0.37621 0.911573,-0.37621 z" | |||||
| style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888998px;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#808a8a;fill-opacity:1;stroke-width:0.26458299" | |||||
| id="path848" /> | |||||
| </g> | |||||
| </g> | |||||
| </svg> | |||||
| @@ -0,0 +1,197 @@ | |||||
| /* | |||||
| * DISTRHO Cardinal Plugin | |||||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||||
| * | |||||
| * This program is free software; you can redistribute it and/or | |||||
| * modify it under the terms of the GNU General Public License as | |||||
| * published by the Free Software Foundation; either version 3 of | |||||
| * the License, or any later version. | |||||
| * | |||||
| * This program is distributed in the hope that it will be useful, | |||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| * GNU General Public License for more details. | |||||
| * | |||||
| * For a full copy of the GNU General Public License see the LICENSE file. | |||||
| */ | |||||
| #include "plugincontext.hpp" | |||||
| // ----------------------------------------------------------------------------------------------------------- | |||||
| USE_NAMESPACE_DISTRHO; | |||||
| template<int numIO> | |||||
| struct HostAudio : Module { | |||||
| CardinalPluginContext* const pcontext; | |||||
| const int numParams; | |||||
| const int numInputs; | |||||
| const int numOutputs; | |||||
| int dataFrame = 0; | |||||
| int64_t lastBlockFrame = -1; | |||||
| // for rack core audio module compatibility | |||||
| dsp::RCFilter dcFilters[numIO]; | |||||
| bool dcFilterEnabled = (numIO == 2); | |||||
| HostAudio() | |||||
| : pcontext(static_cast<CardinalPluginContext*>(APP)), | |||||
| numParams(numIO == 2 ? 1 : 0), | |||||
| numInputs(pcontext->variant == kCardinalVariantSynth ? 0 : std::max(pcontext->variant != kCardinalVariantMain ? 2 : 8, numIO)), | |||||
| numOutputs(std::max(pcontext->variant != kCardinalVariantMain ? 2 : 8, numIO)) | |||||
| { | |||||
| if (pcontext == nullptr) | |||||
| throw rack::Exception("Plugin context is null"); | |||||
| config(numParams, numIO, numIO, 0); | |||||
| if (numParams != 0) | |||||
| configParam(0, 0.f, 2.f, 1.f, "Level", " dB", -10, 40); | |||||
| const float sampleTime = pcontext->engine->getSampleTime(); | |||||
| for (int i = 0; i < numIO; i++) { | |||||
| dcFilters[i].setCutoffFreq(10.f * sampleTime); | |||||
| } | |||||
| } | |||||
| void onReset() override | |||||
| { | |||||
| dcFilterEnabled = (numIO == 2); | |||||
| } | |||||
| void onSampleRateChange(const SampleRateChangeEvent& e) override | |||||
| { | |||||
| for (int i = 0; i < numIO; i++) | |||||
| dcFilters[i].setCutoffFreq(10.f * e.sampleTime); | |||||
| } | |||||
| void process(const ProcessArgs&) override | |||||
| { | |||||
| const float* const* const dataIns = pcontext->dataIns; | |||||
| float** const dataOuts = pcontext->dataOuts; | |||||
| const int64_t blockFrame = pcontext->engine->getBlockFrame(); | |||||
| if (lastBlockFrame != blockFrame) | |||||
| { | |||||
| dataFrame = 0; | |||||
| lastBlockFrame = blockFrame; | |||||
| } | |||||
| const int k = dataFrame++; | |||||
| DISTRHO_SAFE_ASSERT_RETURN(k < pcontext->engine->getBlockFrames(),); | |||||
| const float gain = numParams != 0 ? std::pow(params[0].getValue(), 2.f) : 1.0f; | |||||
| // from host into cardinal, shows as output plug | |||||
| for (int i=0; i<numInputs; ++i) | |||||
| outputs[i].setVoltage(dataIns[i][k] * 10.0f); | |||||
| // from cardinal into host, shows as input plug | |||||
| for (int i=0; i<numOutputs; ++i) | |||||
| { | |||||
| float v = inputs[i].getVoltageSum() * 0.1f; | |||||
| // Apply DC filter | |||||
| if (dcFilterEnabled) | |||||
| { | |||||
| dcFilters[i].process(v); | |||||
| v = dcFilters[i].highpass(); | |||||
| } | |||||
| dataOuts[i][k] += clamp(v * gain, -1.0f, 1.0f); | |||||
| } | |||||
| } | |||||
| json_t* dataToJson() override | |||||
| { | |||||
| json_t* const rootJ = json_object(); | |||||
| DISTRHO_SAFE_ASSERT_RETURN(rootJ != nullptr, nullptr); | |||||
| json_object_set_new(rootJ, "dcFilter", json_boolean(dcFilterEnabled)); | |||||
| return rootJ; | |||||
| } | |||||
| void dataFromJson(json_t* const rootJ) override | |||||
| { | |||||
| json_t* const dcFilterJ = json_object_get(rootJ, "dcFilter"); | |||||
| DISTRHO_SAFE_ASSERT_RETURN(dcFilterJ != nullptr,); | |||||
| dcFilterEnabled = json_boolean_value(dcFilterJ); | |||||
| } | |||||
| }; | |||||
| template<int numIO> | |||||
| struct HostAudioWidget : ModuleWidget { | |||||
| static constexpr const float startX_In = 14.0f; | |||||
| static constexpr const float startX_Out = 96.0f; | |||||
| static constexpr const float startY = 74.0f; | |||||
| static constexpr const float padding = 29.0f; | |||||
| static constexpr const float middleX = startX_In + (startX_Out - startX_In) * 0.5f + padding * 0.25f; | |||||
| HostAudio<numIO>* const module; | |||||
| HostAudioWidget(HostAudio<numIO>* const m) | |||||
| : module(m) | |||||
| { | |||||
| setModule(m); | |||||
| setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/HostAudio.svg"))); | |||||
| addChild(createWidget<ScrewBlack>(Vec(RACK_GRID_WIDTH, 0))); | |||||
| addChild(createWidget<ScrewBlack>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); | |||||
| addChild(createWidget<ScrewBlack>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); | |||||
| addChild(createWidget<ScrewBlack>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); | |||||
| for (uint i=0; i<numIO; ++i) | |||||
| addInput(createInput<PJ301MPort>(Vec(startX_In, startY + padding * i), m, i)); | |||||
| for (uint i=0; i<numIO; ++i) | |||||
| addOutput(createOutput<PJ301MPort>(Vec(startX_Out, startY + padding * i), m, i)); | |||||
| } | |||||
| void drawTextLine(NVGcontext* const vg, const uint offset, const char* const text) | |||||
| { | |||||
| const float y = startY + offset * padding; | |||||
| nvgBeginPath(vg); | |||||
| nvgFillColor(vg, color::WHITE); | |||||
| nvgText(vg, middleX, y + 16, text, nullptr); | |||||
| } | |||||
| void draw(const DrawArgs& args) override | |||||
| { | |||||
| nvgBeginPath(args.vg); | |||||
| nvgRect(args.vg, 0, 0, box.size.x, box.size.y); | |||||
| nvgFillPaint(args.vg, nvgLinearGradient(args.vg, 0, 0, 0, box.size.y, | |||||
| nvgRGB(0x18, 0x19, 0x19), nvgRGB(0x21, 0x22, 0x22))); | |||||
| nvgFill(args.vg); | |||||
| nvgFontFaceId(args.vg, 0); | |||||
| nvgFontSize(args.vg, 11); | |||||
| nvgTextAlign(args.vg, NVG_ALIGN_CENTER); | |||||
| nvgBeginPath(args.vg); | |||||
| nvgRoundedRect(args.vg, startX_Out - 4.0f, startY - 2.0f, padding, padding * numIO, 4); | |||||
| nvgFillColor(args.vg, nvgRGB(0xd0, 0xd0, 0xd0)); | |||||
| nvgFill(args.vg); | |||||
| for (int i=0; i<numIO; ++i) | |||||
| { | |||||
| char text[] = {'A','u','d','i','o',' ',static_cast<char>('0'+i+1),'\0'}; | |||||
| drawTextLine(args.vg, i, text); | |||||
| } | |||||
| ModuleWidget::draw(args); | |||||
| } | |||||
| void appendContextMenu(Menu* const menu) override { | |||||
| menu->addChild(new MenuSeparator); | |||||
| menu->addChild(createBoolPtrMenuItem("DC blocker", "", &module->dcFilterEnabled)); | |||||
| } | |||||
| }; | |||||
| // -------------------------------------------------------------------------------------------------------------------- | |||||
| Model* modelHostAudio2 = createModel<HostAudio<2>, HostAudioWidget<2>>("HostAudio2"); | |||||
| Model* modelHostAudio8 = createModel<HostAudio<8>, HostAudioWidget<8>>("HostAudio8"); | |||||
| // -------------------------------------------------------------------------------------------------------------------- | |||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| * DISTRHO Cardinal Plugin | * DISTRHO Cardinal Plugin | ||||
| * Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| * modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
| @@ -24,6 +24,10 @@ | |||||
| USE_NAMESPACE_DISTRHO; | USE_NAMESPACE_DISTRHO; | ||||
| struct HostCV : Module { | struct HostCV : Module { | ||||
| CardinalPluginContext* const pcontext; | |||||
| int dataFrame = 0; | |||||
| int64_t lastBlockFrame = -1; | |||||
| enum ParamIds { | enum ParamIds { | ||||
| BIPOLAR_INPUTS_1_5, | BIPOLAR_INPUTS_1_5, | ||||
| BIPOLAR_INPUTS_6_10, | BIPOLAR_INPUTS_6_10, | ||||
| @@ -42,62 +46,54 @@ struct HostCV : Module { | |||||
| }; | }; | ||||
| HostCV() | HostCV() | ||||
| : pcontext(static_cast<CardinalPluginContext*>(APP)) | |||||
| { | { | ||||
| if (pcontext == nullptr) | |||||
| throw rack::Exception("Plugin context is null"); | |||||
| config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); | config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); | ||||
| configParam<SwitchQuantity>(BIPOLAR_INPUTS_1_5, 0.f, 1.f, 0.f, "Bipolar Inputs 1-5")->randomizeEnabled = false; | configParam<SwitchQuantity>(BIPOLAR_INPUTS_1_5, 0.f, 1.f, 0.f, "Bipolar Inputs 1-5")->randomizeEnabled = false; | ||||
| configParam<SwitchQuantity>(BIPOLAR_INPUTS_6_10, 0.f, 1.f, 0.f, "Bipolar Inputs 6-10")->randomizeEnabled = false; | configParam<SwitchQuantity>(BIPOLAR_INPUTS_6_10, 0.f, 1.f, 0.f, "Bipolar Inputs 6-10")->randomizeEnabled = false; | ||||
| configParam<SwitchQuantity>(BIPOLAR_OUTPUTS_1_5, 0.f, 1.f, 0.f, "Bipolar Outputs 1-5")->randomizeEnabled = false; | configParam<SwitchQuantity>(BIPOLAR_OUTPUTS_1_5, 0.f, 1.f, 0.f, "Bipolar Outputs 1-5")->randomizeEnabled = false; | ||||
| configParam<SwitchQuantity>(BIPOLAR_OUTPUTS_6_10, 0.f, 1.f, 0.f, "Bipolar Outputs 6-10")->randomizeEnabled = false; | configParam<SwitchQuantity>(BIPOLAR_OUTPUTS_6_10, 0.f, 1.f, 0.f, "Bipolar Outputs 6-10")->randomizeEnabled = false; | ||||
| CardinalPluginContext* const pcontext = static_cast<CardinalPluginContext*>(APP); | |||||
| if (pcontext == nullptr) | |||||
| throw rack::Exception("Plugin context is null."); | |||||
| if (pcontext->loadedHostCV) | |||||
| throw rack::Exception("Another instance of a Host CV module is already loaded, only one can be used at a time."); | |||||
| pcontext->loadedHostCV = true; | |||||
| } | } | ||||
| ~HostCV() override | |||||
| void process(const ProcessArgs&) override | |||||
| { | { | ||||
| CardinalPluginContext* const pcontext = static_cast<CardinalPluginContext*>(APP); | |||||
| DISTRHO_SAFE_ASSERT_RETURN(pcontext != nullptr,); | |||||
| if (pcontext->variant != kCardinalVariantMain) | |||||
| return; | |||||
| pcontext->loadedHostCV = false; | |||||
| } | |||||
| const float* const* const dataIns = pcontext->dataIns; | |||||
| float** const dataOuts = pcontext->dataOuts; | |||||
| void process(const ProcessArgs&) override | |||||
| { | |||||
| if (CardinalPluginContext* const pcontext = static_cast<CardinalPluginContext*>(APP)) | |||||
| { | |||||
| const float** dataIns = pcontext->dataIns; | |||||
| float** dataOuts = pcontext->dataOuts; | |||||
| const int64_t blockFrame = pcontext->engine->getBlockFrame(); | |||||
| if (dataIns == nullptr || dataOuts == nullptr) | |||||
| return; | |||||
| if (lastBlockFrame != blockFrame) | |||||
| { | |||||
| dataFrame = 0; | |||||
| lastBlockFrame = blockFrame; | |||||
| } | |||||
| const uint32_t dataFrame = pcontext->dataFrame++; | |||||
| float inputOffset, outputOffset; | |||||
| const int k = dataFrame++; | |||||
| DISTRHO_SAFE_ASSERT_RETURN(k < pcontext->engine->getBlockFrames(),); | |||||
| inputOffset = params[BIPOLAR_INPUTS_1_5].getValue() > 0.1f ? 5.0f : 0.0f; | |||||
| outputOffset = params[BIPOLAR_OUTPUTS_1_5].getValue() > 0.1f ? 5.0f : 0.0f; | |||||
| float inputOffset, outputOffset; | |||||
| inputOffset = params[BIPOLAR_INPUTS_1_5].getValue() > 0.1f ? 5.0f : 0.0f; | |||||
| outputOffset = params[BIPOLAR_OUTPUTS_1_5].getValue() > 0.1f ? 5.0f : 0.0f; | |||||
| for (int i=0; i<5; ++i) | |||||
| { | |||||
| outputs[i].setVoltage(dataIns[i+CARDINAL_AUDIO_IO_OFFSET][dataFrame] - outputOffset); | |||||
| dataOuts[i+CARDINAL_AUDIO_IO_OFFSET][dataFrame] = inputs[i].getVoltage() + inputOffset; | |||||
| } | |||||
| for (int i=0; i<5; ++i) | |||||
| { | |||||
| outputs[i].setVoltage(dataIns[i+CARDINAL_AUDIO_IO_OFFSET][k] - outputOffset); | |||||
| dataOuts[i+CARDINAL_AUDIO_IO_OFFSET][k] = inputs[i].getVoltage() + inputOffset; | |||||
| } | |||||
| inputOffset = params[BIPOLAR_INPUTS_6_10].getValue() > 0.1f ? 5.0f : 0.0f; | |||||
| outputOffset = params[BIPOLAR_OUTPUTS_6_10].getValue() > 0.1f ? 5.0f : 0.0f; | |||||
| inputOffset = params[BIPOLAR_INPUTS_6_10].getValue() > 0.1f ? 5.0f : 0.0f; | |||||
| outputOffset = params[BIPOLAR_OUTPUTS_6_10].getValue() > 0.1f ? 5.0f : 0.0f; | |||||
| for (int i=5; i<10; ++i) | |||||
| { | |||||
| outputs[i].setVoltage(dataIns[i+CARDINAL_AUDIO_IO_OFFSET][dataFrame] - outputOffset); | |||||
| dataOuts[i+CARDINAL_AUDIO_IO_OFFSET][dataFrame] = inputs[i].getVoltage() + inputOffset; | |||||
| } | |||||
| for (int i=5; i<10; ++i) | |||||
| { | |||||
| outputs[i].setVoltage(dataIns[i+CARDINAL_AUDIO_IO_OFFSET][k] - outputOffset); | |||||
| dataOuts[i+CARDINAL_AUDIO_IO_OFFSET][k] = inputs[i].getVoltage() + inputOffset; | |||||
| } | } | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| * DISTRHO Cardinal Plugin | * DISTRHO Cardinal Plugin | ||||
| * Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| * modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
| @@ -36,6 +36,7 @@ struct HostParameters : Module { | |||||
| }; | }; | ||||
| rack::dsp::SlewLimiter parameters[kModuleParameters]; | rack::dsp::SlewLimiter parameters[kModuleParameters]; | ||||
| bool parametersConnected[kModuleParameters] = {}; | |||||
| float sampleTime = 0.0f; | float sampleTime = 0.0f; | ||||
| HostParameters() | HostParameters() | ||||
| @@ -60,7 +61,18 @@ struct HostParameters : Module { | |||||
| if (const CardinalPluginContext* const pcontext = static_cast<CardinalPluginContext*>(APP)) | if (const CardinalPluginContext* const pcontext = static_cast<CardinalPluginContext*>(APP)) | ||||
| { | { | ||||
| for (uint32_t i=0; i<kModuleParameters; ++i) | for (uint32_t i=0; i<kModuleParameters; ++i) | ||||
| outputs[i].setVoltage(parameters[i].process(sampleTime, pcontext->parameters[i])); | |||||
| { | |||||
| const bool connected = outputs[i].isConnected(); | |||||
| if (parametersConnected[i] != connected) | |||||
| { | |||||
| parametersConnected[i] = connected; | |||||
| parameters[i].reset(); | |||||
| } | |||||
| if (connected) | |||||
| outputs[i].setVoltage(parameters[i].process(sampleTime, pcontext->parameters[i])); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| * DISTRHO Cardinal Plugin | * DISTRHO Cardinal Plugin | ||||
| * Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| * modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
| @@ -31,6 +31,8 @@ extern Model* modelAudioFile; | |||||
| extern Model* modelCarla; | extern Model* modelCarla; | ||||
| extern Model* modelCardinalBlank; | extern Model* modelCardinalBlank; | ||||
| extern Model* modelGlBars; | extern Model* modelGlBars; | ||||
| extern Model* modelHostAudio2; | |||||
| extern Model* modelHostAudio8; | |||||
| extern Model* modelHostCV; | extern Model* modelHostCV; | ||||
| extern Model* modelHostParameters; | extern Model* modelHostParameters; | ||||
| extern Model* modelHostTime; | extern Model* modelHostTime; | ||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| * DISTRHO Cardinal Plugin | * DISTRHO Cardinal Plugin | ||||
| * Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| * modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
| @@ -33,6 +33,12 @@ START_NAMESPACE_DISTRHO | |||||
| static constexpr const uint32_t kModuleParameters = 24; | static constexpr const uint32_t kModuleParameters = 24; | ||||
| enum CardinalVariant { | |||||
| kCardinalVariantMain, | |||||
| kCardinalVariantFX, | |||||
| kCardinalVariantSynth, | |||||
| }; | |||||
| class Plugin; | class Plugin; | ||||
| class UI; | class UI; | ||||
| @@ -40,14 +46,14 @@ struct CardinalPluginContext : rack::Context { | |||||
| uint32_t bufferSize; | uint32_t bufferSize; | ||||
| double sampleRate; | double sampleRate; | ||||
| float parameters[kModuleParameters]; | float parameters[kModuleParameters]; | ||||
| bool playing, reset, bbtValid, loadedHostCV; | |||||
| CardinalVariant variant; | |||||
| bool playing, reset, bbtValid; | |||||
| int32_t bar, beat, beatsPerBar, beatType; | int32_t bar, beat, beatsPerBar, beatType; | ||||
| uint64_t frame; | uint64_t frame; | ||||
| double barStartTick, beatsPerMinute; | double barStartTick, beatsPerMinute; | ||||
| double tick, tickClock, ticksPerBeat, ticksPerClock, ticksPerFrame; | double tick, tickClock, ticksPerBeat, ticksPerClock, ticksPerFrame; | ||||
| uintptr_t nativeWindowId; | uintptr_t nativeWindowId; | ||||
| uint32_t dataFrame; | |||||
| const float** dataIns; | |||||
| const float* const* dataIns; | |||||
| float** dataOuts; | float** dataOuts; | ||||
| Plugin* const plugin; | Plugin* const plugin; | ||||
| #ifndef HEADLESS | #ifndef HEADLESS | ||||
| @@ -188,6 +188,7 @@ PLUGIN_FILES = plugins.cpp | |||||
| PLUGIN_FILES += Cardinal/src/Blank.cpp | PLUGIN_FILES += Cardinal/src/Blank.cpp | ||||
| PLUGIN_FILES += Cardinal/src/glBars.cpp | PLUGIN_FILES += Cardinal/src/glBars.cpp | ||||
| PLUGIN_FILES += Cardinal/src/HostAudio.cpp | |||||
| PLUGIN_FILES += Cardinal/src/HostCV.cpp | PLUGIN_FILES += Cardinal/src/HostCV.cpp | ||||
| PLUGIN_FILES += Cardinal/src/HostParameters.cpp | PLUGIN_FILES += Cardinal/src/HostParameters.cpp | ||||
| PLUGIN_FILES += Cardinal/src/HostTime.cpp | PLUGIN_FILES += Cardinal/src/HostTime.cpp | ||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| * DISTRHO Cardinal Plugin | * DISTRHO Cardinal Plugin | ||||
| * Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| * modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
| @@ -679,6 +679,8 @@ static void initStatic__Cardinal() | |||||
| { | { | ||||
| p->addModel(modelCardinalBlank); | p->addModel(modelCardinalBlank); | ||||
| p->addModel(modelGlBars); | p->addModel(modelGlBars); | ||||
| p->addModel(modelHostAudio2); | |||||
| p->addModel(modelHostAudio8); | |||||
| p->addModel(modelHostCV); | p->addModel(modelHostCV); | ||||
| p->addModel(modelHostParameters); | p->addModel(modelHostParameters); | ||||
| p->addModel(modelHostTime); | p->addModel(modelHostTime); | ||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| * DISTRHO Cardinal Plugin | * DISTRHO Cardinal Plugin | ||||
| * Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| * modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
| @@ -182,9 +182,6 @@ struct Initializer | |||||
| "Make sure Cardinal was downloaded and installed correctly.", asset::systemDir.c_str()); | "Make sure Cardinal was downloaded and installed correctly.", asset::systemDir.c_str()); | ||||
| } | } | ||||
| INFO("Initializing audio driver"); | |||||
| audio::addDriver(0, new CardinalAudioDriver); | |||||
| INFO("Initializing midi driver"); | INFO("Initializing midi driver"); | ||||
| midi::addDriver(0, new CardinalMidiDriver); | midi::addDriver(0, new CardinalMidiDriver); | ||||
| @@ -336,14 +333,11 @@ class CardinalPlugin : public CardinalBasePlugin | |||||
| { | { | ||||
| SharedResourcePointer<Initializer> fInitializer; | SharedResourcePointer<Initializer> fInitializer; | ||||
| float* fAudioBufferIn; | |||||
| float* fAudioBufferOut; | |||||
| float** fAudioBufferCopy; | |||||
| std::string fAutosavePath; | std::string fAutosavePath; | ||||
| String fWindowSize; | String fWindowSize; | ||||
| // for base/context handling | // for base/context handling | ||||
| bool fIsActive; | |||||
| CardinalAudioDevice* fCurrentAudioDevice; | |||||
| CardinalMidiInputDevice** fCurrentMidiInputs; | CardinalMidiInputDevice** fCurrentMidiInputs; | ||||
| CardinalMidiOutputDevice** fCurrentMidiOutputs; | CardinalMidiOutputDevice** fCurrentMidiOutputs; | ||||
| uint64_t fPreviousFrame; | uint64_t fPreviousFrame; | ||||
| @@ -358,10 +352,7 @@ public: | |||||
| CardinalPlugin() | CardinalPlugin() | ||||
| : CardinalBasePlugin(kModuleParameters + kWindowParameterCount, 0, kCardinalStateCount), | : CardinalBasePlugin(kModuleParameters + kWindowParameterCount, 0, kCardinalStateCount), | ||||
| fInitializer(this), | fInitializer(this), | ||||
| fAudioBufferIn(nullptr), | |||||
| fAudioBufferOut(nullptr), | |||||
| fIsActive(false), | |||||
| fCurrentAudioDevice(nullptr), | |||||
| fAudioBufferCopy(nullptr), | |||||
| fCurrentMidiInputs(nullptr), | fCurrentMidiInputs(nullptr), | ||||
| fCurrentMidiOutputs(nullptr), | fCurrentMidiOutputs(nullptr), | ||||
| fPreviousFrame(0) | fPreviousFrame(0) | ||||
| @@ -443,7 +434,6 @@ public: | |||||
| { | { | ||||
| const MutexLocker cml(fDeviceMutex); | const MutexLocker cml(fDeviceMutex); | ||||
| fCurrentAudioDevice = nullptr; | |||||
| delete[] fCurrentMidiInputs; | delete[] fCurrentMidiInputs; | ||||
| fCurrentMidiInputs = nullptr; | fCurrentMidiInputs = nullptr; | ||||
| delete[] fCurrentMidiOutputs; | delete[] fCurrentMidiOutputs; | ||||
| @@ -463,36 +453,6 @@ protected: | |||||
| /* -------------------------------------------------------------------------------------------------------- | /* -------------------------------------------------------------------------------------------------------- | ||||
| * Cardinal Base things */ | * Cardinal Base things */ | ||||
| bool isActive() const noexcept override | |||||
| { | |||||
| return fIsActive; | |||||
| } | |||||
| bool canAssignAudioDevice() const noexcept override | |||||
| { | |||||
| const MutexLocker cml(fDeviceMutex); | |||||
| return fCurrentAudioDevice == nullptr; | |||||
| } | |||||
| void assignAudioDevice(CardinalAudioDevice* const dev) noexcept override | |||||
| { | |||||
| DISTRHO_SAFE_ASSERT_RETURN(fCurrentAudioDevice == nullptr,); | |||||
| const MutexLocker cml(fDeviceMutex); | |||||
| fCurrentAudioDevice = dev; | |||||
| } | |||||
| bool clearAudioDevice(CardinalAudioDevice* const dev) noexcept override | |||||
| { | |||||
| const MutexLocker cml(fDeviceMutex); | |||||
| if (fCurrentAudioDevice != dev) | |||||
| return false; | |||||
| fCurrentAudioDevice = nullptr; | |||||
| return true; | |||||
| } | |||||
| void assignMidiInputDevice(CardinalMidiInputDevice* const dev) noexcept override | void assignMidiInputDevice(CardinalMidiInputDevice* const dev) noexcept override | ||||
| { | { | ||||
| CardinalMidiInputDevice** const oldDevs = fCurrentMidiInputs; | CardinalMidiInputDevice** const oldDevs = fCurrentMidiInputs; | ||||
| @@ -625,13 +585,15 @@ protected: | |||||
| int64_t getUniqueId() const override | int64_t getUniqueId() const override | ||||
| { | { | ||||
| #if CARDINAL_VARIANT_SYNTH | |||||
| return d_cconst('d', 'C', 'n', 'S'); | |||||
| #elif CARDINAL_VARIANT_FX | |||||
| return d_cconst('d', 'C', 'n', 'F'); | |||||
| #else | |||||
| #if CARDINAL_VARIANT_MAIN | |||||
| return d_cconst('d', 'C', 'd', 'n'); | return d_cconst('d', 'C', 'd', 'n'); | ||||
| #endif | |||||
| #elif CARDINAL_VARIANT_FX | |||||
| return d_cconst('d', 'C', 'n', 'F'); | |||||
| #elif CARDINAL_VARIANT_SYNTH | |||||
| return d_cconst('d', 'C', 'n', 'S'); | |||||
| #else | |||||
| #error cardinal variant not set | |||||
| #endif | |||||
| } | } | ||||
| /* -------------------------------------------------------------------------------------------------------- | /* -------------------------------------------------------------------------------------------------------- | ||||
| @@ -892,42 +854,25 @@ protected: | |||||
| void activate() override | void activate() override | ||||
| { | { | ||||
| #if DISTRHO_PLUGIN_NUM_INPUTS != 0 | |||||
| const uint32_t bufferSize = getBufferSize(); | const uint32_t bufferSize = getBufferSize(); | ||||
| fAudioBufferOut = new float[bufferSize * DISTRHO_PLUGIN_NUM_OUTPUTS]; | |||||
| const uint32_t numInputs = std::max(1, DISTRHO_PLUGIN_NUM_INPUTS); | |||||
| fAudioBufferIn = new float[bufferSize * numInputs]; | |||||
| std::memset(fAudioBufferIn, 0, sizeof(float)*bufferSize * numInputs); | |||||
| fAudioBufferCopy = new float*[DISTRHO_PLUGIN_NUM_INPUTS]; | |||||
| for (int i=0; i<DISTRHO_PLUGIN_NUM_OUTPUTS; ++i) | |||||
| fAudioBufferCopy[i] = new float[newBufferSize]; | |||||
| #endif | |||||
| fPreviousFrame = 0; | fPreviousFrame = 0; | ||||
| { | |||||
| const MutexLocker cml(fDeviceMutex); | |||||
| if (fCurrentAudioDevice != nullptr) | |||||
| { | |||||
| rack::contextSet(context); | |||||
| fCurrentAudioDevice->onStartStream(); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| void deactivate() override | void deactivate() override | ||||
| { | { | ||||
| if (fAudioBufferCopy != nullptr) | |||||
| { | { | ||||
| const MutexLocker cml(fDeviceMutex); | |||||
| if (fCurrentAudioDevice != nullptr) | |||||
| { | |||||
| rack::contextSet(context); | |||||
| fCurrentAudioDevice->onStopStream(); | |||||
| } | |||||
| for (int i=0; i<DISTRHO_PLUGIN_NUM_OUTPUTS; ++i) | |||||
| delete[] fAudioBufferCopy[i]; | |||||
| delete[] fAudioBufferCopy; | |||||
| fAudioBufferCopy = nullptr; | |||||
| } | } | ||||
| delete[] fAudioBufferOut; | |||||
| fAudioBufferOut = nullptr; | |||||
| delete[] fAudioBufferIn; | |||||
| fAudioBufferIn = nullptr; | |||||
| } | } | ||||
| inline void sendSingleSimpleMidiMessage(const MidiEvent& midiEvent) | inline void sendSingleSimpleMidiMessage(const MidiEvent& midiEvent) | ||||
| @@ -1006,41 +951,26 @@ protected: | |||||
| (*inputs)->handleMessagesFromHost(midiEvents, midiEventCount); | (*inputs)->handleMessagesFromHost(midiEvents, midiEventCount); | ||||
| } | } | ||||
| if (fCurrentAudioDevice != nullptr) | |||||
| // separate buffers, use them | |||||
| if (inputs != outputs && (inputs == nullptr || inputs[0] != outputs[0])) | |||||
| { | { | ||||
| #if CARDINAL_NUM_AUDIO_INPUTS != 0 | |||||
| for (uint32_t i=0, j=0; i<frames; ++i) | |||||
| for (uint32_t k=0; k<CARDINAL_NUM_AUDIO_INPUTS; ++k) | |||||
| fAudioBufferIn[j++] = inputs[k][i]; | |||||
| fCurrentAudioDevice->processInput(fAudioBufferIn, CARDINAL_NUM_AUDIO_INPUTS, frames); | |||||
| #else | |||||
| std::memset(fAudioBufferIn, 0, sizeof(float)*frames); | |||||
| fCurrentAudioDevice->processInput(fAudioBufferIn, 1, frames); | |||||
| #endif | |||||
| } | |||||
| #if CARDINAL_VARIANT_MAIN | |||||
| context->dataFrame = 0; | |||||
| context->dataIns = inputs; | |||||
| context->dataOuts = outputs; | |||||
| #endif | |||||
| context->engine->stepBlock(frames); | |||||
| if (fCurrentAudioDevice != nullptr) | |||||
| { | |||||
| std::memset(fAudioBufferOut, 0, sizeof(float)*frames*CARDINAL_NUM_AUDIO_OUTPUTS); | |||||
| fCurrentAudioDevice->processOutput(fAudioBufferOut, CARDINAL_NUM_AUDIO_OUTPUTS, frames); | |||||
| for (uint32_t i=0, j=0; i<frames; ++i) | |||||
| for (uint32_t k=0; k<CARDINAL_NUM_AUDIO_OUTPUTS; ++k) | |||||
| outputs[k][i] = fAudioBufferOut[j++]; | |||||
| context->dataIns = inputs; | |||||
| context->dataOuts = outputs; | |||||
| } | } | ||||
| // inline processing, use a safe copy | |||||
| else | else | ||||
| { | { | ||||
| for (uint32_t k=0; k<CARDINAL_NUM_AUDIO_OUTPUTS; ++k) | |||||
| std::memset(outputs[k], 0, sizeof(float)*frames); | |||||
| for (int i=0; i<DISTRHO_PLUGIN_NUM_OUTPUTS; ++i) | |||||
| std::memcpy(fAudioBufferCopy[i], inputs[i], sizeof(float)*frames); | |||||
| context->dataIns = fAudioBufferCopy; | |||||
| context->dataOuts = outputs; | |||||
| } | } | ||||
| for (int i=0; i<DISTRHO_PLUGIN_NUM_OUTPUTS; ++i) | |||||
| std::memset(outputs[i], 0, sizeof(float)*frames); | |||||
| context->engine->stepBlock(frames); | |||||
| } | } | ||||
| void bufferSizeChanged(const uint32_t newBufferSize) override | void bufferSizeChanged(const uint32_t newBufferSize) override | ||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| * DISTRHO Cardinal Plugin | * DISTRHO Cardinal Plugin | ||||
| * Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| * modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
| @@ -39,20 +39,26 @@ START_NAMESPACE_DISTRHO | |||||
| static constexpr const uint kModuleParameters = 24; | static constexpr const uint kModuleParameters = 24; | ||||
| enum CardinalVariant { | |||||
| kCardinalVariantMain, | |||||
| kCardinalVariantFX, | |||||
| kCardinalVariantSynth, | |||||
| }; | |||||
| // ----------------------------------------------------------------------------------------------------------- | // ----------------------------------------------------------------------------------------------------------- | ||||
| struct CardinalPluginContext : rack::Context { | struct CardinalPluginContext : rack::Context { | ||||
| uint32_t bufferSize; | uint32_t bufferSize; | ||||
| double sampleRate; | double sampleRate; | ||||
| float parameters[kModuleParameters]; | float parameters[kModuleParameters]; | ||||
| bool playing, reset, bbtValid, loadedHostCV; | |||||
| CardinalVariant variant; | |||||
| bool playing, reset, bbtValid; | |||||
| int32_t bar, beat, beatsPerBar, beatType; | int32_t bar, beat, beatsPerBar, beatType; | ||||
| uint64_t frame; | uint64_t frame; | ||||
| double barStartTick, beatsPerMinute; | double barStartTick, beatsPerMinute; | ||||
| double tick, tickClock, ticksPerBeat, ticksPerClock, ticksPerFrame; | double tick, tickClock, ticksPerBeat, ticksPerClock, ticksPerFrame; | ||||
| uintptr_t nativeWindowId; | uintptr_t nativeWindowId; | ||||
| uint32_t dataFrame; | |||||
| const float** dataIns; | |||||
| const float* const* dataIns; | |||||
| float** dataOuts; | float** dataOuts; | ||||
| Plugin* const plugin; | Plugin* const plugin; | ||||
| #ifndef HEADLESS | #ifndef HEADLESS | ||||
| @@ -62,10 +68,18 @@ struct CardinalPluginContext : rack::Context { | |||||
| CardinalPluginContext(Plugin* const p) | CardinalPluginContext(Plugin* const p) | ||||
| : bufferSize(p->getBufferSize()), | : bufferSize(p->getBufferSize()), | ||||
| sampleRate(p->getSampleRate()), | sampleRate(p->getSampleRate()), | ||||
| #if CARDINAL_VARIANT_MAIN | |||||
| variant(kCardinalVariantMain), | |||||
| #elif CARDINAL_VARIANT_FX | |||||
| variant(kCardinalVariantFX), | |||||
| #elif CARDINAL_VARIANT_SYNTH | |||||
| variant(kCardinalVariantSynth), | |||||
| #else | |||||
| #error cardinal variant not set | |||||
| #endif | |||||
| playing(false), | playing(false), | ||||
| reset(false), | reset(false), | ||||
| bbtValid(false), | bbtValid(false), | ||||
| loadedHostCV(false), | |||||
| bar(1), | bar(1), | ||||
| beat(1), | beat(1), | ||||
| beatsPerBar(4), | beatsPerBar(4), | ||||
| @@ -79,7 +93,6 @@ struct CardinalPluginContext : rack::Context { | |||||
| ticksPerClock(0.0), | ticksPerClock(0.0), | ||||
| ticksPerFrame(0.0), | ticksPerFrame(0.0), | ||||
| nativeWindowId(0), | nativeWindowId(0), | ||||
| dataFrame(0), | |||||
| dataIns(nullptr), | dataIns(nullptr), | ||||
| dataOuts(nullptr), | dataOuts(nullptr), | ||||
| plugin(p) | plugin(p) | ||||
| @@ -116,10 +129,6 @@ public: | |||||
| : Plugin(parameterCount, programCount, stateCount), | : Plugin(parameterCount, programCount, stateCount), | ||||
| context(new CardinalPluginContext(this)) {} | context(new CardinalPluginContext(this)) {} | ||||
| ~CardinalBasePlugin() override {} | ~CardinalBasePlugin() override {} | ||||
| virtual bool isActive() const noexcept = 0; | |||||
| virtual bool canAssignAudioDevice() const noexcept = 0; | |||||
| virtual bool clearAudioDevice(CardinalAudioDevice* dev) noexcept = 0; | |||||
| virtual void assignAudioDevice(CardinalAudioDevice* dev) noexcept = 0; | |||||
| virtual void assignMidiInputDevice(CardinalMidiInputDevice* dev) noexcept = 0; | virtual void assignMidiInputDevice(CardinalMidiInputDevice* dev) noexcept = 0; | ||||
| virtual void assignMidiOutputDevice(CardinalMidiOutputDevice* dev) noexcept = 0; | virtual void assignMidiOutputDevice(CardinalMidiOutputDevice* dev) noexcept = 0; | ||||
| virtual void clearMidiInputDevice(CardinalMidiInputDevice* dev) noexcept = 0; | virtual void clearMidiInputDevice(CardinalMidiInputDevice* dev) noexcept = 0; | ||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| * DISTRHO Cardinal Plugin | * DISTRHO Cardinal Plugin | ||||
| * Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| * modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
| @@ -23,145 +23,6 @@ START_NAMESPACE_DISTRHO | |||||
| // ----------------------------------------------------------------------------------------------------------- | // ----------------------------------------------------------------------------------------------------------- | ||||
| struct CardinalAudioDevice : rack::audio::Device | |||||
| { | |||||
| CardinalBasePlugin* const fPlugin; | |||||
| CardinalAudioDevice(CardinalBasePlugin* const plugin) | |||||
| : fPlugin(plugin) {} | |||||
| std::string getName() override | |||||
| { | |||||
| return "Cardinal"; | |||||
| } | |||||
| int getNumInputs() override | |||||
| { | |||||
| return CARDINAL_NUM_AUDIO_INPUTS; | |||||
| } | |||||
| int getNumOutputs() override | |||||
| { | |||||
| return CARDINAL_NUM_AUDIO_OUTPUTS; | |||||
| } | |||||
| int getBlockSize() override | |||||
| { | |||||
| return fPlugin->getBufferSize(); | |||||
| } | |||||
| float getSampleRate() override | |||||
| { | |||||
| return fPlugin->getSampleRate(); | |||||
| } | |||||
| std::set<int> getBlockSizes() override | |||||
| { | |||||
| return std::set<int>({ getBlockSize() }); | |||||
| } | |||||
| std::set<float> getSampleRates() override | |||||
| { | |||||
| return std::set<float>({ getSampleRate() }); | |||||
| } | |||||
| void setBlockSize(int) override {} | |||||
| void setSampleRate(float) override {} | |||||
| void processInput(const float* const input, const int inputStride, const int frames) | |||||
| { | |||||
| for (rack::audio::Port* port : subscribed) | |||||
| port->processInput(input + port->inputOffset, inputStride, frames); | |||||
| } | |||||
| void processOutput(float* const output, const int outputStride, const int frames) | |||||
| { | |||||
| for (rack::audio::Port* port : subscribed) | |||||
| port->processOutput(output + port->outputOffset, outputStride, frames); | |||||
| } | |||||
| }; | |||||
| // ----------------------------------------------------------------------------------------------------------- | |||||
| struct CardinalAudioDriver : rack::audio::Driver | |||||
| { | |||||
| CardinalAudioDriver() {} | |||||
| std::string getName() override | |||||
| { | |||||
| return "Plugin Driver"; | |||||
| } | |||||
| std::vector<int> getDeviceIds() override | |||||
| { | |||||
| return std::vector<int>({ 0 }); | |||||
| } | |||||
| int getDefaultDeviceId() override | |||||
| { | |||||
| return 0; | |||||
| } | |||||
| std::string getDeviceName(int) override | |||||
| { | |||||
| return "Plugin Device"; | |||||
| } | |||||
| int getDeviceNumInputs(int) override | |||||
| { | |||||
| return CARDINAL_NUM_AUDIO_INPUTS; | |||||
| } | |||||
| int getDeviceNumOutputs(int) override | |||||
| { | |||||
| return CARDINAL_NUM_AUDIO_OUTPUTS; | |||||
| } | |||||
| rack::audio::Device* subscribe(int, rack::audio::Port* const port) override | |||||
| { | |||||
| CardinalPluginContext* const pluginContext = reinterpret_cast<CardinalPluginContext*>(port->context); | |||||
| DISTRHO_SAFE_ASSERT_RETURN(pluginContext != nullptr, nullptr); | |||||
| CardinalBasePlugin* const plugin = reinterpret_cast<CardinalBasePlugin*>(pluginContext->plugin); | |||||
| DISTRHO_SAFE_ASSERT_RETURN(plugin != nullptr, nullptr); | |||||
| if (! plugin->canAssignAudioDevice()) | |||||
| throw rack::Exception("Plugin driver only allows one audio device to be used simultaneously"); | |||||
| CardinalAudioDevice* const device = new CardinalAudioDevice(plugin); | |||||
| device->subscribe(port); | |||||
| if (plugin->isActive()) | |||||
| device->onStartStream(); | |||||
| plugin->assignAudioDevice(device); | |||||
| return device; | |||||
| } | |||||
| void unsubscribe(int, rack::audio::Port* const port) override | |||||
| { | |||||
| CardinalAudioDevice* const device = reinterpret_cast<CardinalAudioDevice*>(port->device); | |||||
| DISTRHO_SAFE_ASSERT_RETURN(device != nullptr,); | |||||
| CardinalPluginContext* const pluginContext = reinterpret_cast<CardinalPluginContext*>(port->context); | |||||
| DISTRHO_SAFE_ASSERT_RETURN(pluginContext != nullptr,); | |||||
| CardinalBasePlugin* const plugin = reinterpret_cast<CardinalBasePlugin*>(pluginContext->plugin); | |||||
| DISTRHO_SAFE_ASSERT_RETURN(plugin != nullptr,); | |||||
| if (plugin->clearAudioDevice(device)) | |||||
| { | |||||
| if (plugin->isActive()) | |||||
| device->onStopStream(); | |||||
| device->unsubscribe(port); | |||||
| delete device; | |||||
| } | |||||
| } | |||||
| }; | |||||
| // ----------------------------------------------------------------------------------------------------------- | |||||
| struct CardinalMidiInputDevice : rack::midi::InputDevice | struct CardinalMidiInputDevice : rack::midi::InputDevice | ||||
| { | { | ||||
| CardinalBasePlugin* const fPlugin; | CardinalBasePlugin* const fPlugin; | ||||
| @@ -4,8 +4,8 @@ | |||||
| "modules": [ | "modules": [ | ||||
| { | { | ||||
| "id": 1, | "id": 1, | ||||
| "plugin": "Core", | |||||
| "model": "AudioInterface2", | |||||
| "plugin": "Cardinal", | |||||
| "model": "HostAudio2", | |||||
| "version": "2.0", | "version": "2.0", | ||||
| "params": [ | "params": [ | ||||
| { | { | ||||
| @@ -15,14 +15,6 @@ | |||||
| ], | ], | ||||
| "rightModuleId": 2, | "rightModuleId": 2, | ||||
| "data": { | "data": { | ||||
| "audio": { | |||||
| "driver": 0, | |||||
| "deviceName": "Cardinal", | |||||
| "sampleRate": 48000.0, | |||||
| "blockSize": 512, | |||||
| "inputOffset": 0, | |||||
| "outputOffset": 0 | |||||
| }, | |||||
| "dcFilter": true | "dcFilter": true | ||||
| }, | }, | ||||
| "pos": [ | "pos": [ | ||||