aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wdatutil.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/wdatutil.c b/src/wdatutil.c
index a6f5bd3..a549c26 100644
--- a/src/wdatutil.c
+++ b/src/wdatutil.c
@@ -1,6 +1,6 @@
/*
Code to generate wavedata for bandlimited waveforms.
- Copyright 2011 David Robillard
+ Copyright 2011-2014 David Robillard
Copyright 2003 Mike Rawes
This is free software: you can redistribute it and/or modify it
@@ -241,6 +241,17 @@ wavedata_generate_tables(Wavedata* w,
}
}
+static void
+wavedata_write_prototype(FILE* wdat_fp,
+ const char* data_name)
+{
+ fprintf(wdat_fp, "int\n");
+ fprintf(
+ wdat_fp,
+ "blop_get_%s (Wavedata * w, double sample_rate, const char* bundle_path, const LV2_Feature* const* features)",
+ data_name);
+}
+
int
wavedata_write(Wavedata* w,
FILE* wdat_fp,
@@ -262,6 +273,11 @@ wavedata_write(Wavedata* w,
fprintf(wdat_fp, "#include \"wavedata.h\"\n");
fprintf(wdat_fp, "\n");
/*
+ * Function prototype
+ */
+ wavedata_write_prototype(wdat_fp, data_name);
+ fprintf(wdat_fp, ";\n\n");
+ /*
* Fixed data and tables
*/
fprintf(wdat_fp, "unsigned long ref_count = 0;\n");
@@ -324,12 +340,8 @@ wavedata_write(Wavedata* w,
* Function to get Wavedata - the sample rate is needed to calculate
* frequencies and related things
*/
- fprintf(wdat_fp, "int\n");
- fprintf(
- wdat_fp,
- "blop_get_%s (Wavedata * w, double sample_rate, const char* bundle_path, const LV2_Feature* const* features)\n",
- data_name);
- fprintf(wdat_fp, "{\n");
+ wavedata_write_prototype(wdat_fp, data_name);
+ fprintf(wdat_fp, "\n{\n");
fprintf(wdat_fp, "\tWavetable * t;\n");
fprintf(wdat_fp, "\tunsigned long ti;\n");
fprintf(wdat_fp, "\n");
@@ -408,7 +420,7 @@ wavedata_write(Wavedata* w,
* _init()
* Assemble tables and lookup
*/
- fprintf(wdat_fp, "void\n");
+ fprintf(wdat_fp, "static void\n");
fprintf(wdat_fp, "__attribute__ ((constructor))\n");
fprintf(wdat_fp, "init (void)\n");
fprintf(wdat_fp, "{\n");