Create envelope factory functions

This commit is contained in:
2020-03-20 19:50:16 +01:00
parent ff45e7e479
commit 730d3803f0
2 changed files with 16 additions and 1 deletions

View File

@@ -7,9 +7,11 @@ import io.smnp.ext.synth.Synthesizer
import org.pf4j.Extension
@Extension
class SynthModule : NativeModuleProvider("smnp.audio.synth") {
class SynthModule : HybridModuleProvider("smnp.audio.synth") {
override fun functions() = listOf(WaveFunction(), SynthFunction())
override fun files() = listOf("envelope.mus")
override fun onModuleLoad(environment: Environment) {
Synthesizer.init()
}

View File

@@ -0,0 +1,13 @@
function adsr(p1: float = 0.1, p2: float = 0.3, p3: float = 0.8, s: float = 0.8) {
return {
name -> "adsr",
p1 -> p1,
p2 -> p2,
p3 -> p3,
s -> s
};
}
function constant() {
return { name -> "const" };
}