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/main.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/main.cpp')
-rw-r--r-- | synth/main.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/synth/main.cpp b/synth/main.cpp index 95444cb..1c8dd4c 100644 --- a/synth/main.cpp +++ b/synth/main.cpp @@ -12,6 +12,7 @@ #include "programs.h" #include "defines.h" #include "globals.h" +#include "note_loader.h" using namespace std; @@ -106,6 +107,23 @@ int main(int argc, char** argv) try { program_settings[i]=parse(programfile[i]); + + // try to load the appropriate .so file + if (access( (programfile[i]+".so").c_str(), R_OK ) == 0) + { + try + { + load_note_from_so(programfile[i]+".so", program_settings[i]); + output_verbose("NOTE: loaded shared object for program '"+programfile[i]+"'"); + } + catch (string err) + { + output_note("NOTE: could not load shared object '"+programfile[i]+".so"+"':\n" + " "+err+"\n" + " this is not fatal, the note has been loaded properly, but generic\n" + " unoptimized (slow) code will be used."); + } + } } catch (string err) { @@ -121,7 +139,9 @@ int main(int argc, char** argv) } } - + for (i=0;i<N_WAVEFORMS;i++) + wave[i]=new fixed_t[WAVE_RES]; + for (i=0;i<WAVE_RES;i++) { wave[0][i]=sin(i*2.0*3.141592654/WAVE_RES)*ONE; @@ -165,6 +185,9 @@ void cleanup() channel[i]=NULL; } + for (int i=0;i<128;i++) + maybe_unload_note(program_settings[i]); + delete [] program_settings; } |