add fxpp_{ap2,balance}, fix fx_balance daisy seed, c++ array in non-wasm
This commit is contained in:
parent
e4e9643509
commit
4ff4ceed70
@ -1,6 +1,6 @@
|
||||
#ifdef WASM
|
||||
# define BW_CXX_NO_ARRAY
|
||||
# define BW_NO_MATH_H
|
||||
# define INFINITY (__builtin_inff())
|
||||
#endif
|
||||
#define BW_NO_DEBUG
|
||||
#define BW_CXX_NO_ARRAY
|
||||
|
@ -6,13 +6,13 @@ extern "C" {
|
||||
|
||||
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);
|
||||
impl impl_new(void);
|
||||
void impl_free(impl handle);
|
||||
void impl_set_sample_rate(impl handle, float sample_rate);
|
||||
void impl_reset(impl handle);
|
||||
void impl_set_parameter(impl handle, size_t index, float value);
|
||||
float impl_get_parameter(impl handle, size_t index);
|
||||
void impl_process(impl handle, const float **inputs, float **outputs, size_t n_samples);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"daisy_seed": {
|
||||
"parameterPins": [ 22, 23, 15 ]
|
||||
"parameterPins": [ 15, 22, 23 ]
|
||||
}
|
||||
}
|
||||
|
@ -7,40 +7,40 @@ using namespace Brickworks;
|
||||
|
||||
extern "C" {
|
||||
|
||||
impl impl_new() {
|
||||
impl impl_new(void) {
|
||||
return reinterpret_cast<impl>(new AP1<1>());
|
||||
}
|
||||
|
||||
void impl_free(impl instance) {
|
||||
AP1<1> *ap1 = reinterpret_cast<AP1<1> *>(instance);
|
||||
delete ap1;
|
||||
void impl_free(impl handle) {
|
||||
AP1<1> *instance = reinterpret_cast<AP1<1> *>(handle);
|
||||
delete instance;
|
||||
}
|
||||
|
||||
void impl_set_sample_rate(impl instance, float sample_rate) {
|
||||
AP1<1> *ap1 = reinterpret_cast<AP1<1> *>(instance);
|
||||
ap1->setSampleRate(sample_rate);
|
||||
void impl_set_sample_rate(impl handle, float sample_rate) {
|
||||
AP1<1> *instance = reinterpret_cast<AP1<1> *>(handle);
|
||||
instance->setSampleRate(sample_rate);
|
||||
}
|
||||
|
||||
void impl_reset(impl instance) {
|
||||
AP1<1> *ap1 = reinterpret_cast<AP1<1> *>(instance);
|
||||
ap1->reset();
|
||||
void impl_reset(impl handle) {
|
||||
AP1<1> *instance = reinterpret_cast<AP1<1> *>(handle);
|
||||
instance->reset();
|
||||
}
|
||||
|
||||
void impl_set_parameter(impl instance, size_t index, float value) {
|
||||
void impl_set_parameter(impl handle, size_t index, float value) {
|
||||
(void)index;
|
||||
AP1<1> *ap1 = reinterpret_cast<AP1<1> *>(instance);
|
||||
ap1->setCutoff(value);
|
||||
AP1<1> *instance = reinterpret_cast<AP1<1> *>(handle);
|
||||
instance->setCutoff(value);
|
||||
}
|
||||
|
||||
float impl_get_parameter(impl instance, size_t index) {
|
||||
(void)instance;
|
||||
float impl_get_parameter(impl handle, size_t index) {
|
||||
(void)handle;
|
||||
(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);
|
||||
void impl_process(impl handle, const float **inputs, float **outputs, size_t n_samples) {
|
||||
AP1<1> *instance = reinterpret_cast<AP1<1> *>(handle);
|
||||
instance->process(inputs, outputs, n_samples);
|
||||
}
|
||||
|
||||
}
|
||||
|
5
examples/fxpp_ap2/src/android.json
Normal file
5
examples/fxpp_ap2/src/android.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"android": {
|
||||
"javaPackageName": "com.orastron.bw_example_fxpp_ap2"
|
||||
}
|
||||
}
|
6
examples/fxpp_ap2/src/cmd.json
Normal file
6
examples/fxpp_ap2/src/cmd.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"cmd": {
|
||||
"busIds": [ "input", "output" ],
|
||||
"parameterIds": [ "cutoff", "q" ]
|
||||
}
|
||||
}
|
5
examples/fxpp_ap2/src/daisy-seed.json
Normal file
5
examples/fxpp_ap2/src/daisy-seed.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"daisy_seed": {
|
||||
"parameterPins": [ 15, 16 ]
|
||||
}
|
||||
}
|
52
examples/fxpp_ap2/src/impl.cpp
Normal file
52
examples/fxpp_ap2/src/impl.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
#include "impl.h"
|
||||
|
||||
#include "common.h"
|
||||
#include <bw_ap2.h>
|
||||
|
||||
using namespace Brickworks;
|
||||
|
||||
extern "C" {
|
||||
|
||||
impl impl_new(void) {
|
||||
return reinterpret_cast<impl>(new AP2<1>());
|
||||
}
|
||||
|
||||
void impl_free(impl handle) {
|
||||
AP2<1> *instance = reinterpret_cast<AP2<1> *>(handle);
|
||||
delete instance;
|
||||
}
|
||||
|
||||
void impl_set_sample_rate(impl handle, float sample_rate) {
|
||||
AP2<1> *instance = reinterpret_cast<AP2<1> *>(handle);
|
||||
instance->setSampleRate(sample_rate);
|
||||
}
|
||||
|
||||
void impl_reset(impl handle) {
|
||||
AP2<1> *instance = reinterpret_cast<AP2<1> *>(handle);
|
||||
instance->reset();
|
||||
}
|
||||
|
||||
void impl_set_parameter(impl handle, size_t index, float value) {
|
||||
AP2<1> *instance = reinterpret_cast<AP2<1> *>(handle);
|
||||
switch (index) {
|
||||
case 0:
|
||||
instance->setCutoff(value);
|
||||
break;
|
||||
case 1:
|
||||
instance->setQ(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float impl_get_parameter(impl handle, size_t index) {
|
||||
(void)handle;
|
||||
(void)index;
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
void impl_process(impl handle, const float **inputs, float **outputs, size_t n_samples) {
|
||||
AP2<1> *instance = reinterpret_cast<AP2<1> *>(handle);
|
||||
instance->process(inputs, outputs, n_samples);
|
||||
}
|
||||
|
||||
}
|
12
examples/fxpp_ap2/src/lv2.json
Normal file
12
examples/fxpp_ap2/src/lv2.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"lv2": {
|
||||
"prefixes": {
|
||||
"bw_examples": "https://www.orastron.com/brickworks/examples/"
|
||||
},
|
||||
"uri": "@bw_examples:fxpp_ap2",
|
||||
"types": [ "@lv2:AllpassPlugin" ],
|
||||
"version": "1.0",
|
||||
"busSymbols": [ "input", "output" ],
|
||||
"parameterSymbols": [ "cutoff", "q" ]
|
||||
}
|
||||
}
|
45
examples/fxpp_ap2/src/product.json
Normal file
45
examples/fxpp_ap2/src/product.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"product": {
|
||||
"name": "Brickworks 2nd-order allpass example (C++)",
|
||||
"version": "1.1.0",
|
||||
"buildVersion": "1",
|
||||
"bundleName": "bw_example_fxpp_ap2",
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"name": "Q",
|
||||
"shortName": "Q",
|
||||
"direction": "input",
|
||||
"defaultValue": 0.5,
|
||||
"minimum": 0.5,
|
||||
"maximum": 10.0,
|
||||
"map": "linear"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
11
examples/fxpp_ap2/src/vst3.json
Normal file
11
examples/fxpp_ap2/src/vst3.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"vst3": {
|
||||
"plugin": {
|
||||
"cid": "32fc0150b5e4473286c506af49a9e7ec"
|
||||
},
|
||||
"controller": {
|
||||
"cid": "628219485d3748e2865579ede52e66bb"
|
||||
},
|
||||
"subCategory": "Fx|Filter"
|
||||
}
|
||||
}
|
5
examples/fxpp_balance/src/android.json
Normal file
5
examples/fxpp_balance/src/android.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"android": {
|
||||
"javaPackageName": "com.orastron.bw_example_fxpp_balance"
|
||||
}
|
||||
}
|
6
examples/fxpp_balance/src/cmd.json
Normal file
6
examples/fxpp_balance/src/cmd.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"cmd": {
|
||||
"busIds": [ "input", "output" ],
|
||||
"parameterIds": [ "balance", "l_level", "r_level" ]
|
||||
}
|
||||
}
|
5
examples/fxpp_balance/src/daisy-seed.json
Normal file
5
examples/fxpp_balance/src/daisy-seed.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"daisy_seed": {
|
||||
"parameterPins": [ 15, 22, 23 ]
|
||||
}
|
||||
}
|
66
examples/fxpp_balance/src/impl.cpp
Normal file
66
examples/fxpp_balance/src/impl.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
#include "impl.h"
|
||||
|
||||
#include "common.h"
|
||||
#include <bw_balance.h>
|
||||
#include <bw_ppm.h>
|
||||
|
||||
using namespace Brickworks;
|
||||
|
||||
class Engine {
|
||||
public:
|
||||
Balance<1> balance;
|
||||
PPM<2> ppm;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
||||
impl impl_new(void) {
|
||||
return reinterpret_cast<impl>(new Engine());
|
||||
}
|
||||
|
||||
void impl_free(impl handle) {
|
||||
Engine *instance = reinterpret_cast<Engine *>(handle);
|
||||
delete instance;
|
||||
}
|
||||
|
||||
void impl_set_sample_rate(impl handle, float sample_rate) {
|
||||
Engine *instance = reinterpret_cast<Engine *>(handle);
|
||||
instance->balance.setSampleRate(sample_rate);
|
||||
instance->ppm.setSampleRate(sample_rate);
|
||||
}
|
||||
|
||||
void impl_reset(impl handle) {
|
||||
Engine *instance = reinterpret_cast<Engine *>(handle);
|
||||
instance->balance.reset();
|
||||
instance->ppm.reset();
|
||||
}
|
||||
|
||||
void impl_set_parameter(impl handle, size_t index, float value) {
|
||||
(void)index;
|
||||
|
||||
Engine *instance = reinterpret_cast<Engine *>(handle);
|
||||
instance->balance.setBalance(0.01f * value);
|
||||
}
|
||||
|
||||
float impl_get_parameter(impl handle, size_t index) {
|
||||
Engine *instance = reinterpret_cast<Engine *>(handle);
|
||||
float v = instance->ppm.getYZ1(index - 1);
|
||||
return v < -60.f ? -60.f : (v > 0.f ? 0.f : v);
|
||||
}
|
||||
|
||||
void impl_process(impl handle, const float **inputs, float **outputs, size_t n_samples) {
|
||||
Engine *instance = reinterpret_cast<Engine *>(handle);
|
||||
#ifdef WASM
|
||||
const float *xL[1] = {inputs[0]};
|
||||
const float *xR[1] = {inputs[1]};
|
||||
float *yL[1] = {outputs[0]};
|
||||
float *yR[1] = {outputs[1]};
|
||||
instance->balance.process(xL, xR, yL, yR, n_samples);
|
||||
instance->ppm.process(outputs, nullptr, n_samples);
|
||||
#else
|
||||
instance->balance.process({inputs[0]}, {inputs[1]}, {outputs[0]}, {outputs[1]}, n_samples);
|
||||
instance->ppm.process({outputs[0], outputs[1]}, {nullptr, nullptr}, n_samples);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
12
examples/fxpp_balance/src/lv2.json
Normal file
12
examples/fxpp_balance/src/lv2.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"lv2": {
|
||||
"prefixes": {
|
||||
"bw_examples": "https://www.orastron.com/brickworks/examples/"
|
||||
},
|
||||
"uri": "@bw_examples:fxpp_balance",
|
||||
"types": [ "@lv2:SpatialPlugin" ],
|
||||
"version": "1.0",
|
||||
"busSymbols": [ "input", "output" ],
|
||||
"parameterSymbols": [ "balance", "l_level", "r_level" ]
|
||||
}
|
||||
}
|
56
examples/fxpp_balance/src/product.json
Normal file
56
examples/fxpp_balance/src/product.json
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
"product": {
|
||||
"name": "Brickworks stereo balance example",
|
||||
"version": "1.1.0",
|
||||
"buildVersion": "1",
|
||||
"bundleName": "bw_example_fx_balance",
|
||||
"buses": [
|
||||
{
|
||||
"type": "audio",
|
||||
"direction": "input",
|
||||
"channels": "stereo",
|
||||
"name": "Input",
|
||||
"shortName": "Input"
|
||||
},
|
||||
{
|
||||
"type": "audio",
|
||||
"direction": "output",
|
||||
"channels": "stereo",
|
||||
"name": "Output",
|
||||
"shortName": "Output"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Balance",
|
||||
"shortName": "Balance",
|
||||
"direction": "input",
|
||||
"defaultValue": 0.0,
|
||||
"minimum": -100.0,
|
||||
"maximum": 100.0,
|
||||
"unit": "pc",
|
||||
"map": "linear"
|
||||
},
|
||||
{
|
||||
"name": "Left level",
|
||||
"shortName": "L level",
|
||||
"direction": "output",
|
||||
"defaultValue": -60.0,
|
||||
"minimum": -60.0,
|
||||
"maximum": 0.0,
|
||||
"unit": "db",
|
||||
"map": "linear"
|
||||
},
|
||||
{
|
||||
"name": "Right level",
|
||||
"shortName": "R level",
|
||||
"direction": "output",
|
||||
"defaultValue": -60.0,
|
||||
"minimum": -60.0,
|
||||
"maximum": 0.0,
|
||||
"unit": "db",
|
||||
"map": "linear"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
11
examples/fxpp_balance/src/vst3.json
Normal file
11
examples/fxpp_balance/src/vst3.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"vst3": {
|
||||
"plugin": {
|
||||
"cid": "2c5793c7eae0488e8c7820afbcd6ee17"
|
||||
},
|
||||
"controller": {
|
||||
"cid": "c67e0faf04f54fdf8019eb055f44b1b0"
|
||||
},
|
||||
"subCategory": "Fx|Spatial"
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ 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 fxpp_ap1"
|
||||
dirs="fx_ap1 fx_ap2 fx_balance fxpp_ap1 fxpp_ap2 fxpp_balance"
|
||||
|
||||
for d in $dirs; do
|
||||
echo Generating data files for $d
|
||||
|
@ -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 fxpp_ap1"
|
||||
dirs="fx_ap1 fx_ap2 fx_balance fxpp_ap1 fxpp_ap2 fxpp_balance"
|
||||
|
||||
for d in $dirs; do
|
||||
echo Removing data files for $d
|
||||
|
Loading…
Reference in New Issue
Block a user