Fix chorus dry-gain calculation, more compact layout for analyser
This commit is contained in:
parent
995339d2a2
commit
16b2ba955c
5
chorus.h
5
chorus.h
@ -99,9 +99,10 @@ struct ChorusSTFX : public BaseEffect {
|
|||||||
|
|
||||||
auto wetDryFn = [](double mix, double width, bool isWet){
|
auto wetDryFn = [](double mix, double width, bool isWet){
|
||||||
// Equal-power wet/dry fade
|
// Equal-power wet/dry fade
|
||||||
double m = isWet ? std::sin(M_PI*mix/2) : std::cos(M_PI*mix/2);
|
double m = isWet ? std::sin(M_PI*mix/2)/std::sqrt(6) : std::cos(M_PI*mix/2);
|
||||||
// Compensate for extra energy from stereo
|
// Compensate for extra energy from stereo
|
||||||
return m/std::sqrt(6*(1 + width*width/2));
|
double mw = mix*width;
|
||||||
|
return m/std::sqrt((1 + mw*mw/2));
|
||||||
};
|
};
|
||||||
auto dry = block.smooth(wetDryFn(mix.from(), stereo.from(), false), wetDryFn(mix.to(), stereo.to(), false));
|
auto dry = block.smooth(wetDryFn(mix.from(), stereo.from(), false), wetDryFn(mix.to(), stereo.to(), false));
|
||||||
auto wet = block.smooth(wetDryFn(mix.from(), stereo.from(), true), wetDryFn(mix.to(), stereo.to(), true));
|
auto wet = block.smooth(wetDryFn(mix.from(), stereo.from(), true), wetDryFn(mix.to(), stereo.to(), true));
|
||||||
|
|||||||
@ -12,9 +12,16 @@
|
|||||||
|
|
||||||
#include "../../stfx/clap/stfx-clap.h"
|
#include "../../stfx/clap/stfx-clap.h"
|
||||||
|
|
||||||
|
template<class Effect>
|
||||||
|
struct AnalyserSTFX : public signalsmith::basics::AnalyserSTFX<Effect> {
|
||||||
|
AnalyserSTFX() {
|
||||||
|
this->webPage += "?compact&columns";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
static stfx::clap::Plugins plugins;
|
static stfx::clap::Plugins plugins;
|
||||||
bool clap_init(const char *path) {
|
bool clap_init(const char *path) {
|
||||||
plugins.add<signalsmith::basics::AnalyserSTFX>({
|
plugins.add<AnalyserSTFX>({
|
||||||
.clap_version = CLAP_VERSION,
|
.clap_version = CLAP_VERSION,
|
||||||
.id = "uk.co.signalsmith.basics.analyser",
|
.id = "uk.co.signalsmith.basics.analyser",
|
||||||
.name = "[Basics] Analyser",
|
.name = "[Basics] Analyser",
|
||||||
|
|||||||
@ -3,6 +3,9 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>Generic STFX UI</title>
|
<title>Generic STFX UI</title>
|
||||||
<style>
|
<style>
|
||||||
|
:root {
|
||||||
|
font-size:12pt;
|
||||||
|
}
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
@ -117,6 +120,25 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Alternative layouts */
|
||||||
|
/* compact: more compact, */
|
||||||
|
:root.compact {
|
||||||
|
font-size: 9pt;
|
||||||
|
}
|
||||||
|
:root.compact #params {
|
||||||
|
padding: 0.5rem;
|
||||||
|
}
|
||||||
|
/* columns: horizontal layout, not vertical */
|
||||||
|
:root.columns body {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
:root.columns #params {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
:root.columns #header {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -203,6 +225,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
// Query keys set CSS class on the root
|
||||||
|
new URL(location).searchParams.forEach((value, key) => {
|
||||||
|
document.body.parentNode.classList.add(key);
|
||||||
|
});
|
||||||
|
|
||||||
let plotColours = ['#8CF', '#FC8', '#8D8', '#F9B'];
|
let plotColours = ['#8CF', '#FC8', '#8D8', '#F9B'];
|
||||||
function freqScale(width, lowHz, highHz) {
|
function freqScale(width, lowHz, highHz) {
|
||||||
// let a = -289.614, b = 1176.76, c = 15.3385, d = -0.552833; // Bark
|
// let a = -289.614, b = 1176.76, c = 15.3385, d = -0.552833; // Bark
|
||||||
@ -335,7 +362,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.parent.postMessage(CBOR.encode("ready"), '*');
|
if (window.parent !== window) window.parent.postMessage(CBOR.encode("ready"), '*');
|
||||||
|
|
||||||
// Monitor framerate and send every 200ms
|
// Monitor framerate and send every 200ms
|
||||||
let frameMs = 100, prevFrame = Date.now(), prevSent = 100;
|
let frameMs = 100, prevFrame = Date.now(), prevSent = 100;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user