updated fx_ap2 and tibia-related scripts

This commit is contained in:
Stefano D'Angelo 2024-02-01 10:08:32 +01:00
parent 233c9d7303
commit 4b2f07852b
20 changed files with 175 additions and 364 deletions

View File

@ -1,6 +0,0 @@
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
NAME := bw_example_fx_ap2
SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_ap2.c
include ${ROOT_DIR}/../../common/android/android.mk

View File

@ -1,7 +0,0 @@
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
TARGET = bw_example_fx_ap2
C_SOURCES += ${ROOT_DIR}/../src/bw_example_fx_ap2.c
include ${ROOT_DIR}/../../common/daisy-seed/daisy-seed.mk

View File

@ -1,36 +0,0 @@
/*
* Brickworks
*
* Copyright (C) 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* Brickworks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
*
* File authors: Stefano D'Angelo
*/
#ifndef _CONFIG_DAISY_SEED_H
#define _CONFIG_DAISY_SEED_H
struct config_pin {
int param_index;
int pin;
};
#define NUM_PINS 2
static struct config_pin config_pins[NUM_PINS] = {
{ 0, 15 },
{ 1, 16 }
};
#endif

View File

@ -1,6 +0,0 @@
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
NAME := bw_example_fx_ap2
SOURCE := ${NAME}.c
include ${ROOT_DIR}/../../common/ios/ios.mk

View File

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

View File

@ -1,50 +0,0 @@
/*
* Brickworks
*
* Copyright (C) 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* Brickworks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
*
* File author: Stefano D'Angelo
*/
#include "bw_example_fx_ap2.h"
void bw_example_fx_ap2_init(bw_example_fx_ap2 *instance) {
bw_ap2_init(&instance->ap2_coeffs);
}
void bw_example_fx_ap2_set_sample_rate(bw_example_fx_ap2 *instance, float sample_rate) {
bw_ap2_set_sample_rate(&instance->ap2_coeffs, sample_rate);
}
void bw_example_fx_ap2_reset(bw_example_fx_ap2 *instance) {
bw_ap2_reset_coeffs(&instance->ap2_coeffs);
bw_ap2_reset_state(&instance->ap2_coeffs, &instance->ap2_state, 0.f);
}
void bw_example_fx_ap2_process(bw_example_fx_ap2 *instance, const float** x, float** y, int n_samples) {
bw_ap2_process(&instance->ap2_coeffs, &instance->ap2_state, x[0], y[0], n_samples);
}
void bw_example_fx_ap2_set_parameter(bw_example_fx_ap2 *instance, int index, float value) {
instance->params[index] = value;
if (index == 0)
bw_ap2_set_cutoff(&instance->ap2_coeffs, 20.f + (20e3f - 20.f) * value * value * value);
else
bw_ap2_set_Q(&instance->ap2_coeffs, 0.5f + 9.5f * value);
}
float bw_example_fx_ap2_get_parameter(bw_example_fx_ap2 *instance, int index) {
return instance->params[index];
}

View File

@ -1,59 +0,0 @@
/*
* Brickworks
*
* Copyright (C) 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* Brickworks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
*
* File author: Stefano D'Angelo
*/
#ifndef _BW_EXAMPLE_FX_AP2_H
#define _BW_EXAMPLE_FX_AP2_H
#include "platform.h"
#include <bw_ap2.h>
#ifdef __cplusplus
extern "C" {
#endif
enum {
p_cutoff,
p_Q,
p_n
};
struct _bw_example_fx_ap2 {
// Sub-components
bw_ap2_coeffs ap2_coeffs;
bw_ap2_state ap2_state;
// Parameters
float params[p_n];
};
typedef struct _bw_example_fx_ap2 bw_example_fx_ap2;
void bw_example_fx_ap2_init(bw_example_fx_ap2 *instance);
void bw_example_fx_ap2_set_sample_rate(bw_example_fx_ap2 *instance, float sample_rate);
void bw_example_fx_ap2_reset(bw_example_fx_ap2 *instance);
void bw_example_fx_ap2_process(bw_example_fx_ap2 *instance, const float** x, float** y, int n_samples);
void bw_example_fx_ap2_set_parameter(bw_example_fx_ap2 *instance, int index, float value);
float bw_example_fx_ap2_get_parameter(bw_example_fx_ap2 *instance, int index);
#ifdef __cplusplus
}
#endif
#endif

View File

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

View File

@ -1,88 +0,0 @@
/*
* Brickworks
*
* Copyright (C) 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* Brickworks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
*
* File authors: Stefano D'Angelo
*/
#ifndef _CONFIG_H
#define _CONFIG_H
// Definitions
#define IO_MONO 1
#define IO_STEREO (1<<1)
struct config_io_bus {
const char *name;
char out;
char aux;
char cv;
char configs;
};
struct config_parameter {
const char *name;
const char *shortName;
const char *units;
char out;
char bypass;
int steps;
float defaultValueUnmapped;
};
// Data
#define COMPANY_NAME "Orastron"
#define COMPANY_WEBSITE "https://www.orastron.com/"
#define COMPANY_MAILTO "mailto:info@orastron.com"
#define PLUGIN_NAME "bw_example_fx_ap2"
#define PLUGIN_VERSION "1.0.0"
#define NUM_BUSES_IN 1
#define NUM_BUSES_OUT 1
#define NUM_CHANNELS_IN 1
#define NUM_CHANNELS_OUT 1
static struct config_io_bus config_buses_in[NUM_BUSES_IN] = {
{ "Audio in", 0, 0, 0, IO_MONO }
};
static struct config_io_bus config_buses_out[NUM_BUSES_OUT] = {
{ "Audio out", 1, 0, 0, IO_MONO }
};
#define NUM_PARAMETERS 2
static struct config_parameter config_parameters[NUM_PARAMETERS] = {
{ "Cutoff", "Cutoff", "Hz", 0, 0, 0, 0.5f },
{ "Q", "Q", "", 0, 0, 0, 0.f },
};
// Internal API
#include "bw_example_fx_ap2.h"
#define P_TYPE bw_example_fx_ap2
#define P_INIT bw_example_fx_ap2_init
#define P_SET_SAMPLE_RATE bw_example_fx_ap2_set_sample_rate
#define P_RESET bw_example_fx_ap2_reset
#define P_PROCESS bw_example_fx_ap2_process
#define P_SET_PARAMETER bw_example_fx_ap2_set_parameter
#define P_GET_PARAMETER bw_example_fx_ap2_get_parameter
#endif

View File

@ -1,43 +0,0 @@
/*
* Brickworks
*
* Copyright (C) 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* Brickworks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
*
* File author: Stefano D'Angelo
*/
var buses = [
{
stereo: false,
output: false
},
{
stereo: false,
output: true
}
];
var parameters = [
{
name: "Cutoff",
output: false,
defaultValue: 0.5
},
{
name: "Q",
output: false,
defaultValue: 0.0
}
];

View File

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

View File

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

View File

@ -0,0 +1,55 @@
#include "common.h"
#include <bw_ap2.h>
typedef struct plugin {
bw_ap2_coeffs ap2_coeffs;
bw_ap2_state ap2_state;
} plugin;
static void plugin_init(plugin *instance) {
bw_ap2_init(&instance->ap2_coeffs);
}
static void plugin_fini(plugin *instance) {
(void)instance;
}
static void plugin_set_sample_rate(plugin *instance, float sample_rate) {
bw_ap2_set_sample_rate(&instance->ap2_coeffs, 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) {
bw_ap2_reset_coeffs(&instance->ap2_coeffs);
bw_ap2_reset_state(&instance->ap2_coeffs, &instance->ap2_state, 0.f);
}
static void plugin_set_parameter(plugin *instance, size_t index, float value) {
switch (index) {
case 0:
bw_ap2_set_cutoff(&instance->ap2_coeffs, value);
break;
case 1:
bw_ap2_set_Q(&instance->ap2_coeffs, value);
break;
}
}
static float plugin_get_parameter(plugin *instance, size_t index) {
(void)instance;
(void)index;
return 0.f;
}
static void plugin_process(plugin *instance, const float **inputs, float **outputs, size_t n_samples) {
bw_ap2_process(&instance->ap2_coeffs, &instance->ap2_state, inputs[0], outputs[0], n_samples);
}

View File

@ -0,0 +1,45 @@
{
"product": {
"name": "Brickworks 2nd-order allpass example (C)",
"version": "1.0.1",
"buildVersion": "1",
"bundleName": "bw_example_fx_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"
}
]
}
}

View File

@ -0,0 +1,11 @@
{
"vst3": {
"plugin": {
"cid": "0f66cf3b7f054ae8b39fa788625425ad"
},
"controller": {
"cid": "0362e060a322413fa523e18ec74ced9f"
},
"subCategory": "Fx|Filter"
}
}

View File

@ -1,9 +0,0 @@
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
NAME := bw_example_fx_ap2
SOURCE := bw_example_fx_ap2.c
include ${ROOT_DIR}/../../common/vst3/vst3.mk
CXXFLAGS += -DRELEASE=1 -DNDEBUG -DBW_NO_DEBUG
#CXXFLAGS += -DDEVELOPMENT=1 -DBW_DEBUG_DEEP

View File

@ -1,36 +0,0 @@
/*
* Brickworks
*
* Copyright (C) 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* Brickworks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
*
* File authors: Stefano D'Angelo, Paolo Marrone
*/
#ifndef _VST3_CONFIG_H
#define _VST3_CONFIG_H
#define PLUGIN_SUBCATEGORY "Fx|Filter"
#define PLUGIN_GUID_1 0x0f66cf3b
#define PLUGIN_GUID_2 0x7f054ae8
#define PLUGIN_GUID_3 0xb39fa788
#define PLUGIN_GUID_4 0x625425ad
#define CTRL_GUID_1 0x0362e060
#define CTRL_GUID_2 0xa322413f
#define CTRL_GUID_3 0xa523e18e
#define CTRL_GUID_4 0xc74ced9f
#endif

View File

@ -1,4 +0,0 @@
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_ap2.c
include ${ROOT_DIR}/../../common/web/web.mk

View File

@ -2,6 +2,8 @@
TIBIA_DIR=~/repos/tibia
echo Generating common files
cd common && $TIBIA_DIR/tibia --common $TIBIA_DIR/templates/cmd cmd && cd ..
cd common && $TIBIA_DIR/tibia --common $TIBIA_DIR/templates/cmd-make cmd && cd ..
@ -21,27 +23,33 @@ 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 ..
cd fx_ap1 && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/cmd.json $TIBIA_DIR/templates/cmd cmd && cd ..
cd fx_ap1 && $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" > fx_ap1/cmd/Makefile
dirs="fx_ap1 fx_ap2"
cd fx_ap1 && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json $TIBIA_DIR/templates/web web && cd ..
cd fx_ap1 && $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 fx_ap1 && $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" > fx_ap1/web/Makefile
for d in $dirs; do
echo Generating data files for $d
cd fx_ap1 && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/daisy-seed.json $TIBIA_DIR/templates/daisy-seed daisy-seed && cd ..
cd fx_ap1 && $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" > fx_ap1/daisy-seed/Makefile
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 ..
echo "include ../../common/cmd/Makefile" > $d/cmd/Makefile
cd fx_ap1 && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/lv2.json $TIBIA_DIR/templates/lv2 lv2 && cd ..
cd fx_ap1 && $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" > fx_ap1/lv2/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 ..
echo "include ../../common/web/Makefile" > $d/web/Makefile
cd fx_ap1 && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/vst3.json $TIBIA_DIR/templates/vst3 vst3 && cd ..
cd fx_ap1 && $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" > fx_ap1/vst3/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 ..
echo "include ../../common/daisy-seed/Makefile" > $d/daisy-seed/Makefile
cd fx_ap1 && $TIBIA_DIR/tibia --data ../common/src/company.json,src/product.json,src/android.json $TIBIA_DIR/templates/android android && cd ..
cd fx_ap1 && $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" > fx_ap1/android/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 ..
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 ..
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 ..
echo "include ../../common/android/Makefile" > $d/android/Makefile
done

View File

@ -1,5 +1,13 @@
#!/bin/sh
echo Removing common files
rm -fr common/cmd common/web common/daisy-seed common/lv2 common/vst3 common/android
rm -fr fx_ap1/cmd fx_ap1/web fx_ap1/daisy-seed fx_ap1/lv2 fx_ap1/vst3 fx_ap1/android
dirs="fx_ap1 fx_ap2"
for d in $dirs; do
echo Removing data files for $d
rm -fr $d/cmd $d/web $d/daisy-seed $d/lv2 $d/vst3 $d/android
done