@@ -74,6 +74,7 @@ include compile.mk | |||
dist: all | |||
rm -rf dist | |||
$(MAKE) -C plugins/Fundamental dist | |||
ifeq ($(ARCH), mac) | |||
@@ -25,6 +25,93 @@ namespace rack { | |||
// Knobs | |||
//////////////////// | |||
struct RoundKnob : SVGKnob { | |||
RoundKnob() { | |||
minAngle = -0.83*M_PI; | |||
maxAngle = 0.83*M_PI; | |||
} | |||
}; | |||
struct RoundBlackKnob : RoundKnob { | |||
RoundBlackKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/RoundBlack.svg"))); | |||
box.size = Vec(38, 38); | |||
} | |||
}; | |||
struct RoundSmallBlackKnob : RoundBlackKnob { | |||
RoundSmallBlackKnob() { | |||
box.size = Vec(28, 28); | |||
} | |||
}; | |||
struct RoundLargeBlackKnob : RoundBlackKnob { | |||
RoundLargeBlackKnob() { | |||
box.size = Vec(46, 46); | |||
} | |||
}; | |||
struct RoundHugeBlackKnob : RoundBlackKnob { | |||
RoundHugeBlackKnob() { | |||
box.size = Vec(56, 56); | |||
} | |||
}; | |||
struct RoundSmallBlackSnapKnob : RoundSmallBlackKnob, SnapKnob {}; | |||
struct Davies1900hKnob : SVGKnob { | |||
Davies1900hKnob() { | |||
minAngle = -0.83*M_PI; | |||
maxAngle = 0.83*M_PI; | |||
} | |||
}; | |||
struct Davies1900hWhiteKnob : Davies1900hKnob { | |||
Davies1900hWhiteKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hWhite.svg"))); | |||
} | |||
}; | |||
struct Davies1900hBlackKnob : Davies1900hKnob { | |||
Davies1900hBlackKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hBlack.svg"))); | |||
} | |||
}; | |||
struct Davies1900hRedKnob : Davies1900hKnob { | |||
Davies1900hRedKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hRed.svg"))); | |||
} | |||
}; | |||
struct Davies1900hLargeWhiteKnob : Davies1900hKnob { | |||
Davies1900hLargeWhiteKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeWhite.svg"))); | |||
} | |||
}; | |||
struct Davies1900hLargeBlackKnob : Davies1900hKnob { | |||
Davies1900hLargeBlackKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeBlack.svg"))); | |||
} | |||
}; | |||
struct Davies1900hLargeRedKnob : Davies1900hKnob { | |||
Davies1900hLargeRedKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeRed.svg"))); | |||
} | |||
}; | |||
struct Davies1900hSmallBlackKnob : Davies1900hKnob { | |||
Davies1900hSmallBlackKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hSmallBlack.svg"))); | |||
} | |||
}; | |||
struct Davies1900hSmallBlackSnapKnob : Davies1900hSmallBlackKnob, SnapKnob {}; | |||
struct Rogan : SVGKnob { | |||
Rogan() { | |||
minAngle = -0.83*M_PI; | |||
@@ -261,58 +348,6 @@ struct SynthTechAlco : SVGKnob { | |||
} | |||
}; | |||
struct Davies1900hKnob : SVGKnob { | |||
Davies1900hKnob() { | |||
box.size = Vec(36, 36); | |||
minAngle = -0.83*M_PI; | |||
maxAngle = 0.83*M_PI; | |||
} | |||
}; | |||
struct Davies1900hWhiteKnob : Davies1900hKnob { | |||
Davies1900hWhiteKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hWhite.svg"))); | |||
} | |||
}; | |||
struct Davies1900hBlackKnob : Davies1900hKnob { | |||
Davies1900hBlackKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hBlack.svg"))); | |||
} | |||
}; | |||
struct Davies1900hRedKnob : Davies1900hKnob { | |||
Davies1900hRedKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hRed.svg"))); | |||
} | |||
}; | |||
struct Davies1900hLargeWhiteKnob : Davies1900hKnob { | |||
Davies1900hLargeWhiteKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeWhite.svg"))); | |||
} | |||
}; | |||
struct Davies1900hLargeBlackKnob : Davies1900hKnob { | |||
Davies1900hLargeBlackKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeBlack.svg"))); | |||
} | |||
}; | |||
struct Davies1900hLargeRedKnob : Davies1900hKnob { | |||
Davies1900hLargeRedKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeRed.svg"))); | |||
} | |||
}; | |||
struct Davies1900hSmallBlackKnob : Davies1900hKnob { | |||
Davies1900hSmallBlackKnob() { | |||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hSmallBlack.svg"))); | |||
} | |||
}; | |||
struct Davies1900hSmallBlackSnapKnob : Davies1900hSmallBlackKnob, SnapKnob {}; | |||
struct Trimpot : SVGKnob { | |||
Trimpot() { | |||
box.size = Vec(17, 17); | |||
@@ -41,6 +41,9 @@ struct SchmittTrigger { | |||
} | |||
return false; | |||
} | |||
bool isHigh() { | |||
return state == HIGH; | |||
} | |||
void reset() { | |||
state = UNKNOWN; | |||
} | |||
@@ -49,6 +49,7 @@ struct Module { | |||
/** Advances the module by 1 audio frame with duration 1.0 / gSampleRate */ | |||
virtual void step() {} | |||
virtual void onSampleRateChange() {} | |||
/** Override these to store extra internal data in the "data" property */ | |||
virtual json_t *toJson() { return NULL; } | |||
@@ -80,6 +81,7 @@ void engineAddWire(Wire *wire); | |||
void engineRemoveWire(Wire *wire); | |||
void engineSetParam(Module *module, int paramId, float value); | |||
void engineSetParamSmooth(Module *module, int paramId, float value); | |||
void engineSetSampleRate(float sampleRate); | |||
extern float gSampleRate; | |||
extern bool gPaused; | |||
@@ -167,9 +167,15 @@ struct Vec { | |||
Vec mult(float s) { | |||
return Vec(x * s, y * s); | |||
} | |||
Vec mult(Vec b) { | |||
return Vec(x * b.x, y * b.y); | |||
} | |||
Vec div(float s) { | |||
return Vec(x / s, y / s); | |||
} | |||
Vec div(Vec b) { | |||
return Vec(x / b.x, y / b.y); | |||
} | |||
float dot(Vec b) { | |||
return x * b.x + y * b.y; | |||
} | |||
@@ -0,0 +1,123 @@ | |||
<?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="37.556625" | |||
height="37.556622" | |||
viewBox="0 0 9.9368575 9.9368564" | |||
version="1.1" | |||
id="svg49872" | |||
inkscape:version="0.92.2 5c3e80d, 2017-08-06" | |||
sodipodi:docname="RoundBlack.svg"> | |||
<defs | |||
id="defs49866"> | |||
<clipPath | |||
id="clip12"> | |||
<path | |||
d="m 143,129.75 h 3 V 158 h -3 z m 0,0" | |||
id="path28860" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<clipPath | |||
id="clip11"> | |||
<path | |||
d="m 117.39453,129.75 h 54 v 54.00391 h -54 z m 0,0" | |||
id="path28857" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<clipPath | |||
id="clip150"> | |||
<path | |||
d="m 176,208.92578 h 2 V 228 h -2 z m 0,0" | |||
id="path29465" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<clipPath | |||
id="clip149"> | |||
<path | |||
d="m 159.27734,208.92578 h 36 v 36 h -36 z m 0,0" | |||
id="path29462" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<clipPath | |||
id="clip142"> | |||
<path | |||
d="m 110,208.92578 h 3 V 228 h -3 z m 0,0" | |||
id="path29320" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<clipPath | |||
id="clip141"> | |||
<path | |||
d="m 93.511719,208.92578 h 36.000001 v 36 H 93.511719 Z m 0,0" | |||
id="path29317" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
</defs> | |||
<sodipodi:namedview | |||
id="base" | |||
pagecolor="#ffffff" | |||
bordercolor="#666666" | |||
borderopacity="1.0" | |||
inkscape:pageopacity="0.0" | |||
inkscape:pageshadow="2" | |||
inkscape:zoom="22.4" | |||
inkscape:cx="15.038057" | |||
inkscape:cy="23.041" | |||
inkscape:document-units="mm" | |||
inkscape:current-layer="layer1" | |||
showgrid="false" | |||
fit-margin-top="0" | |||
fit-margin-left="0" | |||
fit-margin-right="0" | |||
fit-margin-bottom="0" | |||
units="px" | |||
inkscape:window-width="2560" | |||
inkscape:window-height="1422" | |||
inkscape:window-x="0" | |||
inkscape:window-y="18" | |||
inkscape:window-maximized="0" | |||
inkscape:snap-global="true" | |||
inkscape:snap-bbox="true" | |||
inkscape:snap-bbox-midpoints="true" | |||
inkscape:snap-object-midpoints="true" | |||
inkscape:snap-bbox-edge-midpoints="true" | |||
inkscape:object-paths="true" | |||
inkscape:pagecheckerboard="true" /> | |||
<metadata | |||
id="metadata49869"> | |||
<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(-73.816227,-78.610433)"> | |||
<path | |||
style="clip-rule:nonzero;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.27602378" | |||
d="m 83.753084,83.578861 c 0,2.744065 -2.224363,4.968428 -4.968429,4.968428 -2.744065,0 -4.968428,-2.224363 -4.968428,-4.968428 0,-2.744066 2.224363,-4.968428 4.968428,-4.968428 2.744066,0 4.968429,2.224362 4.968429,4.968428" | |||
id="path38955" | |||
inkscape:connector-curvature="0" /> | |||
<path | |||
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.396875;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" | |||
d="m 78.784655,83.578861 0,-4.968428" | |||
id="path53181" | |||
inkscape:connector-curvature="0" | |||
sodipodi:nodetypes="cc" /> | |||
</g> | |||
</svg> |
@@ -24,6 +24,8 @@ void SVGKnob::step() { | |||
if (dirty) { | |||
float angle = rescalef(value, minValue, maxValue, minAngle, maxAngle); | |||
tw->identity(); | |||
// Scale SVG to box | |||
tw->scale(box.size.div(sw->box.size)); | |||
// Rotate SVG | |||
Vec center = sw->box.getCenter(); | |||
tw->translate(center); | |||
@@ -70,7 +70,7 @@ struct PauseItem : MenuItem { | |||
struct SampleRateItem : MenuItem { | |||
float sampleRate; | |||
void onAction() { | |||
gSampleRate = sampleRate; | |||
engineSetSampleRate(sampleRate); | |||
gPaused = false; | |||
} | |||
}; | |||
@@ -39,7 +39,7 @@ void Wire::step() { | |||
} | |||
void engineInit() { | |||
gSampleRate = 44100.0; | |||
engineSetSampleRate(44100.0); | |||
} | |||
void engineDestroy() { | |||
@@ -218,5 +218,15 @@ void engineSetParamSmooth(Module *module, int paramId, float value) { | |||
smoothValue = value; | |||
} | |||
void engineSetSampleRate(float newSampleRate) { | |||
VIPLock vipLock(vipMutex); | |||
std::lock_guard<std::mutex> lock(mutex); | |||
gSampleRate = newSampleRate; | |||
// onSampleRateChange | |||
for (Module *module : modules) { | |||
module->onSampleRateChange(); | |||
} | |||
} | |||
} // namespace rack |
@@ -62,8 +62,10 @@ static void settingsFromJson(json_t *rootJ) { | |||
// sampleRate | |||
json_t *sampleRateJ = json_object_get(rootJ, "sampleRate"); | |||
if (sampleRateJ) | |||
gSampleRate = json_number_value(sampleRateJ); | |||
if (sampleRateJ) { | |||
float sampleRate = json_number_value(sampleRateJ); | |||
engineSetSampleRate(sampleRate); | |||
} | |||
} | |||