1
Fork 0

Implement MIDI-Map, finishing all core replacements

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-01-30 00:33:54 +00:00
parent eec0438d50
commit cb26617890
No known key found for this signature in database
GPG Key ID: CDBAA37ABC74FBA0
11 changed files with 749 additions and 193 deletions

View File

@ -42,5 +42,3 @@ std::complex<float> operator/(const std::complex<double>& a, const std::complex<
}
}
// std::complex<double>

View File

@ -0,0 +1,157 @@
<?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="50.799999mm"
height="128.5mm"
viewBox="0 0 50.799999 128.5"
version="1.1"
id="svg4620"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
sodipodi:docname="HostMIDIMap.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="1.979899"
inkscape:cx="78.796781"
inkscape:cy="334.1128"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1026"
inkscape:window-x="1920"
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
id="g843"
transform="translate(2.9547323)">
<g
transform="matrix(6.342689,0,0,6.342689,5.4472535,175.6457)"
id="g5299"
style="fill-rule:evenodd">
<g
inkscape:label="Layer 1"
id="Layer_x0020_1"
transform="translate(-1.6191379e-5,-0.08553947)">
<metadata
id="CorelCorpID_0Corel-Layer" />
<circle
class="fil0 str0"
cx="0.525226"
cy="0.61075097"
r="0.15916"
id="circle10"
style="fill:none;stroke:#ffffff;stroke-width:0.0966867;stroke-opacity:1" />
<circle
class="fil0 str1"
cx="0.525226"
cy="0.61075097"
r="0.42853901"
id="circle12"
style="fill:none;stroke:#ffffff;stroke-width:0.193345;stroke-opacity:1" />
</g>
</g>
<g
transform="translate(-0.09449404,0.14174107)"
id="text5303"
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"
aria-label="Cardinal">
<path
inkscape:connector-curvature="0"
id="path5305"
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 17.923601,176.99103 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" />
<path
inkscape:connector-curvature="0"
id="path5307"
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 20.444377,179.51801 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" />
<path
inkscape:connector-curvature="0"
id="path5309"
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 24.769695,178.32429 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" />
<path
inkscape:connector-curvature="0"
id="path5311"
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 27.541618,178.31808 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" />
<path
inkscape:connector-curvature="0"
id="path5313"
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 29.287248,177.79099 h 0.570508 v 3.47265 h -0.570508 z m 0,-1.35186 h 0.570508 v 0.72244 h -0.570508 z" />
<path
inkscape:connector-curvature="0"
id="path5315"
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 33.938127,179.16765 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" />
<path
inkscape:connector-curvature="0"
id="path5317"
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 36.654241,179.51801 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" />
<path
inkscape:connector-curvature="0"
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" />
</g>
</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="3.1665533"
y="188.65312"
id="text845"><tspan
sodipodi:role="line"
id="tspan843"
x="3.1665533"
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 MIDI CC Map</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -59,7 +59,7 @@
{
"slug": "HostMIDIGate",
"name": "Host MIDI Gate",
"description": "Exposes host-provided MIDI as gates in a module",
"description": "Exposes host-provided MIDI notes as gates in a module",
"tags": [
"External",
"MIDI"
@ -67,8 +67,8 @@
},
{
"slug": "HostMIDIMap",
"name": "Host MIDI Map",
"description": "Allows host-provided MIDI to control other module parameters",
"name": "Host MIDI CC Map",
"description": "Allows host-provided MIDI CC to control other module parameters",
"tags": [
"External",
"MIDI"

View File

@ -0,0 +1,216 @@
<?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="50.799999mm"
height="128.5mm"
viewBox="0 0 50.799999 128.5"
version="1.1"
id="svg4620"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
sodipodi:docname="HostMIDIMap.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="1.979899"
inkscape:cx="78.796781"
inkscape:cy="334.1128"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1026"
inkscape:window-x="1920"
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
id="g843"
transform="translate(2.9547323)">
<g
transform="matrix(6.342689,0,0,6.342689,5.4472535,175.6457)"
id="g5299"
style="fill-rule:evenodd">
<g
inkscape:label="Layer 1"
id="Layer_x0020_1"
transform="translate(-1.6191379e-5,-0.08553947)">
<metadata
id="CorelCorpID_0Corel-Layer" />
<circle
class="fil0 str0"
cx="0.525226"
cy="0.61075097"
r="0.15916"
id="circle10"
style="fill:none;stroke:#ffffff;stroke-width:0.0966867;stroke-opacity:1" />
<circle
class="fil0 str1"
cx="0.525226"
cy="0.61075097"
r="0.42853901"
id="circle12"
style="fill:none;stroke:#ffffff;stroke-width:0.193345;stroke-opacity:1" />
</g>
</g>
<g
transform="translate(-0.09449404,0.14174107)"
id="text5303"
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"
aria-label="Cardinal">
<path
inkscape:connector-curvature="0"
id="path5305"
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 17.923601,176.99103 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" />
<path
inkscape:connector-curvature="0"
id="path5307"
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 20.444377,179.51801 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" />
<path
inkscape:connector-curvature="0"
id="path5309"
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 24.769695,178.32429 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" />
<path
inkscape:connector-curvature="0"
id="path5311"
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 27.541618,178.31808 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" />
<path
inkscape:connector-curvature="0"
id="path5313"
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 29.287248,177.79099 h 0.570508 v 3.47265 h -0.570508 z m 0,-1.35186 h 0.570508 v 0.72244 h -0.570508 z" />
<path
inkscape:connector-curvature="0"
id="path5315"
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 33.938127,179.16765 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" />
<path
inkscape:connector-curvature="0"
id="path5317"
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 36.654241,179.51801 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" />
<path
inkscape:connector-curvature="0"
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" />
</g>
</g>
<g
aria-label="Host MIDI CC Map"
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 3.6512783,185.05265 h 0.4871366 v 1.47588 h 1.7700905 v -1.47588 H 6.395642 v 3.60047 H 5.9085054 V 186.9385 H 4.1384149 v 1.71462 H 3.6512783 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="path830"
inkscape:connector-curvature="0" />
<path
d="m 8.3924198,186.26326 q -0.356912,0 -0.5643068,0.27974 -0.2073948,0.27733 -0.2073948,0.76206 0,0.48472 0.2049833,0.76446 0.2073947,0.27733 0.5667183,0.27733 0.3545004,0 0.5618952,-0.27974 0.2073948,-0.27974 0.2073948,-0.76205 0,-0.47991 -0.2073948,-0.75965 -0.2073948,-0.28215 -0.5618952,-0.28215 z m 0,-0.37621 q 0.5787762,0 0.9091609,0.37621 0.3303847,0.3762 0.3303847,1.0418 0,0.66318 -0.3303847,1.04179 -0.3303847,0.37621 -0.9091609,0.37621 -0.5811878,0 -0.9115725,-0.37621 -0.3279731,-0.37861 -0.3279731,-1.04179 0,-0.6656 0.3279731,-1.0418 0.3303847,-0.37621 0.9115725,-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="path832"
inkscape:connector-curvature="0" />
<path
d="m 12.089353,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.233923,-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="path834"
inkscape:connector-curvature="0" />
<path
d="m 13.379541,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="path836"
inkscape:connector-curvature="0" />
<path
d="m 16.466347,185.05265 h 0.725882 l 0.918807,2.45015 0.923631,-2.45015 h 0.725882 v 3.60047 H 19.28547 v -3.16156 l -0.928454,2.46944 h -0.489548 l -0.928453,-2.46944 v 3.16156 h -0.472668 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"
inkscape:connector-curvature="0" />
<path
d="m 20.727588,185.05265 h 0.487136 v 3.60047 h -0.487136 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"
inkscape:connector-curvature="0" />
<path
d="m 22.671311,185.45297 v 2.79983 h 0.588422 q 0.745175,0 1.090029,-0.33762 0.347266,-0.33762 0.347266,-1.06591 0,-0.72347 -0.347266,-1.05868 -0.344854,-0.33762 -1.090029,-0.33762 z m -0.487137,-0.40032 h 1.000801 q 1.04662,0 1.536168,0.4365 0.489548,0.43408 0.489548,1.36012 0,0.93086 -0.491959,1.36736 -0.49196,0.43649 -1.533757,0.43649 h -1.000801 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"
inkscape:connector-curvature="0" />
<path
d="m 25.987216,185.05265 h 0.487136 v 3.60047 h -0.487136 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"
inkscape:connector-curvature="0" />
<path
d="m 31.709864,185.32998 v 0.51367 q -0.24598,-0.2291 -0.525722,-0.34245 -0.27733,-0.11334 -0.590834,-0.11334 -0.617361,0 -0.945334,0.37862 -0.327973,0.3762 -0.327973,1.09002 0,0.71142 0.327973,1.09003 0.327973,0.37621 0.945334,0.37621 0.313504,0 0.590834,-0.11335 0.279742,-0.11334 0.525722,-0.34244 v 0.50884 q -0.255626,0.17363 -0.542603,0.26045 -0.284565,0.0868 -0.602891,0.0868 -0.817522,0 -1.287777,-0.4992 -0.470256,-0.5016 -0.470256,-1.36736 0,-0.86816 0.470256,-1.36735 0.470255,-0.50161 1.287777,-0.50161 0.32315,0 0.607715,0.0868 0.286976,0.0844 0.537779,0.25562 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"
inkscape:connector-curvature="0" />
<path
d="m 35.158406,185.32998 v 0.51367 q -0.24598,-0.2291 -0.525722,-0.34245 -0.27733,-0.11334 -0.590834,-0.11334 -0.617361,0 -0.945334,0.37862 -0.327974,0.3762 -0.327974,1.09002 0,0.71142 0.327974,1.09003 0.327973,0.37621 0.945334,0.37621 0.313504,0 0.590834,-0.11335 0.279742,-0.11334 0.525722,-0.34244 v 0.50884 q -0.255626,0.17363 -0.542603,0.26045 -0.284565,0.0868 -0.602892,0.0868 -0.817521,0 -1.287777,-0.4992 -0.470255,-0.5016 -0.470255,-1.36736 0,-0.86816 0.470255,-1.36735 0.470256,-0.50161 1.287777,-0.50161 0.32315,0 0.607715,0.0868 0.286977,0.0844 0.53778,0.25562 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"
inkscape:connector-curvature="0" />
<path
d="m 37.480746,185.05265 h 0.725882 l 0.918807,2.45015 0.92363,-2.45015 h 0.725882 v 3.60047 h -0.475079 v -3.16156 l -0.928453,2.46944 h -0.489548 l -0.928454,-2.46944 v 3.16156 h -0.472667 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="path850"
inkscape:connector-curvature="0" />
<path
d="m 42.950179,187.29541 q -0.537779,0 -0.745174,0.12299 -0.207395,0.12299 -0.207395,0.41961 0,0.23634 0.154341,0.37621 0.156752,0.13746 0.424435,0.13746 0.36897,0 0.590834,-0.26045 0.224276,-0.26286 0.224276,-0.69695 v -0.0989 z m 0.885046,-0.18328 v 1.54099 h -0.443729 v -0.40996 q -0.151928,0.24598 -0.378616,0.36414 -0.226687,0.11576 -0.55466,0.11576 -0.41479,0 -0.66077,-0.23151 -0.243568,-0.23393 -0.243568,-0.6246 0,-0.45579 0.303857,-0.6873 0.306269,-0.23151 0.911573,-0.23151 h 0.622184 v -0.0434 q 0,-0.30627 -0.202571,-0.47267 -0.20016,-0.16881 -0.564307,-0.16881 -0.231511,0 -0.450963,0.0555 -0.219453,0.0555 -0.422025,0.1664 v -0.40996 q 0.243569,-0.0941 0.472668,-0.13987 0.229099,-0.0482 0.44614,-0.0482 0.58601,0 0.875399,0.30386 0.289388,0.30386 0.289388,0.92122 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="path852"
inkscape:connector-curvature="0" />
<path
d="m 45.17847,188.24798 v 1.43247 h -0.44614 v -3.72828 h 0.44614 v 0.40996 q 0.139871,-0.24115 0.352089,-0.35691 0.21463,-0.11817 0.511253,-0.11817 0.491959,0 0.798228,0.39068 0.308681,0.39067 0.308681,1.02733 0,0.63665 -0.308681,1.02732 -0.306269,0.39068 -0.798228,0.39068 -0.296623,0 -0.511253,-0.11576 -0.212218,-0.11816 -0.352089,-0.35932 z m 1.509642,-0.94292 q 0,-0.48955 -0.202572,-0.76688 -0.20016,-0.27974 -0.552249,-0.27974 -0.352089,0 -0.554661,0.27974 -0.20016,0.27733 -0.20016,0.76688 0,0.48954 0.20016,0.76929 0.202572,0.27733 0.554661,0.27733 0.352089,0 0.552249,-0.27733 0.202572,-0.27975 0.202572,-0.76929 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="path854"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -33,7 +33,7 @@
USE_NAMESPACE_DISTRHO;
static const int MAX_CHANNELS = 128;
static const int MAX_MIDI_CONTROL = 120; /* 0x77 + 1 */
struct HostMIDIMap : Module {
enum ParamIds {
@ -55,6 +55,7 @@ struct HostMIDIMap : Module {
uint32_t midiEventsLeft;
uint32_t midiEventFrame;
int64_t lastBlockFrame;
int nextLearningId;
uint8_t channel;
// from Rack
@ -62,9 +63,9 @@ struct HostMIDIMap : Module {
/** Number of maps */
int mapLen = 0;
/** The mapped CC number of each channel */
int ccs[MAX_CHANNELS];
int ccs[MAX_MIDI_CONTROL];
/** The mapped param handle of each channel */
ParamHandle paramHandles[MAX_CHANNELS];
ParamHandle paramHandles[MAX_MIDI_CONTROL];
/** Channel ID of the learning session */
int learningId;
@ -74,10 +75,10 @@ struct HostMIDIMap : Module {
bool learnedParam;
/** The value of each CC number */
int8_t values[128];
int8_t values[MAX_MIDI_CONTROL];
/** The smoothing processor (normalized between 0 and 1) of each channel */
dsp::ExponentialFilter valueFilters[MAX_CHANNELS];
bool filterInitialized[MAX_CHANNELS] = {};
dsp::ExponentialFilter valueFilters[MAX_MIDI_CONTROL];
bool filterInitialized[MAX_MIDI_CONTROL] = {};
dsp::ClockDivider divider;
HostMIDIMap()
@ -88,13 +89,13 @@ struct HostMIDIMap : Module {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
for (int id = 0; id < MAX_CHANNELS; ++id)
{
paramHandles[id].color = nvgRGB(0xff, 0xff, 0x40);
for (int id = 0; id < MAX_MIDI_CONTROL; ++id)
// {
// paramHandles[id].color = nvgRGB(0xff, 0xff, 0x40);
pcontext->engine->addParamHandle(&paramHandles[id]);
}
// }
for (int i = 0; i < MAX_CHANNELS; i++)
for (int i = 0; i < MAX_MIDI_CONTROL; i++)
valueFilters[i].setTau(1 / 30.f);
divider.setDivision(32);
@ -106,7 +107,7 @@ struct HostMIDIMap : Module {
if (pcontext == nullptr)
return;
for (int id = 0; id < MAX_CHANNELS; ++id)
for (int id = 0; id < MAX_MIDI_CONTROL; ++id)
pcontext->engine->removeParamHandle(&paramHandles[id]);
}
@ -116,6 +117,7 @@ struct HostMIDIMap : Module {
midiEventsLeft = 0;
midiEventFrame = 0;
lastBlockFrame = -1;
nextLearningId = -1;
channel = 0;
smooth = true;
@ -126,9 +128,6 @@ struct HostMIDIMap : Module {
// We also might be in the MIDIMap() constructor, which could cause problems, but when constructing, all ParamHandles will point to no Modules anyway.
clearMaps_NoLock();
mapLen = 1;
for (int i = 0; i < 128; i++) {
values[i] = -1;
}
}
void process(const ProcessArgs& args) override
@ -175,25 +174,24 @@ struct HostMIDIMap : Module {
// adapted from Rack
if ((data[0] & 0xF0) != 0xB0)
continue;
if (data[1] >= MAX_MIDI_CONTROL)
continue;
uint8_t cc = data[1];
int8_t value = data[2];
const uint8_t cc = data[1];
const int8_t value = data[2];
// Learn
if (0 <= learningId && values[cc] != value)
if (learningId >= 0 && values[cc] != value)
{
ccs[learningId] = cc;
filterInitialized[cc] = false;
valueFilters[learningId].reset();
learnedCc = true;
commitLearn();
updateMapLen();
maybeCommitLearn();
refreshParamHandleText(learningId);
updateMapLen();
}
// Ignore negative values generated using the nonstandard 8-bit MIDI extension from the gamepad driver
if (value < 0)
continue;
values[cc] = value;
}
@ -202,80 +200,144 @@ struct HostMIDIMap : Module {
// Step channels
for (int id = 0; id < mapLen; ++id)
{
int cc = ccs[id];
const int cc = ccs[id];
if (cc < 0)
continue;
// Get Module
Module* module = paramHandles[id].module;
Module* const module = paramHandles[id].module;
if (!module)
continue;
// Get ParamQuantity from ParamHandle
int paramId = paramHandles[id].paramId;
ParamQuantity* paramQuantity = module->paramQuantities[paramId];
const int paramId = paramHandles[id].paramId;
ParamQuantity* const paramQuantity = module->paramQuantities[paramId];
if (!paramQuantity)
continue;
if (!paramQuantity->isBounded())
continue;
// Set filter from param value if filter is uninitialized
if (!filterInitialized[id]) {
if (!filterInitialized[id])
{
valueFilters[id].out = paramQuantity->getScaledValue();
filterInitialized[id] = true;
continue;
}
// Check if CC has been set by the MIDI device
if (values[cc] < 0)
continue;
float value = values[cc] / 127.f;
const float value = values[cc] / 127.f;
// Detect behavior from MIDI buttons.
if (smooth && std::fabs(valueFilters[id].out - value) < 1.f) {
if (smooth && std::fabs(valueFilters[id].out - value) < 1.f)
{
// Smooth value with filter
valueFilters[id].process(args.sampleTime * divider.getDivision(), value);
if (d_isEqual(valueFilters[id].process(args.sampleTime * divider.getDivision(), value), value))
{
values[cc] = -1;
continue;
}
}
else {
else
{
// Jump value
if (d_isEqual(valueFilters[id].out, value))
{
values[cc] = -1;
continue;
}
valueFilters[id].out = value;
}
paramQuantity->setScaledValue(valueFilters[id].out);
}
}
void clearMap(int id)
{
nextLearningId = -1;
learningId = -1;
learnedCc = false;
learnedParam = false;
ccs[id] = -1;
values[id] = -1;
pcontext->engine->updateParamHandle(&paramHandles[id], -1, 0, true);
valueFilters[id].reset();
updateMapLen();
refreshParamHandleText(id);
updateMapLen();
}
// ----------------------------------------------------------------------------------------------------------------
// stuff for resetting state
void clearMaps_NoLock()
{
nextLearningId = -1;
learningId = -1;
for (int id = 0; id < MAX_CHANNELS; id++) {
learnedCc = false;
learnedParam = false;
for (int id = 0; id < MAX_MIDI_CONTROL; ++id)
{
ccs[id] = -1;
values[id] = -1;
pcontext->engine->updateParamHandle_NoLock(&paramHandles[id], -1, 0, true);
valueFilters[id].reset();
refreshParamHandleText(id);
}
mapLen = 0;
}
void updateMapLen()
void setChannel(uint8_t channel)
{
// Find last nonempty map
int id;
for (id = MAX_CHANNELS - 1; id >= 0; id--) {
if (ccs[id] >= 0 || paramHandles[id].moduleId >= 0)
break;
}
mapLen = id + 1;
// Add an empty "Mapping..." slot
if (mapLen < MAX_CHANNELS)
mapLen++;
this->channel = channel;
for (int i = 0; i < MAX_MIDI_CONTROL; ++i)
values[i] = -1;
}
void commitLearn()
// ----------------------------------------------------------------------------------------------------------------
// stuff called from panel side, must lock engine
// called from onSelect
void enableLearn(const int id)
{
if (learningId == id)
return;
ccs[id] = -1;
nextLearningId = -1;
learningId = id;
learnedCc = false;
learnedParam = false;
}
// called from onDeselect
void disableLearn(const int id)
{
nextLearningId = -1;
if (learningId == id)
learningId = -1;
}
// called from onDeselect
void learnParam(const int id, const int64_t moduleId, const int paramId)
{
pcontext->engine->updateParamHandle(&paramHandles[id], moduleId, paramId, true);
learnedParam = true;
maybeCommitLearn();
updateMapLen();
}
// ----------------------------------------------------------------------------------------------------------------
// common utils
void maybeCommitLearn()
{
if (learningId < 0)
return;
@ -283,42 +345,27 @@ struct HostMIDIMap : Module {
return;
if (!learnedParam)
return;
// Reset learned state
learnedCc = false;
learnedParam = false;
// Find next incomplete map
while (++learningId < MAX_CHANNELS) {
while (++learningId < MAX_MIDI_CONTROL)
{
if (ccs[learningId] < 0 || paramHandles[learningId].moduleId < 0)
{
nextLearningId = learningId;
return;
}
}
learningId = -1;
nextLearningId = learningId = -1;
}
void enableLearn(int id)
// FIXME this allocates string during RT!!
void refreshParamHandleText(const int id)
{
if (learningId != id) {
learningId = id;
learnedCc = false;
learnedParam = false;
}
}
void disableLearn(int id)
{
if (learningId == id) {
learningId = -1;
}
}
void learnParam(int id, int64_t moduleId, int paramId)
{
pcontext->engine->updateParamHandle(&paramHandles[id], moduleId, paramId, true);
learnedParam = true;
commitLearn();
updateMapLen();
}
void refreshParamHandleText(int id) {
std::string text;
if (ccs[id] >= 0)
text = string::f("CC%02d", ccs[id]);
@ -327,6 +374,26 @@ struct HostMIDIMap : Module {
paramHandles[id].text = text;
}
void updateMapLen()
{
// Find last nonempty map
int id;
for (id = MAX_MIDI_CONTROL; --id >= 0;)
{
if (ccs[id] >= 0 || paramHandles[id].moduleId >= 0)
break;
}
mapLen = id + 1;
// Add an empty "Mapping..." slot
if (mapLen < MAX_MIDI_CONTROL)
++mapLen;
}
// ----------------------------------------------------------------------------------------------------------------
// save and load json stuff
json_t* dataToJson() override
{
json_t* const rootJ = json_object();
@ -369,7 +436,7 @@ struct HostMIDIMap : Module {
json_t* paramIdJ = json_object_get(mapJ, "paramId");
if (!(ccJ && moduleIdJ && paramIdJ))
continue;
if (mapIndex >= MAX_CHANNELS)
if (mapIndex >= MAX_MIDI_CONTROL)
continue;
ccs[mapIndex] = json_integer_value(ccJ);
pcontext->engine->updateParamHandle_NoLock(&paramHandles[mapIndex],
@ -393,25 +460,229 @@ struct HostMIDIMap : Module {
// --------------------------------------------------------------------------------------------------------------------
struct HostMIDIMapWidget : 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.35f;
struct MIDIMapChoice : CardinalLedDisplayChoice {
HostMIDIMap* const module;
const int id;
int disableLearnFrames = -1;
ParamWidget* lastTouchedParam = nullptr;
MIDIMapChoice(HostMIDIMap* const m, const int i)
: CardinalLedDisplayChoice(),
module(m),
id(i)
{
alignTextCenter = false;
}
void draw(const DrawArgs& args) override
{
if (bgColor.a > 0.0)
{
nvgBeginPath(args.vg);
nvgRoundedRect(args.vg, 0, 0, box.size.x, box.size.y, 4);
nvgFillColor(args.vg, bgColor);
nvgFill(args.vg);
}
Widget::draw(args);
}
void step() override
{
if (!module)
return;
// Set bgColor and selected state
if (module->learningId == id)
{
bgColor = color;
bgColor.a = 0.125f;
if (ParamWidget* const touchedParam = APP->scene->rack->touchedParam)
{
if (module->nextLearningId == id)
{
module->nextLearningId = -1;
lastTouchedParam = touchedParam;
}
else if (lastTouchedParam != touchedParam)
{
const int64_t moduleId = touchedParam->module->id;
const int paramId = touchedParam->paramId;
module->learnParam(id, moduleId, paramId);
lastTouchedParam = touchedParam;
}
}
else
{
lastTouchedParam = nullptr;
}
}
else
{
bgColor = nvgRGB(0, 0, 0);
}
// Set text
text.clear();
// mapped
if (module->ccs[id] >= 0)
text += string::f("CC%02d: ", module->ccs[id]);
if (module->paramHandles[id].moduleId >= 0)
text += getParamName();
// Set text color
if (text.empty() && module->learningId != id)
color.a = 0.75f;
else
color.a = 1.0f;
// unmapped
if (text.empty())
{
if (module->learningId == id)
text = "Mapping...";
else
text = module->mapLen == 1 ? "Click here to map" : "Unmapped";
}
}
void onButton(const ButtonEvent& e) override
{
DISTRHO_SAFE_ASSERT_RETURN(module != nullptr,);
e.stopPropagating();
if (e.action != GLFW_PRESS)
return;
switch (e.button)
{
case GLFW_MOUSE_BUTTON_RIGHT:
module->clearMap(id);
e.consume(this);
break;
// fall-through
case GLFW_MOUSE_BUTTON_LEFT:
APP->scene->rack->touchedParam = lastTouchedParam = nullptr;
module->enableLearn(id);
e.consume(this);
break;
}
}
/*
void onSelect(const SelectEvent& e) override
{
DISTRHO_SAFE_ASSERT_RETURN(module != nullptr,);
ScrollWidget* scroll = getAncestorOfType<ScrollWidget>();
scroll->scrollTo(box);
}
*/
std::string getParamName() const
{
DISTRHO_SAFE_ASSERT_RETURN(module != nullptr, "error");
DISTRHO_SAFE_ASSERT_RETURN(id < module->mapLen, "error");
ParamHandle* const paramHandle = &module->paramHandles[id];
Module* const paramModule = paramHandle->module;
DISTRHO_SAFE_ASSERT_RETURN(paramModule != nullptr, "error");
const int paramId = paramHandle->paramId;
DISTRHO_SAFE_ASSERT_RETURN(paramId < (int) paramModule->params.size(), "error");
ParamQuantity* const paramQuantity = paramModule->paramQuantities[paramId];
std::string s = paramQuantity->name;
if (s.empty())
s = "Unnamed";
s += " (";
s += paramModule->model->name;
s += ")";
return s;
}
};
struct HostMIDIMapDisplay : Widget {
HostMIDIMap* module;
ScrollWidget* scroll;
MIDIMapChoice* choices[MAX_MIDI_CONTROL];
LedDisplaySeparator* separators[MAX_MIDI_CONTROL];
void drawLayer(const DrawArgs& args, int layer) override
{
nvgScissor(args.vg, RECT_ARGS(args.clipBox));
Widget::drawLayer(args, layer);
nvgResetScissor(args.vg);
}
void setModule(HostMIDIMap* const module)
{
this->module = module;
scroll = new ScrollWidget;
scroll->box.size = box.size;
addChild(scroll);
float posY = 0.0f;
for (int id = 0; id < MAX_MIDI_CONTROL; ++id)
{
if (id != 0)
{
LedDisplaySeparator* separator = createWidget<LedDisplaySeparator>(Vec(0.0f, posY));
separator->box.size = Vec(box.size.x, 1.0f);
scroll->container->addChild(separator);
separators[id] = separator;
}
MIDIMapChoice* const choice = new MIDIMapChoice(module, id);
choice->box.pos = Vec(0.0f, posY);
choice->box.size = Vec(box.size.x, 20.0f);
scroll->container->addChild(choice);
choices[id] = choice;
posY += choice->box.size.y;
}
}
void step() override
{
if (module != nullptr)
{
const int mapLen = module->mapLen;
for (int id = 1; id < MAX_MIDI_CONTROL; ++id)
{
separators[id]->visible = (id < mapLen);
choices[id]->visible = (id < mapLen);
}
}
Widget::step();
}
};
struct HostMIDIMapWidget : ModuleWidget {
HostMIDIMap* const module;
HostMIDIMapWidget(HostMIDIMap* const m)
: module(m)
{
setModule(m);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/HostMIDI.svg")));
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/HostMIDIMap.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)));
HostMIDIMapDisplay* const display = createWidget<HostMIDIMapDisplay>(Vec(1.0f, 71.0f));
display->box.size = Vec(box.size.x - 2.0f, box.size.y - 89.0f);
display->setModule(m);
addChild(display);
}
void draw(const DrawArgs& args) override

View File

@ -26,6 +26,8 @@
using namespace rack;
struct CardinalLedDisplayChoice : LedDisplayChoice {
bool alignTextCenter = true;
CardinalLedDisplayChoice(const char* const label = nullptr)
{
color = nvgRGBf(0.76f, 0.11f, 0.22f);
@ -35,14 +37,23 @@ struct CardinalLedDisplayChoice : LedDisplayChoice {
text = label;
}
void drawLayer(const DrawArgs& args, int layer) override
void drawLayer(const DrawArgs& args, const int layer) override
{
if (layer == 1)
{
nvgFillColor(args.vg, color);
nvgTextAlign(args.vg, NVG_ALIGN_CENTER);
nvgTextLetterSpacing(args.vg, 0.0f);
nvgText(args.vg, box.size.x * 0.5f, textOffset.y, text.c_str(), NULL);
if (alignTextCenter)
{
nvgTextAlign(args.vg, NVG_ALIGN_CENTER);
nvgText(args.vg, box.size.x * 0.5f, textOffset.y, text.c_str(), nullptr);
}
else
{
nvgTextAlign(args.vg, NVG_ALIGN_LEFT);
nvgText(args.vg, textOffset.x, textOffset.y, text.c_str(), nullptr);
}
}
Widget::drawLayer(args, layer);

View File

@ -1,56 +0,0 @@
{
"slug": "Core",
"name": "Cardinal Core",
"version": "2.0.1",
"license": "GPL-3.0-or-later",
"author": "Vortico",
"brand": "Vortico",
"authorEmail": "support@vcvrack.com",
"authorUrl": "https://vcvrack.com/",
"manualUrl": "https://vcvrack.com/manual/Core",
"sourceUrl": "https://github.com/VCVRack/Rack",
"changelogUrl": "https://github.com/VCVRack/Rack/blob/v2/CHANGELOG.md",
"description": "Necessary modules built into Cardinal",
"modules": [
{
"slug": "MIDITriggerToCVInterface",
"name": "MIDI to Gate",
"description": "Converts MIDI notes from an external device to gates",
"manualUrl": "https://vcvrack.com/manual/Core#MIDI-Gate",
"tags": [
"External",
"MIDI"
]
},
{
"slug": "MIDI-Map",
"name": "MIDI Map",
"description": "Controls parameters (knobs, sliders, switches) directly with MIDI CC",
"manualUrl": "https://vcvrack.com/manual/Core#MIDI-Map",
"tags": [
"External",
"MIDI"
]
},
{
"slug": "CV-Gate",
"name": "Gate to MIDI",
"description": "Converts gates to MIDI notes and sends to an external device",
"manualUrl": "https://vcvrack.com/manual/Core#CV-Gate",
"tags": [
"External",
"MIDI"
]
},
{
"slug": "Blank",
"name": "Blank",
"description": "A resizable blank panel",
"manualUrl": "https://vcvrack.com/manual/Core#Blank",
"tags": [
"Blank"
],
"hidden": true
}
]
}

View File

@ -826,28 +826,21 @@ else
PLUGIN_LIST = $(subst /plugin.json,,$(wildcard */plugin.json))
endif
PLUGIN_RESOURCES = ../bin/CardinalFX.lv2/resources/PluginManifests/Core.json
PLUGIN_RESOURCES =
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.lv2/resources/%)
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.lv2/resources/PluginManifests/%.json)
ifeq ($(MACOS),true)
PLUGIN_RESOURCES += ../bin/CardinalFX.vst/Contents/Resources/PluginManifests/Core.json
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/Contents/Resources/%)
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/Contents/Resources/PluginManifests/%.json)
else
PLUGIN_RESOURCES += ../bin/CardinalFX.vst/resources/PluginManifests/Core.json
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/resources/%)
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/resources/PluginManifests/%.json)
endif
PLUGIN_RESOURCES += ../bin/CardinalFX.vst3/Contents/Resources/PluginManifests/Core.json
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst3/Contents/Resources/%)
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst3/Contents/Resources/PluginManifests/%.json)
resources: $(PLUGIN_RESOURCES)
../bin/CardinalFX.%/Core.json: Core.json
-@mkdir -p "$(shell dirname $@)"
ln -sf $(abspath $<) $@
../bin/CardinalFX.lv2/resources/%: %/res
-@mkdir -p "$(shell dirname $@)"
ln -sf $(abspath $<) $@

View File

@ -595,14 +595,6 @@ std::string pluginManifest(const std::string& dirname);
std::string pluginPath(const std::string& dirname);
}
// core plugins
namespace core {
extern Model* modelMIDI_Gate;
extern Model* modelMIDIMap;
extern Model* modelGate_MIDI;
extern Model* modelBlank;
}
// regular plugins
namespace plugin {
@ -685,20 +677,6 @@ struct StaticPluginLoader {
}
};
static void initStatic__Core()
{
Plugin* const p = new Plugin;
const StaticPluginLoader spl(p, "Core");
if (spl.ok())
{
p->addModel(rack::core::modelMIDI_Gate);
p->addModel(rack::core::modelMIDIMap);
p->addModel(rack::core::modelGate_MIDI);
p->addModel(rack::core::modelBlank);
}
}
static void initStatic__Cardinal()
{
Plugin* const p = new Plugin;
@ -1996,7 +1974,6 @@ static void initStatic__ZZC()
void initStaticPlugins()
{
initStatic__Core();
initStatic__Cardinal();
#ifndef NOPLUGINS
initStatic__21kHz();

View File

@ -127,15 +127,10 @@ IGNORED_FILES += Rack/src/rtmidi.cpp
IGNORED_FILES += Rack/src/app/MenuBar.cpp
IGNORED_FILES += Rack/src/app/Scene.cpp
IGNORED_FILES += Rack/src/app/TipWindow.cpp
IGNORED_FILES += Rack/src/core/Audio.cpp
IGNORED_FILES += Rack/src/core/CV_MIDI.cpp
IGNORED_FILES += Rack/src/core/CV_MIDICC.cpp
IGNORED_FILES += Rack/src/core/MIDI_CV.cpp
IGNORED_FILES += Rack/src/core/MIDICC_CV.cpp
IGNORED_FILES += Rack/src/core/Notes.cpp
IGNORED_FILES += Rack/src/engine/Engine.cpp
IGNORED_FILES += Rack/src/plugin/Model.cpp
IGNORED_FILES += Rack/src/window/Window.cpp
IGNORED_FILES += $(wildcard Rack/src/core/*.cpp)
RACK_FILES += $(wildcard Rack/src/*.c)
RACK_FILES += $(wildcard Rack/src/*/*.c)
@ -200,16 +195,6 @@ $(BUILD_DIR)/override/MIDI_CV.cpp.o: override/MIDI_CV.cpp
@echo "Compiling $<"
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -UPRIVATE -c -o $@
$(BUILD_DIR)/Rack/src/core/Blank.cpp.o: Rack/src/core/Blank.cpp
-@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
@echo "Compiling $<"
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -UPRIVATE -D'nvgRGB(r,g,b)=nvgRGBblank(r,g,b)' -c -o $@
$(BUILD_DIR)/Rack/src/core/%.cpp.o: Rack/src/core/%.cpp
-@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
@echo "Compiling $<"
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -UPRIVATE -c -o $@
$(BUILD_DIR)/%.cpp.o: %.cpp
-@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
@echo "Compiling $<"

View File

@ -89,9 +89,13 @@ static const std::map<PluginModuleSlug, PluginModuleSlug> moduleSlugFallbacks =
{{"Core", "AudioInterface16"}, {"Cardinal", "HostAudio8"}},
{{"Core", "MIDIToCVInterface"}, {"Cardinal", "HostMIDI"}},
{{"Core", "MIDICCToCVInterface"}, {"Cardinal", "HostMIDICC"}},
{{"Core", "MIDITriggerToCVInterface"}, {"Cardinal", "HostMIDIGate"}},
{{"Core", "CV-MIDI"}, {"Cardinal", "HostMIDI"}},
{{"Core", "CV-CC"}, {"Cardinal", "HostMIDICC"}},
{{"Core", "CV-Gate"}, {"Cardinal", "HostMIDIGate"}},
{{"Core", "MIDI-Map"}, {"Cardinal", "HostMIDIMap"}},
{{"Core", "Notes"}, {"Cardinal", "TextEditor"}},
{{"Core", "Blank"}, {"Cardinal", "Blank"}},
{{"MindMeld-ShapeMasterPro", "ShapeMasterPro"}, {"MindMeldModular", "ShapeMaster"}},
// {{"", ""}, {"", ""}},
};