aboutsummaryrefslogtreecommitdiffstats
path: root/src/wdatutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wdatutil.c')
-rw-r--r--src/wdatutil.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/wdatutil.c b/src/wdatutil.c
index 190e8f5..b6a9409 100644
--- a/src/wdatutil.c
+++ b/src/wdatutil.c
@@ -74,9 +74,7 @@ unsigned long wave_harmonic_intervals[] = {
};
Wavedata*
-wavedata_new(double sample_rate,
- const char* bundle_path,
- const LV2_Feature* const* features)
+wavedata_new(double sample_rate)
{
Wavedata* w;
@@ -97,7 +95,7 @@ wavedata_new(double sample_rate,
return w;
}
-static void
+void
wavedata_cleanup(Wavedata* w)
{
unsigned long ti;
@@ -180,7 +178,7 @@ wavedata_add_table(Wavedata* w,
return 0;
}
-static void
+void
wavedata_generate_tables(Wavedata* w,
Wavetype wavetype,
float gibbs_comp)
@@ -190,7 +188,6 @@ wavedata_generate_tables(Wavedata* w,
float* samples_hf;
unsigned long h_lf;
unsigned long h_hf;
- unsigned long s;
unsigned long i;
for (i = 0; i < w->table_count; i++) {
@@ -261,7 +258,7 @@ wavedata_write(Wavedata* w,
*/
table_count = w->table_count + 1;
- fprintf(wdat_fp, "#include "lv 2 / lv2plug.in / ns / lv2core / lv2.h "\n");
+ fprintf(wdat_fp, "#include \"lv2/lv2plug.in/ns/lv2core/lv2.h\"\n");
fprintf(wdat_fp, "#include <stdio.h>\n");
fprintf(wdat_fp, "#include \"wavedata.h\"\n");
fprintf(wdat_fp, "\n");
@@ -286,7 +283,7 @@ wavedata_write(Wavedata* w,
fprintf(wdat_fp, "static float samples_lf_%ld[%ld] = {\n", i, t->sample_count + 3);
column = 0;
- for (uint32_t s = 0; s < t->sample_count + 3 - 1; s++, column++) {
+ for (s = 0; s < t->sample_count + 3 - 1; s++, column++) {
if (column == 5) {
fprintf(wdat_fp, "\n");
column = 0;
@@ -305,7 +302,7 @@ wavedata_write(Wavedata* w,
fprintf(wdat_fp, "static float samples_hf_%ld[%ld] = {\n", i, t->sample_count + 3);
column = 0;
- for (uint32_t s = 0; s < t->sample_count + 3 - 1; s++, column++) {
+ for (s = 0; s < t->sample_count + 3 - 1; s++, column++) {
if (column == 5) {
fprintf(wdat_fp, "\n");
column = 0;
@@ -331,9 +328,7 @@ wavedata_write(Wavedata* w,
fprintf(wdat_fp, "int\n");
fprintf(
wdat_fp,
- "blip_get_%s (Wavedata * w, double sample_rate,
- const char* bundle_path,
- const LV2_Feature* const* features)\n" ,
+ "blip_get_%s (Wavedata * w, double sample_rate, const char* bundle_path, const LV2_Feature* const* features)\n",
data_name);
fprintf(wdat_fp, "{\n");
fprintf(wdat_fp, "\tWavetable * t;\n");
@@ -415,12 +410,12 @@ wavedata_write(Wavedata* w,
* Assemble tables and lookup
*/
fprintf(wdat_fp, "void\n");
- fprintf(wdat_fp, "_init (void)\n");
+ fprintf(wdat_fp, "__attribute__ ((constructor))\n");
+ fprintf(wdat_fp, "init (void)\n");
fprintf(wdat_fp, "{\n");
fprintf(wdat_fp, "\tunsigned long max_harmonic;\n");
fprintf(wdat_fp, "\tunsigned long ti;\n");
fprintf(wdat_fp, "\tunsigned long li;\n");
- fprintf(wdat_fp, "\tunsigned long s;\n");
fprintf(wdat_fp, "\n");
for (i = 0; i < w->table_count; i++) {
@@ -488,7 +483,7 @@ wavedata_write(Wavedata* w,
return 0;
}
-static void
+void
generate_sawtooth(float* samples,
uint32_t sample_count,
unsigned long harmonics,
@@ -547,7 +542,7 @@ generate_sawtooth(float* samples,
}
}
-static void
+void
generate_square(float* samples,
uint32_t sample_count,
unsigned long harmonics,
@@ -606,7 +601,7 @@ generate_square(float* samples,
}
}
-static void
+void
generate_parabola(float* samples,
uint32_t sample_count,
unsigned long harmonics,