diff options
author | Florian Jung <flo@thinkpad.(none)> | 2011-01-09 19:09:05 +0100 |
---|---|---|
committer | Florian Jung <flo@thinkpad.(none)> | 2011-01-09 19:09:05 +0100 |
commit | df97e0ebb7f6591c50f3a588cb2a74901d38ac4a (patch) | |
tree | aa68ab5a73388d57636a4e5c9058b9dcc0f21e90 /synth/note_skel.cpp | |
parent | aa1c06213e695be1dcb5980b638d8ce81efb4f51 (diff) |
Merged branch for compiled notes
The synthesizer is now able to load and use compiled, optimized shared
objects of programs. There's also a note-compiler which creates the code
for such objects.
TODO:
- let the note-compiler automatically compile OR rename it to
code-emitter
Diffstat (limited to 'synth/note_skel.cpp')
-rw-r--r-- | synth/note_skel.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/synth/note_skel.cpp b/synth/note_skel.cpp new file mode 100644 index 0000000..b028ca4 --- /dev/null +++ b/synth/note_skel.cpp @@ -0,0 +1,74 @@ +#include <cmath> + +#include "note_skel.h" +#include "globals.h" +#include "defines.h" + +using namespace std; + +NoteSkel::NoteSkel() +{ +} + +NoteSkel::~NoteSkel() +{ + +} + +void NoteSkel::set_pitchbend(fixed_t pb) +{ + pitchbend=pb; +} + +void NoteSkel::set_freq(float f) +{ + old_freq=freq; + dest_freq=f*ONE; + portamento_t=0; + + do_ksr(); +} + +void NoteSkel::set_freq(float f, bool do_port) +{ + set_freq(f); + + if (!do_port) + old_freq=dest_freq; +} + +void NoteSkel::set_note(int n) +{ + note=n; + set_freq(440.0*pow(2.0,(float)(n-69)/12.0)); +} + +void NoteSkel::set_note(int n, bool do_port) +{ + note=n; + set_freq(440.0*pow(2.0,(float)(n-69)/12.0), do_port); +} + +int NoteSkel::get_note() +{ + return note; +} + +void NoteSkel::set_vel(float v) +{ + vel=v*ONE; + + recalc_factors(); + apply_pfactor(); +} + +void NoteSkel::set_portamento_frames(jack_nframes_t t) +{ + portamento_frames=t; + portamento_t=0; +} + +int NoteSkel::get_program() +{ + return program; +} |