beginning of new c++ examples (fxpp_ap1)

This commit is contained in:
Stefano D'Angelo 2024-02-02 11:26:00 +01:00
parent 1b4035b5ac
commit 2a62abe93b
12 changed files with 208 additions and 9 deletions

View File

@ -0,0 +1,19 @@
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void * impl;
impl impl_new();
void impl_free(impl instance);
void impl_set_sample_rate(impl instance, float sample_rate);
void impl_reset(impl instance);
void impl_set_parameter(impl instance, size_t index, float value);
float impl_get_parameter(impl instance, size_t index);
void impl_process(impl instance, const float **inputs, float **outputs, size_t n_samples);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,44 @@
#include "common.h"
#include "impl.h"
typedef struct plugin {
impl impl;
} plugin;
static void plugin_init(plugin *instance) {
instance->impl = impl_new();
}
static void plugin_fini(plugin *instance) {
impl_free(instance->impl);
}
static void plugin_set_sample_rate(plugin *instance, float sample_rate) {
impl_set_sample_rate(instance->impl, sample_rate);
}
static size_t plugin_mem_req(plugin *instance) {
(void)instance;
return 0;
}
static void plugin_mem_set(plugin *instance, void *mem) {
(void)instance;
(void)mem;
}
static void plugin_reset(plugin *instance) {
impl_reset(instance->impl);
}
static void plugin_set_parameter(plugin *instance, size_t index, float value) {
impl_set_parameter(instance->impl, index, value);
}
static float plugin_get_parameter(plugin *instance, size_t index) {
return impl_get_parameter(instance->impl, index);
}
static void plugin_process(plugin *instance, const float **inputs, float **outputs, size_t n_samples) {
impl_process(instance->impl, inputs, outputs, n_samples);
}

View File

@ -0,0 +1,8 @@
{
"make": {
"cxxSrcs": "../src/impl.cpp",
"cflags": "-I../../../include -I../../common/src -I../../common/src/cxx",
"cxxflags": "-I../../../include -I../../common/src -I../../common/src/cxx",
"pluginDir": "../src"
}
}

View File

@ -0,0 +1,5 @@
{
"android": {
"javaPackageName": "com.orastron.bw_example_fxpp_ap1"
}
}

View File

@ -0,0 +1,6 @@
{
"cmd": {
"busIds": [ "input", "output" ],
"parameterIds": [ "cutoff" ]
}
}

View File

@ -0,0 +1,5 @@
{
"daisy_seed": {
"parameterPins": [ 15 ]
}
}

View File

@ -0,0 +1,44 @@
#include "impl.h"
#include <bw_ap1.h>
using namespace Brickworks;
extern "C" {
impl impl_new() {
return reinterpret_cast<impl>(new AP1<1>());
}
void impl_free(impl instance) {
AP1<1> *ap1 = reinterpret_cast<AP1<1> *>(instance);
delete ap1;
}
void impl_set_sample_rate(impl instance, float sample_rate) {
AP1<1> *ap1 = reinterpret_cast<AP1<1> *>(instance);
ap1->setSampleRate(sample_rate);
}
void impl_reset(impl instance) {
AP1<1> *ap1 = reinterpret_cast<AP1<1> *>(instance);
ap1->reset();
}
void impl_set_parameter(impl instance, size_t index, float value) {
(void)index;
AP1<1> *ap1 = reinterpret_cast<AP1<1> *>(instance);
ap1->setCutoff(value);
}
float impl_get_parameter(impl instance, size_t index) {
(void)instance;
(void)index;
return 0.f;
}
void impl_process(impl instance, const float **inputs, float **outputs, size_t n_samples) {
AP1<1> *ap1 = reinterpret_cast<AP1<1> *>(instance);
ap1->process(inputs, outputs, n_samples);
}
}

View File

@ -0,0 +1,12 @@
{
"lv2": {
"prefixes": {
"bw_examples": "https://www.orastron.com/brickworks/examples/"
},
"uri": "@bw_examples:fxpp_ap1",
"types": [ "@lv2:AllpassPlugin" ],
"version": "1.0",
"busSymbols": [ "input", "output" ],
"parameterSymbols": [ "cutoff" ]
}
}

View File

@ -0,0 +1,36 @@
{
"product": {
"name": "Brickworks 1st-order allpass example (C++)",
"version": "1.1.0",
"buildVersion": "1",
"bundleName": "bw_example_fxpp_ap1",
"buses": [
{
"type": "audio",
"direction": "input",
"channels": "mono",
"name": "Input",
"shortName": "Input"
},
{
"type": "audio",
"direction": "output",
"channels": "mono",
"name": "Output",
"shortName": "Output"
}
],
"parameters": [
{
"name": "Cutoff",
"shortName": "Cutoff",
"direction": "input",
"defaultValue": 1000.0,
"minimum": 20.0,
"maximum": 20000.0,
"unit": "hz",
"map": "logarithmic"
}
]
}
}

View File

@ -0,0 +1,11 @@
{
"vst3": {
"plugin": {
"cid": "67f9cd8d2865469bbcea5838fa1e0944"
},
"controller": {
"cid": "3b74ce845132450cb9aa48efe2d68cd3"
},
"subCategory": "Fx|Filter"
}
}

View File

@ -23,33 +23,42 @@ cd common && $TIBIA_DIR/tibia --common $TIBIA_DIR/templates/vst3-make vst3 && cd
cd common && $TIBIA_DIR/tibia --common $TIBIA_DIR/templates/android android && cd ..
cd common && $TIBIA_DIR/tibia --common $TIBIA_DIR/templates/android-make android && cd ..
dirs="fx_ap1 fx_ap2 fx_balance"
dirs="fx_ap1 fx_ap2 fx_balance fxpp_ap1"
for d in $dirs; do
echo Generating data files for $d
case $d in
fxpp*)
make_json=make-cxx.json
;;
*)
make_json=make.json
;;
esac
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/cmd.json $TIBIA_DIR/templates/cmd cmd && cd ..
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/cmd.json,../common/src/make.json,../common/src/cmd-make.json $TIBIA_DIR/templates/cmd-make cmd && cd ..
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/cmd.json,../common/src/$make_json,../common/src/cmd-make.json $TIBIA_DIR/templates/cmd-make cmd && cd ..
echo "include ../../common/cmd/Makefile" > $d/cmd/Makefile
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json $TIBIA_DIR/templates/web web && cd ..
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,../common/src/make.json,../common/src/web-make.json $TIBIA_DIR/templates/web-make web && cd ..
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,../common/src/make.json,../common/src/web-make.json $TIBIA_DIR/templates/web-demo web && cd ..
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,../common/src/$make_json,../common/src/web-make.json $TIBIA_DIR/templates/web-make web && cd ..
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,../common/src/$make_json,../common/src/web-make.json $TIBIA_DIR/templates/web-demo web && cd ..
echo "include ../../common/web/Makefile" > $d/web/Makefile
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/daisy-seed.json $TIBIA_DIR/templates/daisy-seed daisy-seed && cd ..
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/daisy-seed.json,../common/src/make.json,../common/src/daisy-seed-make.json $TIBIA_DIR/templates/daisy-seed-make daisy-seed && cd ..
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/daisy-seed.json,../common/src/$make_json,../common/src/daisy-seed-make.json $TIBIA_DIR/templates/daisy-seed-make daisy-seed && cd ..
echo "include ../../common/daisy-seed/Makefile" > $d/daisy-seed/Makefile
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/lv2.json $TIBIA_DIR/templates/lv2 lv2 && cd ..
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/lv2.json,../common/src/make.json,../common/src/lv2-make.json $TIBIA_DIR/templates/lv2-make lv2 && cd ..
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/lv2.json,../common/src/$make_json,../common/src/lv2-make.json $TIBIA_DIR/templates/lv2-make lv2 && cd ..
echo "include ../../common/lv2/Makefile" > $d/lv2/Makefile
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/vst3.json $TIBIA_DIR/templates/vst3 vst3 && cd ..
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/vst3.json,../common/src/make.json,../common/src/vst3-make.json $TIBIA_DIR/templates/vst3-make vst3 && cd ..
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/vst3.json,../common/src/$make_json,../common/src/vst3-make.json $TIBIA_DIR/templates/vst3-make vst3 && cd ..
echo "include ../../common/vst3/Makefile" > $d/vst3/Makefile
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/android.json $TIBIA_DIR/templates/android android && cd ..
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/android.json,../common/src/make.json,../common/src/android-make.json $TIBIA_DIR/templates/android-make android && cd ..
cd $d && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/android.json,../common/src/$make_json,../common/src/android-make.json $TIBIA_DIR/templates/android-make android && cd ..
echo "include ../../common/android/Makefile" > $d/android/Makefile
done

View File

@ -4,7 +4,7 @@ echo Removing common files
rm -fr common/cmd common/web common/daisy-seed common/lv2 common/vst3 common/android
dirs="fx_ap1 fx_ap2 fx_balance"
dirs="fx_ap1 fx_ap2 fx_balance fxpp_ap1"
for d in $dirs; do
echo Removing data files for $d