updated all templates + not using math.h in example
This commit is contained in:
parent
efd6033c4b
commit
aa9597b5c2
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Tibia
|
||||
*
|
||||
* Copyright (C) 2024 Orastron Srl unipersonale
|
||||
* Copyright (C) 2024, 2025 Orastron Srl unipersonale
|
||||
*
|
||||
* Tibia is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -83,3 +83,7 @@ static struct {
|
||||
#endif
|
||||
|
||||
#define JNI_FUNC(x) Java_{{=it.android.javaPackageName.replaceAll("_", "_1").replaceAll(".", "_")}}_MainActivity_##x
|
||||
|
||||
{{?it.product.state && it.product.state.dspCustom}}
|
||||
#define STATE_DSP_CUSTOM
|
||||
{{?}}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Tibia
|
||||
*
|
||||
* Copyright (C) 2023, 2024 Orastron Srl unipersonale
|
||||
* Copyright (C) 2023-2025 Orastron Srl unipersonale
|
||||
*
|
||||
* Tibia is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -189,6 +189,10 @@ JNIEXPORT jboolean JNICALL
|
||||
JNI_FUNC(nativeAudioStart)(JNIEnv* env, jobject thiz) {
|
||||
(void)env;
|
||||
(void)thiz;
|
||||
#ifdef STATE_DSP_CUSTOM
|
||||
(void)plugin_state_load;
|
||||
(void)plugin_state_save;
|
||||
#endif
|
||||
|
||||
#if NUM_CHANNELS_IN + NUM_CHANNELS_OUT > 0
|
||||
# if NUM_CHANNELS_IN == 0
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Tibia
|
||||
*
|
||||
* Copyright (C) 2024 Orastron Srl unipersonale
|
||||
* Copyright (C) 2024, 2025 Orastron Srl unipersonale
|
||||
*
|
||||
* Tibia is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -83,3 +83,7 @@ static struct {
|
||||
{{~}}
|
||||
};
|
||||
#endif
|
||||
|
||||
{{?it.product.state && it.product.state.dspCustom}}
|
||||
#define STATE_DSP_CUSTOM
|
||||
{{?}}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Tibia
|
||||
*
|
||||
* Copyright (C) 2024 Orastron Srl unipersonale
|
||||
* Copyright (C) 2024, 2025 Orastron Srl unipersonale
|
||||
*
|
||||
* Tibia is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -162,6 +162,11 @@ float clampf(float x, float m, float M) {
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
#ifdef STATE_DSP_CUSTOM
|
||||
(void)plugin_state_load;
|
||||
(void)plugin_state_save;
|
||||
#endif
|
||||
|
||||
#if PARAMETERS_N > 0
|
||||
for (size_t i = 0; i < PARAMETERS_N; i++)
|
||||
param_values[i] = param_data[i].def;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Tibia
|
||||
*
|
||||
* Copyright (C) 2024 Orastron Srl unipersonale
|
||||
* Copyright (C) 2024, 2025 Orastron Srl unipersonale
|
||||
*
|
||||
* Tibia is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -98,3 +98,7 @@ static int midi_cc_maps[NUM_PARAMETERS] = { {{~it.daisy_seed.midiCCMaps :p}}{{=p
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
{{?it.product.state && it.product.state.dspCustom}}
|
||||
#define STATE_DSP_CUSTOM
|
||||
{{?}}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Tibia
|
||||
*
|
||||
* Copyright (C) 2023, 2024 Orastron Srl unipersonale
|
||||
* Copyright (C) 2023-2025 Orastron Srl unipersonale
|
||||
*
|
||||
* Tibia is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -150,6 +150,11 @@ static void AudioCallback(
|
||||
}
|
||||
|
||||
int main() {
|
||||
#ifdef STATE_DSP_CUSTOM
|
||||
(void)plugin_state_load;
|
||||
(void)plugin_state_save;
|
||||
#endif
|
||||
|
||||
hardware.Configure();
|
||||
hardware.Init();
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Tibia
|
||||
*
|
||||
* Copyright (C) 2024 Orastron Srl unipersonale
|
||||
* Copyright (C) 2024, 2025 Orastron Srl unipersonale
|
||||
*
|
||||
* Tibia is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -81,3 +81,7 @@ static struct {
|
||||
{{~}}
|
||||
};
|
||||
#endif
|
||||
|
||||
{{?it.product.state && it.product.state.dspCustom}}
|
||||
#define STATE_DSP_CUSTOM
|
||||
{{?}}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Tibia
|
||||
*
|
||||
* Copyright (C) 2023, 2024 Orastron Srl unipersonale
|
||||
* Copyright (C) 2023-2025 Orastron Srl unipersonale
|
||||
*
|
||||
* Tibia is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -190,6 +190,11 @@ void (^midiReceiveBlock)(const MIDIEventList *evtlist, void *srcConnRefCon) = ^(
|
||||
|
||||
extern "C"
|
||||
char audioStart() {
|
||||
#ifdef STATE_DSP_CUSTOM
|
||||
(void)plugin_state_load;
|
||||
(void)plugin_state_save;
|
||||
#endif
|
||||
|
||||
#if NUM_CHANNELS_IN + NUM_CHANNELS_OUT > 0
|
||||
# if NUM_CHANNELS_IN == 0
|
||||
deviceConfig = ma_device_config_init(ma_device_type_playback);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Tibia
|
||||
*
|
||||
* Copyright (C) 2024 Orastron Srl unipersonale
|
||||
* Copyright (C) 2024, 2025 Orastron Srl unipersonale
|
||||
*
|
||||
* Tibia is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -44,3 +44,7 @@ static size_t param_out_index[DATA_PRODUCT_PARAMETERS_OUTPUT_N] = {
|
||||
{{~it.product.parameters :p:i}}{{?p.direction == "output"}}{{=i}}, {{?}}{{~}}
|
||||
};
|
||||
#endif
|
||||
|
||||
{{?it.product.state && it.product.state.dspCustom}}
|
||||
#define DATA_STATE_DSP_CUSTOM
|
||||
{{?}}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Tibia
|
||||
*
|
||||
* Copyright (C) 2022-2024 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022-2025 Orastron Srl unipersonale
|
||||
*
|
||||
* Tibia is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -46,6 +46,11 @@ typedef struct {
|
||||
} instance;
|
||||
|
||||
instance * processor_new(float sample_rate) {
|
||||
#ifdef DATA_STATE_DSP_CUSTOM
|
||||
(void)plugin_state_load;
|
||||
(void)plugin_state_save;
|
||||
#endif
|
||||
|
||||
instance * i = malloc(sizeof(instance));
|
||||
if (i == NULL)
|
||||
return NULL;
|
||||
|
@ -19,7 +19,6 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
|
||||
typedef struct plugin {
|
||||
float sample_rate;
|
||||
@ -154,6 +153,12 @@ static int plugin_state_save(plugin *instance, const plugin_state_callbacks *cbs
|
||||
return cbs->write(cbs->handle, (const char *)data, 13);
|
||||
}
|
||||
|
||||
static char x_isnan(float x) {
|
||||
union { uint32_t u; float f; } v;
|
||||
v.f = x;
|
||||
return ((v.u & 0x7f800000) == 0x7f800000) && (v.u & 0x7fffff);
|
||||
}
|
||||
|
||||
static int plugin_state_load(const plugin_state_callbacks *cbs, const char *data, size_t length) {
|
||||
if (length != 13)
|
||||
return -1;
|
||||
@ -162,7 +167,7 @@ static int plugin_state_load(const plugin_state_callbacks *cbs, const char *data
|
||||
const float delay = parse_float(d + 4);
|
||||
const float cutoff = parse_float(d + 8);
|
||||
const float bypass = d[12] ? 1.f : 0.f;
|
||||
if (isnan(gain) || isnan(delay) || isnan(cutoff))
|
||||
if (x_isnan(gain) || x_isnan(delay) || x_isnan(cutoff))
|
||||
return -1;
|
||||
cbs->lock(cbs->handle);
|
||||
cbs->set_parameter(cbs->handle, plugin_parameter_gain, gain);
|
||||
|
Loading…
Reference in New Issue
Block a user