summaryrefslogtreecommitdiff
path: root/note_compiler/templates
diff options
context:
space:
mode:
Diffstat (limited to 'note_compiler/templates')
-rw-r--r--note_compiler/templates/ctor.foot11
-rw-r--r--note_compiler/templates/get_sample.123
-rw-r--r--note_compiler/templates/head.135
-rw-r--r--note_compiler/templates/head.211
4 files changed, 80 insertions, 0 deletions
diff --git a/note_compiler/templates/ctor.foot b/note_compiler/templates/ctor.foot
new file mode 100644
index 0000000..05d4421
--- /dev/null
+++ b/note_compiler/templates/ctor.foot
@@ -0,0 +1,11 @@
+ portamento_frames=0;
+ set_portamento_frames(pf);
+
+ set_note(n);
+ freq=dest_freq;
+ set_vel(v);
+
+ pitchbend=pb;
+
+ program=prg_no;
+}
diff --git a/note_compiler/templates/get_sample.1 b/note_compiler/templates/get_sample.1
new file mode 100644
index 0000000..3d73052
--- /dev/null
+++ b/note_compiler/templates/get_sample.1
@@ -0,0 +1,23 @@
+fixed_t Note::get_sample()
+{
+ if (freq!=dest_freq)
+ {
+ // the div.by.zero if p_frames=0 is avoided because then the
+ // if-condition below is always true
+ if (portamento_t>=portamento_frames)
+ freq=dest_freq;
+ else //will only happen if p_t < p_frames -> p_frames is always > 0 -> div. ok
+ freq = old_freq + (dest_freq-old_freq)*portamento_t/portamento_frames;
+
+ do_ksl();
+
+ portamento_t++;
+ }
+
+ fixed_t actual_freq=freq*pitchbend >>SCALE;
+
+ fixed_t *temp;
+ temp=old_oscval; //swap the current and old oscval-pointers
+ old_oscval=oscval;
+ oscval=temp;
+
diff --git a/note_compiler/templates/head.1 b/note_compiler/templates/head.1
new file mode 100644
index 0000000..3d9e903
--- /dev/null
+++ b/note_compiler/templates/head.1
@@ -0,0 +1,35 @@
+#include <jack/jack.h>
+
+#include <cmath>
+
+#include "globals.h"
+#include "defines.h"
+#include "programs.h"
+#include "envelope.h"
+#include "fixed.h"
+#include "filter.h"
+#include "note_skel.h"
+
+using namespace std;
+
+class Note : public NoteSkel
+{
+ public:
+ Note(int n, float v,program_t &prg, jack_nframes_t pf, fixed_t pb, int prg_no);
+ ~Note();
+ fixed_t get_sample();
+
+ void release_quickly(jack_nframes_t maxt);
+ void release();
+ void reattack();
+ bool still_active();
+ void set_param(const parameter_t &p, fixed_t v);
+
+ private:
+ void do_ksl();
+ void do_ksr();
+
+ void recalc_factors();
+ void apply_pfactor();
+
+// member variables begin here
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);
+}
+