better indentation
This commit is contained in:
parent
0fa25e8dc7
commit
8ffbd207fe
@ -18,66 +18,70 @@
|
||||
* File author: Stefano D'Angelo
|
||||
*/
|
||||
|
||||
#define NUM_AUDIO_BUSES_IN {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "input").length}}
|
||||
#define NUM_AUDIO_BUSES_OUT {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "output").length}}
|
||||
#define NUM_AUDIO_BUSES_IN {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "input").length}}
|
||||
#define NUM_AUDIO_BUSES_OUT {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "output").length}}
|
||||
|
||||
#define AUDIO_BUS_IN {{=it.product.buses.findIndex(x => x.type == "audio" && x.direction == "input" && !x.cv && !x.sidechain && !x.optional)}}
|
||||
#define AUDIO_BUS_OUT {{=it.product.buses.findIndex(x => x.type == "audio" && x.direction == "output" && !x.cv && !x.sidechain && !x.optional)}}
|
||||
#define AUDIO_BUS_IN {{=it.product.buses.findIndex(x => x.type == "audio" && x.direction == "input" && !x.cv && !x.sidechain && !x.optional)}}
|
||||
#define AUDIO_BUS_OUT {{=it.product.buses.findIndex(x => x.type == "audio" && x.direction == "output" && !x.cv && !x.sidechain && !x.optional)}}
|
||||
|
||||
#define NUM_CHANNELS_IN {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "input" && !x.cv && !x.sidechain && !x.optional).length > 0 ? (it.product.buses.filter(x => x.type == "audio" && x.direction == "input" && !x.cv && !x.sidechain && !x.optional)[0].channels == "mono" ? 1 : 2) : 0}}
|
||||
#define NUM_CHANNELS_OUT {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "output" && !x.cv && !x.sidechain && !x.optional).length > 0 ? (it.product.buses.filter(x => x.type == "audio" && x.direction == "output" && !x.cv && !x.sidechain && !x.optional)[0].channels == "mono" ? 1 : 2) : 0}}
|
||||
#define NUM_NON_OPT_CHANNELS_IN {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "input" && !x.optional).reduce((a, x) => a + (x.channels == "mono" ? 1 : 2), 0)}}
|
||||
#define NUM_NON_OPT_CHANNELS_OUT {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "output" && !x.optional).reduce((a, x) => a + (x.channels == "mono" ? 1 : 2), 0)}}
|
||||
#define NUM_ALL_CHANNELS_IN {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "input").reduce((a, x) => a + (x.channels == "mono" ? 1 : 2), 0)}}
|
||||
#define NUM_ALL_CHANNELS_OUT {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "output").reduce((a, x) => a + (x.channels == "mono" ? 1 : 2), 0)}}
|
||||
#define NUM_CHANNELS_IN {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "input" && !x.cv && !x.sidechain && !x.optional).length > 0 ? (it.product.buses.filter(x => x.type == "audio" && x.direction == "input" && !x.cv && !x.sidechain && !x.optional)[0].channels == "mono" ? 1 : 2) : 0}}
|
||||
#define NUM_CHANNELS_OUT {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "output" && !x.cv && !x.sidechain && !x.optional).length > 0 ? (it.product.buses.filter(x => x.type == "audio" && x.direction == "output" && !x.cv && !x.sidechain && !x.optional)[0].channels == "mono" ? 1 : 2) : 0}}
|
||||
#define NUM_NON_OPT_CHANNELS_IN {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "input" && !x.optional).reduce((a, x) => a + (x.channels == "mono" ? 1 : 2), 0)}}
|
||||
#define NUM_NON_OPT_CHANNELS_OUT {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "output" && !x.optional).reduce((a, x) => a + (x.channels == "mono" ? 1 : 2), 0)}}
|
||||
#define NUM_ALL_CHANNELS_IN {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "input").reduce((a, x) => a + (x.channels == "mono" ? 1 : 2), 0)}}
|
||||
#define NUM_ALL_CHANNELS_OUT {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "output").reduce((a, x) => a + (x.channels == "mono" ? 1 : 2), 0)}}
|
||||
|
||||
#define NUM_MIDI_INPUTS {{=it.product.buses.filter(x => x.type == "midi" && x.direction == "input").length}}
|
||||
#define NUM_MIDI_INPUTS {{=it.product.buses.filter(x => x.type == "midi" && x.direction == "input").length}}
|
||||
|
||||
#define MIDI_BUS_IN {{=it.product.buses.findIndex(x => x.type == "midi" && x.direction == "input")}}
|
||||
#define MIDI_BUS_IN {{=it.product.buses.findIndex(x => x.type == "midi" && x.direction == "input")}}
|
||||
|
||||
#if NUM_AUDIO_BUSES_IN + NUM_AUDIO_BUSES_OUT > 0
|
||||
static struct {
|
||||
size_t index;
|
||||
char out;
|
||||
char optional;
|
||||
char channels;
|
||||
size_t index;
|
||||
char out;
|
||||
char optional;
|
||||
char channels;
|
||||
} audio_bus_data[NUM_AUDIO_BUSES_IN + NUM_AUDIO_BUSES_OUT] = {
|
||||
{{~it.product.buses :b:i}}
|
||||
{{?b.type == "audio"}}
|
||||
{
|
||||
/* .index = */ {{=i}},
|
||||
/* .out = */ {{=b.direction == "output" ? 1 : 0}},
|
||||
/* .optional = */ {{=b.optional ? 1 : 0}},
|
||||
/* .channels = */ {{=b.channels == "mono" ? 1 : 2}}
|
||||
/* .index = */ {{=i}},
|
||||
/* .out = */ {{=b.direction == "output" ? 1 : 0}},
|
||||
/* .optional = */ {{=b.optional ? 1 : 0}},
|
||||
/* .channels = */ {{=b.channels == "mono" ? 1 : 2}}
|
||||
},
|
||||
{{?}}
|
||||
{{~}}
|
||||
};
|
||||
#endif
|
||||
|
||||
#define PARAMETERS_N {{=it.product.parameters.length}}
|
||||
#define PARAMETERS_N {{=it.product.parameters.length}}
|
||||
|
||||
#if PARAMETERS_N > 0
|
||||
|
||||
# define PARAM_BYPASS 1
|
||||
# define PARAM_TOGGLED (1<<1)
|
||||
# define PARAM_INTEGER (1<<2)
|
||||
# define PARAM_BYPASS 1
|
||||
# define PARAM_TOGGLED (1<<1)
|
||||
# define PARAM_INTEGER (1<<2)
|
||||
|
||||
static struct {
|
||||
char out;
|
||||
float def;
|
||||
float min;
|
||||
float max;
|
||||
uint32_t flags;
|
||||
char out;
|
||||
float def;
|
||||
float min;
|
||||
float max;
|
||||
uint32_t flags;
|
||||
} param_data[PARAMETERS_N] = {
|
||||
{{~it.product.parameters :p}}
|
||||
{
|
||||
/* .out = */ {{=p.direction == "output" ? 1 : 0}},
|
||||
/* .def = */ {{=p.defaultValue.toExponential()}},
|
||||
/* .min = */ {{=p.minimum.toExponential()}}f,
|
||||
/* .max = */ {{=p.maximum.toExponential()}}f,
|
||||
/* .flags = */ {{?p.isBypass}}PARAM_BYPASS{{??p.isLatency}}PARAM_INTEGER{{??}}0{{?p.toggled}} | PARAM_TOGGLED{{?}}{{?p.integer}} | PARAM_INTEGER{{?}}{{?}}
|
||||
/* .out = */ {{=p.direction == "output" ? 1 : 0}},
|
||||
/* .def = */ {{=p.defaultValue.toExponential()}},
|
||||
/* .min = */ {{=p.minimum.toExponential()}}f,
|
||||
/* .max = */ {{=p.maximum.toExponential()}}f,
|
||||
/* .flags = */ {{?p.isBypass}}PARAM_BYPASS{{??p.isLatency}}PARAM_INTEGER{{??}}0{{?p.toggled}} | PARAM_TOGGLED{{?}}{{?p.integer}} | PARAM_INTEGER{{?}}{{?}}
|
||||
},
|
||||
{{~}}
|
||||
};
|
||||
|
||||
{{?it.product.parameters.find(x => x.direction == "output" && x.isCpumeter)}}
|
||||
# define PARAM_OUT_CPU_INDEX {{=it.product.parameters.indexOf(it.product.parameters.find(x => x.direction == "output" && x.isCpumeter))}}
|
||||
{{?}}
|
||||
#endif
|
||||
|
@ -22,10 +22,10 @@
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct {
|
||||
void * handle;
|
||||
const char * format;
|
||||
const char * (*get_bindir)(void *handle);
|
||||
const char * (*get_datadir)(void *handle);
|
||||
void *handle;
|
||||
const char *format;
|
||||
const char *(*get_bindir)(void *handle);
|
||||
const char *(*get_datadir)(void *handle);
|
||||
} plugin_callbacks;
|
||||
|
||||
#include "data.h"
|
||||
@ -42,47 +42,47 @@ typedef struct {
|
||||
#include "miniaudio.h"
|
||||
#define BLOCK_SIZE 32
|
||||
|
||||
static ma_device device;
|
||||
static ma_device_config deviceConfig;
|
||||
char device_inited = 0;
|
||||
static plugin instance;
|
||||
static void * mem;
|
||||
static ma_device device;
|
||||
static ma_device_config deviceConfig;
|
||||
char device_inited = 0;
|
||||
static plugin instance;
|
||||
static void *mem;
|
||||
#if NUM_NON_OPT_CHANNELS_IN > NUM_CHANNELS_IN
|
||||
float zero[BLOCK_SIZE];
|
||||
float zero[BLOCK_SIZE];
|
||||
#endif
|
||||
#if NUM_CHANNELS_IN > 0
|
||||
float x_buf[NUM_CHANNELS_IN * BLOCK_SIZE];
|
||||
float * x_in[NUM_CHANNELS_IN];
|
||||
float x_buf[NUM_CHANNELS_IN * BLOCK_SIZE];
|
||||
float *x_in[NUM_CHANNELS_IN];
|
||||
#endif
|
||||
#if NUM_ALL_CHANNELS_IN > 0
|
||||
const float * x[NUM_ALL_CHANNELS_IN];
|
||||
const float *x[NUM_ALL_CHANNELS_IN];
|
||||
#else
|
||||
const float ** x;
|
||||
const float **x;
|
||||
#endif
|
||||
#if NUM_NON_OPT_CHANNELS_OUT > 0
|
||||
float y_buf[NUM_NON_OPT_CHANNELS_OUT * BLOCK_SIZE];
|
||||
float y_buf[NUM_NON_OPT_CHANNELS_OUT * BLOCK_SIZE];
|
||||
#endif
|
||||
#if NUM_CHANNELS_OUT > 0
|
||||
float * y_out[NUM_CHANNELS_OUT];
|
||||
float *y_out[NUM_CHANNELS_OUT];
|
||||
#endif
|
||||
#if NUM_ALL_CHANNELS_OUT > 0
|
||||
float * y[NUM_ALL_CHANNELS_OUT];
|
||||
float *y[NUM_ALL_CHANNELS_OUT];
|
||||
#else
|
||||
float ** y;
|
||||
float **y;
|
||||
#endif
|
||||
#if PARAMETERS_N > 0
|
||||
std::mutex mutex;
|
||||
float param_values[PARAMETERS_N];
|
||||
float param_values_prev[PARAMETERS_N];
|
||||
std::mutex mutex;
|
||||
float param_values[PARAMETERS_N];
|
||||
float param_values_prev[PARAMETERS_N];
|
||||
#endif
|
||||
#if NUM_MIDI_INPUTS > 0
|
||||
CFStringRef midiClientName = NULL;
|
||||
MIDIClientRef midiClient = NULL;
|
||||
CFStringRef midiInputName = NULL;
|
||||
MIDIPortRef midiPort = NULL;
|
||||
CFStringRef midiClientName = NULL;
|
||||
MIDIClientRef midiClient = NULL;
|
||||
CFStringRef midiInputName = NULL;
|
||||
MIDIPortRef midiPort = NULL;
|
||||
#define MIDIBUFFERLEN 1023
|
||||
uint8_t midiBuffer[MIDIBUFFERLEN];
|
||||
int midiBuffer_i = 0;
|
||||
uint8_t midiBuffer[MIDIBUFFERLEN];
|
||||
int midiBuffer_i = 0;
|
||||
#endif
|
||||
|
||||
static void data_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount) {
|
||||
@ -182,7 +182,7 @@ void (^midiReceiveBlock)(const MIDIEventList *evtlist, void *srcConnRefCon) = ^(
|
||||
continue;
|
||||
mutex.lock();
|
||||
if (midiBuffer_i < MIDIBUFFERLEN - 3) {
|
||||
midiBuffer[midiBuffer_i ] = t[2];
|
||||
midiBuffer[midiBuffer_i ] = t[2];
|
||||
midiBuffer[midiBuffer_i + 1] = t[1];
|
||||
midiBuffer[midiBuffer_i + 2] = t[0];
|
||||
midiBuffer_i += 3;
|
||||
@ -208,26 +208,26 @@ char audioStart() {
|
||||
deviceConfig = ma_device_config_init(ma_device_type_playback);
|
||||
#endif
|
||||
|
||||
deviceConfig.periodSizeInFrames = BLOCK_SIZE;
|
||||
deviceConfig.periods = 1;
|
||||
deviceConfig.performanceProfile = ma_performance_profile_low_latency;
|
||||
deviceConfig.noPreSilencedOutputBuffer = 1;
|
||||
deviceConfig.noClip = 0;
|
||||
deviceConfig.noDisableDenormals = 0;
|
||||
deviceConfig.noFixedSizedCallback = 1;
|
||||
deviceConfig.dataCallback = data_callback;
|
||||
deviceConfig.capture.pDeviceID = NULL;
|
||||
deviceConfig.capture.format = ma_format_f32;
|
||||
deviceConfig.capture.channels = NUM_CHANNELS_IN;
|
||||
deviceConfig.capture.shareMode = ma_share_mode_shared;
|
||||
deviceConfig.playback.pDeviceID = NULL;
|
||||
deviceConfig.playback.format = ma_format_f32;
|
||||
deviceConfig.periodSizeInFrames = BLOCK_SIZE;
|
||||
deviceConfig.periods = 1;
|
||||
deviceConfig.performanceProfile = ma_performance_profile_low_latency;
|
||||
deviceConfig.noPreSilencedOutputBuffer = 1;
|
||||
deviceConfig.noClip = 0;
|
||||
deviceConfig.noDisableDenormals = 0;
|
||||
deviceConfig.noFixedSizedCallback = 1;
|
||||
deviceConfig.dataCallback = data_callback;
|
||||
deviceConfig.capture.pDeviceID = NULL;
|
||||
deviceConfig.capture.format = ma_format_f32;
|
||||
deviceConfig.capture.channels = NUM_CHANNELS_IN;
|
||||
deviceConfig.capture.shareMode = ma_share_mode_shared;
|
||||
deviceConfig.playback.pDeviceID = NULL;
|
||||
deviceConfig.playback.format = ma_format_f32;
|
||||
#if NUM_CHANNELS_IN + NUM_CHANNELS_OUT > 0
|
||||
deviceConfig.playback.channels = NUM_CHANNELS_OUT;
|
||||
deviceConfig.playback.channels = NUM_CHANNELS_OUT;
|
||||
#else
|
||||
deviceConfig.playback.channels = 1; // Fake & muted
|
||||
deviceConfig.playback.channels = 1; // Fake & muted
|
||||
#endif
|
||||
deviceConfig.playback.shareMode = ma_share_mode_shared;
|
||||
deviceConfig.playback.shareMode = ma_share_mode_shared;
|
||||
|
||||
if (ma_device_init(NULL, &deviceConfig, &device) != MA_SUCCESS)
|
||||
return false;
|
||||
@ -260,10 +260,10 @@ char audioStart() {
|
||||
#endif
|
||||
|
||||
plugin_callbacks cbs = {
|
||||
/* .handle = */ NULL,
|
||||
/* .format = */ "ios",
|
||||
/* .get_bindir = */ NULL,
|
||||
/* .get_datadir = */ NULL
|
||||
/* .handle = */ NULL,
|
||||
/* .format = */ "ios",
|
||||
/* .get_bindir = */ NULL,
|
||||
/* .get_datadir = */ NULL
|
||||
};
|
||||
plugin_init(&instance, &cbs);
|
||||
|
||||
|
@ -19,19 +19,19 @@
|
||||
*/
|
||||
|
||||
typedef struct plugin {
|
||||
float sample_rate;
|
||||
size_t delay_line_length;
|
||||
float sample_rate;
|
||||
size_t delay_line_length;
|
||||
|
||||
float gain;
|
||||
float delay;
|
||||
float cutoff;
|
||||
char bypass;
|
||||
float gain;
|
||||
float delay;
|
||||
float cutoff;
|
||||
char bypass;
|
||||
|
||||
float * delay_line;
|
||||
size_t delay_line_cur;
|
||||
float z1;
|
||||
float cutoff_k;
|
||||
float yz1;
|
||||
float *delay_line;
|
||||
size_t delay_line_cur;
|
||||
float z1;
|
||||
float cutoff_k;
|
||||
float yz1;
|
||||
} plugin;
|
||||
|
||||
static void plugin_init(plugin *instance, plugin_callbacks *cbs) {
|
||||
|
Loading…
Reference in New Issue
Block a user