summaryrefslogtreecommitdiff
path: root/note_compiler/templates/head.2
diff options
context:
space:
mode:
authorFlorian Jung <flo@thinkpad.(none)>2011-01-05 15:47:55 +0100
committerFlorian Jung <flo@thinkpad.(none)>2011-01-05 15:50:41 +0100
commit3d95a25600b5cab8a7e5245b7a581bd8c8939276 (patch)
treebe3c2d1b14dd309e48c4f541e67020fed47f5a6c /note_compiler/templates/head.2
parent5e731c349b63a557b2e705ce3cd741f90c62c694 (diff)
Note-compiler is _mostly_ complete; plus some tiny bugfixes
The note-compiler can read a program-definition and emits a cpp-file which implements that definition. This implementation is optimized. HOWEVER, the compiler still does not emit a set_param() function. this will lead to a linker error because the function is not implemented (but defined). After adding an empty implementation by hand the emitted compiles well, and also seems to work when used in the synth. TODO: - implement set_param() - compiler must emit a loader-function (which returns a new Note) - use that loader function in the synth
Diffstat (limited to 'note_compiler/templates/head.2')
-rw-r--r--note_compiler/templates/head.211
1 files changed, 11 insertions, 0 deletions
diff --git a/note_compiler/templates/head.2 b/note_compiler/templates/head.2
new file mode 100644
index 0000000..917030c
--- /dev/null
+++ b/note_compiler/templates/head.2
@@ -0,0 +1,11 @@
+// member variables end here
+};
+
+//this function returns the smallest phase_init possible for a
+//given custom_wave which is greater or equal than PHASE_INIT
+#define PHASE_INIT 100
+inline fixed_t init_custom_osc_phase(int len, fixed_t sr)
+{
+ return ( (fixed_t(ceil( float(PHASE_INIT) * sr / len / ONE )) *len << (2*SCALE)) / sr);
+}
+