fixes
This commit is contained in:
parent
d0a0b32c67
commit
a811f2e390
1
TODO
1
TODO
@ -29,3 +29,4 @@
|
||||
* daisy-seed and android: isolate C part from C++
|
||||
* cmd help and version
|
||||
* common code... (eg buffer handling android ios cmd daisy-seed)?
|
||||
* cmd use midi to determine length in synths
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#if NUM_AUDIO_BUSES_IN + NUM_AUDIO_BUSES_OUT > 0
|
||||
static struct {
|
||||
size_t index;
|
||||
char out;
|
||||
char optional;
|
||||
char channels;
|
||||
@ -24,6 +25,7 @@ static struct {
|
||||
{{~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}}
|
||||
|
@ -239,7 +239,7 @@ JNI_FUNC(nativeAudioStart)(JNIEnv* env, jobject thiz) {
|
||||
if (audio_bus_data[i].out)
|
||||
continue;
|
||||
for (int l = 0; l < audio_bus_data[i].channels; l++, j++) {
|
||||
if (AUDIO_BUS_IN == i) {
|
||||
if (AUDIO_BUS_IN == audio_bus_data[i].index) {
|
||||
float * b = x_buf + BLOCK_SIZE * k;
|
||||
x[j] = b;
|
||||
x_in[l] = b;
|
||||
@ -261,7 +261,7 @@ JNI_FUNC(nativeAudioStart)(JNIEnv* env, jobject thiz) {
|
||||
if (!audio_bus_data[i].out)
|
||||
continue;
|
||||
for (int l = 0; l < audio_bus_data[i].channels; l++, j++) {
|
||||
if (AUDIO_BUS_OUT == i) {
|
||||
if (AUDIO_BUS_OUT == audio_bus_data[i].index) {
|
||||
y[j] = y_buf + BLOCK_SIZE * k;
|
||||
y_out[l] = y[j];
|
||||
k++;
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#if NUM_AUDIO_BUSES_IN + NUM_AUDIO_BUSES_OUT > 0
|
||||
static struct {
|
||||
size_t index;
|
||||
char out;
|
||||
char optional;
|
||||
char channels;
|
||||
@ -24,6 +25,7 @@ static struct {
|
||||
{{~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}}
|
||||
|
@ -315,7 +315,7 @@ int main(int argc, char * argv[]) {
|
||||
printf(" fs: %g\n", fs);
|
||||
printf(" bufsize: %zu\n", bufsize);
|
||||
#if NUM_CHANNELS_IN > 0
|
||||
printf(" length: %g\n", (double)tw_in.numFramesInHeader / (double)tw_in.h.SampleRate);
|
||||
printf(" length: %g\n", (double)tw_in.numFramesInHeader / (double)fs);
|
||||
printf(" infile: %s\n", infile);
|
||||
#else
|
||||
printf(" length: %g\n", length);
|
||||
@ -375,7 +375,7 @@ int main(int argc, char * argv[]) {
|
||||
if (audio_bus_data[i].out)
|
||||
continue;
|
||||
for (int l = 0; l < audio_bus_data[i].channels; l++, j++) {
|
||||
if (AUDIO_BUS_IN == i) {
|
||||
if (AUDIO_BUS_IN == audio_bus_data[i].index) {
|
||||
float * b = x_buf + bufsize * k;
|
||||
x[j] = b;
|
||||
x_in[l] = b;
|
||||
@ -404,7 +404,7 @@ int main(int argc, char * argv[]) {
|
||||
if (!audio_bus_data[i].out)
|
||||
continue;
|
||||
for (int l = 0; l < audio_bus_data[i].channels; l++, j++) {
|
||||
if (AUDIO_BUS_OUT == i) {
|
||||
if (AUDIO_BUS_OUT == audio_bus_data[i].index) {
|
||||
y[j] = y_buf + bufsize * k;
|
||||
y_out[l] = y[j];
|
||||
k++;
|
||||
@ -468,7 +468,7 @@ int main(int argc, char * argv[]) {
|
||||
#if NUM_CHANNELS_IN > 0
|
||||
size_t len = tw_in.numFramesInHeader;
|
||||
#else
|
||||
size_t len = (size_t)(tw_in.h.SampleRate * length + 0.5f);
|
||||
size_t len = (size_t)(fs * length + 0.5f);
|
||||
#endif
|
||||
while (i < len) {
|
||||
size_t left = len - i;
|
||||
@ -512,7 +512,7 @@ int main(int argc, char * argv[]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
midi_next -= 1e6 * ((double)n / (double)tw_in.h.SampleRate);
|
||||
midi_next -= 1e6 * ((double)n / (double)fs);
|
||||
#endif
|
||||
|
||||
plugin_process(&instance, x, y, n);
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#if NUM_AUDIO_BUSES_IN + NUM_AUDIO_BUSES_OUT > 0
|
||||
static struct {
|
||||
size_t index;
|
||||
char out;
|
||||
char optional;
|
||||
char channels;
|
||||
@ -22,6 +23,7 @@ static struct {
|
||||
{{~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}}
|
||||
|
@ -47,7 +47,7 @@ float * y[NUM_ALL_CHANNELS_OUT];
|
||||
float ** y;
|
||||
#endif
|
||||
|
||||
#if NUM_ADC >= 0
|
||||
#if NUM_PARAMETERS > 0
|
||||
static float clampf(float x, float m, float M) {
|
||||
return x < m ? m : (x > M ? M : x);
|
||||
}
|
||||
@ -71,7 +71,9 @@ static float parameterAdjust(int i, float v) {
|
||||
static void setParameter(int i, float v) {
|
||||
plugin_set_parameter(&instance, i, parameterAdjust(i, v));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NUM_ADC > 0
|
||||
static void readADCs() {
|
||||
for (int i = 0, j = 0; i < NUM_PARAMETERS; i++) {
|
||||
if (param_data[i].out || param_data[i].pin < 0)
|
||||
@ -90,7 +92,9 @@ static void AudioCallback(
|
||||
loadMeter.OnBlockStart();
|
||||
#endif
|
||||
|
||||
#if NUM_ADC > 0
|
||||
readADCs();
|
||||
#endif
|
||||
|
||||
const size_t n = size >> 1;
|
||||
#if NUM_CHANNELS_IN > 0
|
||||
@ -128,7 +132,7 @@ int main() {
|
||||
hardware.Configure();
|
||||
hardware.Init();
|
||||
|
||||
#if NUM_ADC >= 0
|
||||
#if NUM_ADC > 0
|
||||
AdcChannelConfig adcConfig[NUM_ADC];
|
||||
for (int i = 0, j = 0; i < NUM_PARAMETERS; i++) {
|
||||
if (param_data[i].out || param_data[i].pin < 0)
|
||||
@ -163,7 +167,7 @@ int main() {
|
||||
loadMeter.Init(sample_rate, BLOCK_SIZE);
|
||||
#endif
|
||||
|
||||
#if NUM_ADC >= 0
|
||||
#if NUM_ADC > 0
|
||||
readADCs();
|
||||
#endif
|
||||
plugin_reset(&instance);
|
||||
@ -173,7 +177,7 @@ int main() {
|
||||
if (audio_bus_data[i].out)
|
||||
continue;
|
||||
for (int l = 0; l < audio_bus_data[i].channels; l++, j++) {
|
||||
if (AUDIO_BUS_IN == i) {
|
||||
if (AUDIO_BUS_IN == audio_bus_data[i].index) {
|
||||
float * b = x_buf + BLOCK_SIZE * k;
|
||||
x[j] = b;
|
||||
x_in[l] = b;
|
||||
@ -195,7 +199,7 @@ int main() {
|
||||
if (!audio_bus_data[i].out)
|
||||
continue;
|
||||
for (int l = 0; l < audio_bus_data[i].channels; l++, j++) {
|
||||
if (AUDIO_BUS_OUT == i) {
|
||||
if (AUDIO_BUS_OUT == audio_bus_data[i].index) {
|
||||
y[j] = y_buf + BLOCK_SIZE * k;
|
||||
y_out[l] = y[j];
|
||||
k++;
|
||||
@ -236,8 +240,8 @@ int main() {
|
||||
case ControlChange:
|
||||
# if NUM_PARAMETERS > 0 && HAS_MIDI_CC_MAPS
|
||||
for (int i = 0; i < NUM_PARAMETERS; i++)
|
||||
if (midi_cc_maps[i] == data[1]) {
|
||||
setParameter(i, (1.f / 127.f) * data[2]);
|
||||
if (midi_cc_maps[i] == ev.data[0]) {
|
||||
setParameter(i, parameterMap(i, (1.f / 127.f) * ev.data[1]));
|
||||
goto loopNext;
|
||||
}
|
||||
# endif
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#if NUM_AUDIO_BUSES_IN + NUM_AUDIO_BUSES_OUT > 0
|
||||
static struct {
|
||||
size_t index;
|
||||
char out;
|
||||
char optional;
|
||||
char channels;
|
||||
@ -24,6 +25,7 @@ static struct {
|
||||
{{~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}}
|
||||
|
@ -265,7 +265,7 @@ char audioStart() {
|
||||
if (audio_bus_data[i].out)
|
||||
continue;
|
||||
for (int l = 0; l < audio_bus_data[i].channels; l++, j++) {
|
||||
if (AUDIO_BUS_IN == i) {
|
||||
if (AUDIO_BUS_IN == audio_bus_data[i].index) {
|
||||
float * b = x_buf + BLOCK_SIZE * k;
|
||||
x[j] = b;
|
||||
x_in[l] = b;
|
||||
@ -287,7 +287,7 @@ char audioStart() {
|
||||
if (!audio_bus_data[i].out)
|
||||
continue;
|
||||
for (int l = 0; l < audio_bus_data[i].channels; l++, j++) {
|
||||
if (AUDIO_BUS_OUT == i) {
|
||||
if (AUDIO_BUS_OUT == audio_bus_data[i].index) {
|
||||
y[j] = y_buf + BLOCK_SIZE * k;
|
||||
y_out[l] = y[j];
|
||||
k++;
|
||||
|
@ -217,7 +217,17 @@ static void run(LV2_Handle instance, uint32_t sample_count) {
|
||||
}
|
||||
#endif
|
||||
|
||||
plugin_process(&i->p, i->x, i->y, sample_count);
|
||||
#if DATA_PRODUCT_AUDIO_INPUT_CHANNELS_N > 0
|
||||
const float ** x = i->x;
|
||||
#else
|
||||
const float ** x = NULL;
|
||||
#endif
|
||||
#if DATA_PRODUCT_AUDIO_OUTPUT_CHANNELS_N > 0
|
||||
float ** y = i-> y;
|
||||
#else
|
||||
float ** y = NULL;
|
||||
#endif
|
||||
plugin_process(&i->p, x, y, sample_count);
|
||||
|
||||
#if DATA_PRODUCT_CONTROL_OUTPUTS_N > 0
|
||||
for (uint32_t j = 0; j < DATA_PRODUCT_CONTROL_OUTPUTS_N; j++) {
|
||||
|
@ -63,7 +63,7 @@ typedef struct pluginInstance {
|
||||
const float * inputs[DATA_PRODUCT_CHANNELS_AUDIO_INPUT_N];
|
||||
#endif
|
||||
#if DATA_PRODUCT_CHANNELS_AUDIO_OUTPUT_N > 0
|
||||
float * outputs[DATA_PRODUCT_CHANNELS_AUDIO_INPUT_N];
|
||||
float * outputs[DATA_PRODUCT_CHANNELS_AUDIO_OUTPUT_N];
|
||||
#endif
|
||||
#if DATA_PRODUCT_BUSES_AUDIO_INPUT_N > 0
|
||||
char inputsActive[DATA_PRODUCT_BUSES_AUDIO_INPUT_N];
|
||||
@ -452,6 +452,8 @@ static Steinberg_tresult pluginSetBusArrangements(void* thisInterface, Steinberg
|
||||
if ((busInfoAudioInput[i].channelCount == 1 && inputs[i] != Steinberg_Vst_SpeakerArr_kMono)
|
||||
|| (busInfoAudioInput[i].channelCount == 2 && inputs[i] != Steinberg_Vst_SpeakerArr_kStereo))
|
||||
return Steinberg_kResultFalse;
|
||||
#else
|
||||
(void)inputs;
|
||||
#endif
|
||||
|
||||
#if DATA_PRODUCT_BUSES_AUDIO_OUTPUT_N > 0
|
||||
@ -459,6 +461,8 @@ static Steinberg_tresult pluginSetBusArrangements(void* thisInterface, Steinberg
|
||||
if ((busInfoAudioOutput[i].channelCount == 1 && outputs[i] != Steinberg_Vst_SpeakerArr_kMono)
|
||||
|| (busInfoAudioOutput[i].channelCount == 2 && outputs[i] != Steinberg_Vst_SpeakerArr_kStereo))
|
||||
return Steinberg_kResultFalse;
|
||||
#else
|
||||
(void)outputs;
|
||||
#endif
|
||||
|
||||
return Steinberg_kResultTrue;
|
||||
|
@ -91,7 +91,7 @@ static void plugin_process(plugin *instance, const float **inputs, float **outpu
|
||||
|
||||
static void plugin_midi_msg_in(plugin *instance, size_t index, const uint8_t * data) {
|
||||
(void)index;
|
||||
if ((data[0] & 0xf0) && (data[2] != 0))
|
||||
if ((data[0] & 0xf0 == 0x90) && (data[2] != 0))
|
||||
//approx instance->cutoff_k = powf(2.f, (1.f / 12.f) * (note - 60));
|
||||
instance->cutoff_k = data[1] < 64 ? (-0.19558034980097166f * data[1] - 2.361735109225749f) / (data[1] - 75.57552349522389f) : (393.95397927344214f - 7.660826245588588f * data[1]) / (data[1] - 139.0755234952239f);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user