summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO7
-rw-r--r--note_compiler/parser.cpp6
-rw-r--r--note_compiler/plugin_factory/Makefile2
-rw-r--r--note_compiler/plugin_factory/infile.cpp109
-rw-r--r--synth/Makefile2
5 files changed, 89 insertions, 37 deletions
diff --git a/TODO b/TODO
index a86f48f..e031b3f 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,12 @@
TODO für den synth
o .so unloaden!
+ o note-compiler: wenn vel_influence für foo, aber foo ist konstant
+ null, bleibt foo trotzdem konstant.
+ o note-compiler: vel_influence ist IMMER gegeben für output, außer
+ wenn anders angegeben
+ o note-compiler: *1 bzw /2 optimierungen klappen nicht?
+ o note-compiler: pfactor nicht wegoptimieren, immer verwenden
+ o beide parser: envelopes von oscs mit out=0 standardmäßig deaktivieren
o envelope, filter, ggf. auch alles aus program.o im hauptprogramm
lassen? d.h. via init funktionspointer übergeben oder virtuelle
interfaceklassen benutzen (für envelope/filter z.B.)
diff --git a/note_compiler/parser.cpp b/note_compiler/parser.cpp
index 3f142bd..17c197f 100644
--- a/note_compiler/parser.cpp
+++ b/note_compiler/parser.cpp
@@ -23,7 +23,7 @@ void init_oscs(int n_osc, oscillator_t *osc)
}
osc[i].output=0;
- osc[i].output_const=true;
+ osc[i].output_const=false; //TODO FINDMICH war true
osc[i].waveform=0;
osc[i].waveform_const=true;
osc[i].factor=ONE;
@@ -39,6 +39,8 @@ void init_oscs(int n_osc, oscillator_t *osc)
osc[i].have_custom_wave=false;
osc[i].sync=false;
osc[i].sync_const=true;
+ osc[i].ksr_const=true;
+ osc[i].ksl_const=true;
}
}
@@ -124,7 +126,7 @@ program_t parse(string fn)
fixed_t sync_factor=0;
bool sync_factor_const=true;
- bool use_pfactor=false;
+ bool use_pfactor=true; //TODO FINDMICH war false
char buf[2000];
string line;
diff --git a/note_compiler/plugin_factory/Makefile b/note_compiler/plugin_factory/Makefile
index 5446327..c99645d 100644
--- a/note_compiler/plugin_factory/Makefile
+++ b/note_compiler/plugin_factory/Makefile
@@ -1,5 +1,5 @@
CXX=g++
-CFLAGS=-Wall -fpic -O2
+CFLAGS=-Wall -fpic -O2 -pg
CXXFLAGS=$(CFLAGS)
LDFLAGS=-shared -fpic -Wl,-soname,libmystuff.so.1 -lc
diff --git a/note_compiler/plugin_factory/infile.cpp b/note_compiler/plugin_factory/infile.cpp
index f8e34a0..147aec0 100644
--- a/note_compiler/plugin_factory/infile.cpp
+++ b/note_compiler/plugin_factory/infile.cpp
@@ -48,13 +48,17 @@ class Note : public NoteSkel
// member variables begin here
Envelope *env0;
- Envelope *env1;
+ //envelope1 is unused
+ //envelope2 is unused
+ //envelope3 is unused
fixed_t *oscval;
fixed_t *old_oscval;
oscillator_t osc0;
oscillator_t osc1;
+ oscillator_t osc2;
+ oscillator_t osc3;
//sync is disabled
@@ -65,6 +69,8 @@ class Note : public NoteSkel
{
oscillator_t osc0;
oscillator_t osc1;
+ oscillator_t osc2;
+ oscillator_t osc3;
//filter is disabled
} orig;
// member variables end here
@@ -83,27 +89,35 @@ Note::Note(int n, float v, program_t &prg, jack_nframes_t pf, fixed_t pb, int pr
{
curr_prg=&prg;
- oscval=new fixed_t[2];
- old_oscval=new fixed_t[2];
- for (int i=0;i<2;i++)
+ oscval=new fixed_t[4];
+ old_oscval=new fixed_t[4];
+ for (int i=0;i<4;i++)
oscval[i]=old_oscval[i]=0;
- pfactor.out=new fixed_t [2];
- pfactor.fm=new fixed_t* [2];
- for (int i=0;i<2;i++)
- pfactor.fm[i]=new fixed_t [2];
+ pfactor.out=new fixed_t [4];
+ pfactor.fm=new fixed_t* [4];
+ for (int i=0;i<4;i++)
+ pfactor.fm[i]=new fixed_t [4];
env0=new Envelope (prg.env_settings[0]);
- env1=new Envelope (prg.env_settings[1]);
+ //envelope1 is disabled
+ //envelope2 is disabled
+ //envelope3 is disabled
osc0=prg.osc_settings[0];
orig.osc0=prg.osc_settings[0];
osc1=prg.osc_settings[1];
orig.osc1=prg.osc_settings[1];
+ osc2=prg.osc_settings[2];
+ orig.osc2=prg.osc_settings[2];
+ osc3=prg.osc_settings[3];
+ orig.osc3=prg.osc_settings[3];
//initalize oscillator.phase to multiples of their wave resolution
osc0.phase=ONE * PHASE_INIT;
osc1.phase=ONE * PHASE_INIT;
+ osc2.phase=ONE * PHASE_INIT;
+ osc3.phase=ONE * PHASE_INIT;
do_ksl();
@@ -127,9 +141,17 @@ Note::~Note()
delete pfactor.fm[0];
delete [] osc1.fm_strength;
- delete env1;
+ //envelope1 is disabled
delete pfactor.fm[1];
+ delete [] osc2.fm_strength;
+ //envelope2 is disabled
+ delete pfactor.fm[2];
+
+ delete [] osc3.fm_strength;
+ //envelope3 is disabled
+ delete pfactor.fm[3];
+
delete [] oscval;
delete [] old_oscval;
@@ -144,28 +166,36 @@ void Note::destroy()
void Note::recalc_factors()
{
- for (int i=0;i<2;i++)
+ for (int i=0;i<4;i++)
{
pfactor.out[i]=calc_pfactor(curr_prg->pfactor.out[i], vel);
- for (int j=0;j<2;j++)
+ for (int j=0;j<4;j++)
pfactor.fm[i][j]=calc_pfactor(curr_prg->pfactor.fm[i][j], vel);
}
}
void Note::apply_pfactor()
{
osc0.output=orig.osc0.output*pfactor.out[0] >>SCALE;
- for (int i=0;i<2;i++)
+ for (int i=0;i<4;i++)
osc0.fm_strength[i]=orig.osc0.fm_strength[i]*pfactor.fm[0][i] >>SCALE;
osc1.output=orig.osc1.output*pfactor.out[1] >>SCALE;
- for (int i=0;i<2;i++)
+ for (int i=0;i<4;i++)
osc1.fm_strength[i]=orig.osc1.fm_strength[i]*pfactor.fm[1][i] >>SCALE;
+ osc2.output=orig.osc2.output*pfactor.out[2] >>SCALE;
+ for (int i=0;i<4;i++)
+ osc2.fm_strength[i]=orig.osc2.fm_strength[i]*pfactor.fm[2][i] >>SCALE;
+ osc3.output=orig.osc3.output*pfactor.out[3] >>SCALE;
+ for (int i=0;i<4;i++)
+ osc3.fm_strength[i]=orig.osc3.fm_strength[i]*pfactor.fm[3][i] >>SCALE;
}
bool Note::still_active()
{
if ( ((osc0.output>0) && (env0->still_active()))
- || ((osc1.output>0) && (env1->still_active())) )
+ /* envelope1 is disabled */
+ /* envelope2 is disabled */
+ /* envelope3 is disabled */ )
return true;
else
return false;
@@ -173,7 +203,9 @@ bool Note::still_active()
void Note::release()
{
env0->release_key();
- env1->release_key();
+ //envelope1 is disabled
+ //envelope2 is disabled
+ //envelope3 is disabled
}
void Note::release_quickly(jack_nframes_t maxt)
{
@@ -181,28 +213,30 @@ void Note::release_quickly(jack_nframes_t maxt)
env0->set_release(maxt);
env0->release_key();
- if (env1->get_release() > maxt)
- env1->set_release(maxt);
- env1->release_key();
+ //envelope1 is disabled
+
+ //envelope2 is disabled
+
+ //envelope3 is disabled
}
void Note::reattack()
{
env0->reattack();
- env1->reattack();
+ //envelope1 is disabled
+ //envelope2 is disabled
+ //envelope3 is disabled
}
void Note::do_ksr()
{
env0->set_ratefactor(1.0 / pow(freq>>SCALE, osc0.ksr));
- env1->set_ratefactor(1.0 / pow(freq>>SCALE, osc1.ksr));
+ //envelope1 is disabled
+ //envelope2 is disabled
+ //envelope3 is disabled
}
void Note::do_ksl()
{
- double tempfreq=double ( freq >> SCALE );
-
- env0->set_max( ( (osc0.ksl==0) ? ONE : ( fixed_t(double(ONE) / pow(tempfreq, osc0.ksl)) ) ) );
- env1->set_max( ( (osc1.ksl==0) ? ONE : ( fixed_t(double(ONE) / pow(tempfreq, osc1.ksl)) ) ) );
}
fixed_t Note::get_sample()
@@ -232,16 +266,23 @@ fixed_t Note::get_sample()
//sync is disabled
- osc0.phase+= ( (osc0.vibrato_depth==0) ? ((actual_freq*osc0.factor/samp_rate)>>SCALE) : (( (curr_lfo[osc0.vibrato_lfo][osc0.vibrato_depth]*actual_freq >>SCALE)*osc0.factor/samp_rate)>>SCALE) );
- oscval[0] = wave[1][ ( ( osc0.phase + ( + (old_oscval[0] * 104857) + (old_oscval[1] * osc0.fm_strength[1]) >>SCALE ) ) * WAVE_RES >>SCALE ) % WAVE_RES ] * env0->get_level() >>SCALE;
- if (osc0.tremolo_depth)
- oscval[0] = oscval[0] * curr_lfo[0][osc0.tremolo_depth] >>SCALE;
+ osc0.phase+= (actual_freq*osc0.factor/samp_rate)>>SCALE;
+ oscval[0] = wave[0][ ( ( osc0.phase + ( + (old_oscval[1]) ) ) * WAVE_RES >>SCALE ) % WAVE_RES ] * env0->get_level() >>SCALE;
+ //oscillator0 has no tremolo
- osc1.phase+= ( (curr_lfo[osc1.vibrato_lfo][osc1.vibrato_depth]*actual_freq >>SCALE)*osc1.factor/samp_rate)>>SCALE;
- oscval[1] = wave[0][ ( osc1.phase * WAVE_RES >>SCALE ) % WAVE_RES ] * env1->get_level() >>SCALE;
+ osc1.phase+= (actual_freq*osc1.factor/samp_rate)>>SCALE;
+ oscval[1] = wave[0][ ( ( osc1.phase + ( + (old_oscval[2] /2) ) ) * WAVE_RES >>SCALE ) % WAVE_RES ];
//oscillator1 has no tremolo
- fixed_t out = ( + osc0.output*oscval[0] >>SCALE );
+ osc2.phase+= (actual_freq*osc2.factor/samp_rate)>>SCALE;
+ oscval[2] = wave[0][ ( ( osc2.phase + ( + (old_oscval[3] * 209715) >>SCALE ) ) * WAVE_RES >>SCALE ) % WAVE_RES ];
+ //oscillator2 has no tremolo
+
+ osc3.phase+= (actual_freq*osc3.factor/samp_rate)>>SCALE;
+ oscval[3] = wave[0][ ( osc3.phase * WAVE_RES >>SCALE ) % WAVE_RES ];
+ //oscillator3 has no tremolo
+
+ fixed_t out = ( + osc0.output*oscval[0] + osc1.output*oscval[1] + osc2.output*oscval[2] + osc3.output*oscval[3] >>SCALE );
@@ -256,7 +297,9 @@ void Note::set_param(const parameter_t &p, fixed_t v)
switch (p.osc)
{
case 0: sel_osc=&osc0; sel_env=env0; break;
- case 1: sel_osc=&osc1; sel_env=env1; break;
+ case 1: sel_osc=&osc1; /* envelope1 is disabled */ break;
+ case 2: sel_osc=&osc2; /* envelope2 is disabled */ break;
+ case 3: sel_osc=&osc3; /* envelope3 is disabled */ break;
default: output_note("NOTE: trying to change the nonexistent oscillator"+IntToStr(p.osc));
}
diff --git a/synth/Makefile b/synth/Makefile
index c1d6dab..8007339 100644
--- a/synth/Makefile
+++ b/synth/Makefile
@@ -1,5 +1,5 @@
CXX=g++
-CFLAGS=-Wall -O2
+CFLAGS=-Wall -O2 -pg
CXXFLAGS=$(CFLAGS)
LDFLAGS=-lm `pkg-config --cflags --libs jack`