feat: add parameter range support
Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
This commit is contained in:
parent
b37954a27b
commit
9474b4481e
|
@ -3,14 +3,14 @@
|
|||
// This file was generated using the Faust compiler (https://faust.grame.fr),
|
||||
// and the Faust post-processor (https://github.com/SpotlightKid/faustpp).
|
||||
//
|
||||
// Source: lpf.dsp
|
||||
// Source: faustlpf.dsp
|
||||
// Name: FaustLPF
|
||||
// Author: Christopher Arndt
|
||||
// Copyright: Christopher Arndt, 2024
|
||||
// License: MIT
|
||||
// Version: 0.1.0
|
||||
// FAUST version: 2.75.10
|
||||
// FAUST compilation options: -a /home/chris/tmp/tmp9v2ck7tz.c -lang c -rui -ct 1 -fm def -cn faustlpf -es 1 -mcd 16 -mdd 1024 -mdy 33 -single -ftz 0 -vec -lv 0 -vs 32
|
||||
// FAUST compilation options: -a /home/chris/tmp/tmpebxwoqng.c -lang c -rui -ct 1 -fm def -cn faustlpf -es 1 -mcd 16 -mdd 1024 -mdy 33 -single -ftz 0 -vec -lv 0 -vs 32
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
@ -79,9 +79,9 @@ void deletefaustlpf(faustlpf* dsp) {
|
|||
|
||||
void metadatafaustlpf(MetaGlue* m) {
|
||||
m->declare(m->metaInterface, "author", "Christopher Arndt");
|
||||
m->declare(m->metaInterface, "compile_options", "-a /home/chris/tmp/tmp9v2ck7tz.c -lang c -rui -ct 1 -fm def -cn faustlpf -es 1 -mcd 16 -mdd 1024 -mdy 33 -single -ftz 0 -vec -lv 0 -vs 32");
|
||||
m->declare(m->metaInterface, "compile_options", "-a /home/chris/tmp/tmpebxwoqng.c -lang c -rui -ct 1 -fm def -cn faustlpf -es 1 -mcd 16 -mdd 1024 -mdy 33 -single -ftz 0 -vec -lv 0 -vs 32");
|
||||
m->declare(m->metaInterface, "copyright", "Christopher Arndt, 2024");
|
||||
m->declare(m->metaInterface, "filename", "lpf.dsp");
|
||||
m->declare(m->metaInterface, "filename", "faustlpf.dsp");
|
||||
m->declare(m->metaInterface, "filters.lib/fir:author", "Julius O. Smith III");
|
||||
m->declare(m->metaInterface, "filters.lib/fir:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
|
||||
m->declare(m->metaInterface, "filters.lib/fir:license", "MIT-style STK-4.3 license");
|
||||
|
|
|
@ -47,6 +47,11 @@ void initfaustlpf(faustlpf* dsp, int sample_rate);
|
|||
void buildUserInterfacefaustlpf(faustlpf* dsp, UIGlue* ui_interface);
|
||||
void computefaustlpf(faustlpf* dsp, int count, FAUSTFLOAT** RESTRICT inputs, FAUSTFLOAT** RESTRICT outputs);
|
||||
|
||||
typedef struct {
|
||||
FAUSTFLOAT init;
|
||||
FAUSTFLOAT min;
|
||||
FAUSTFLOAT max;
|
||||
} ParameterRange;
|
||||
|
||||
int parameter_group(unsigned index) {
|
||||
switch (index) {
|
||||
|
@ -115,7 +120,18 @@ const char *parameter_unit(unsigned index) {
|
|||
}
|
||||
}
|
||||
|
||||
const ParameterRange *parameter_range(unsigned index) {
|
||||
switch (index) {
|
||||
|
||||
case 0: {
|
||||
static const ParameterRange range = { 15000.0, 16.0, 15000.0 };
|
||||
return ⦥
|
||||
}
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool parameter_is_trigger(unsigned index) {
|
||||
switch (index) {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
type
|
||||
faustlpf* = object
|
||||
ParameterRange* = object
|
||||
init*, min*, max*: cfloat
|
||||
SampleBuffer* = UncheckedArray[cfloat]
|
||||
|
||||
|
||||
|
@ -11,6 +13,7 @@ proc initfaustlpf*(dsp: ptr faustlpf, sample_rate: cint) {.importc.}
|
|||
proc instanceClearfaustlpf*(dsp: ptr faustlpf) {.importc.}
|
||||
proc computefaustlpf*(dsp: ptr faustlpf, count: cint, inputs, outputs: ptr ptr SampleBuffer) {.importc.}
|
||||
|
||||
proc parameter_range*(index: cuint): ptr ParameterRange {.importc.}
|
||||
proc parameter_group*(index: cuint): cint {.importc}
|
||||
proc parameter_is_boolean*(index: cuint): bool {.importc}
|
||||
proc parameter_is_enum*(index: cuint): bool {.importc}
|
||||
|
|
|
@ -50,7 +50,7 @@ proc activate(instance: Lv2Handle) {.cdecl.} =
|
|||
|
||||
proc run(instance: Lv2Handle; nSamples: cuint) {.cdecl.} =
|
||||
let plug = cast[ptr FaustLPFPlugin](instance)
|
||||
set_cutoff(plug.flt, plug.freq[])
|
||||
plug.flt.set_cutoff(plug.freq[])
|
||||
computefaustlpf(plug.flt, nSamples.cint, addr plug.input, addr plug.output)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue