oscillator detune
This commit is contained in:
parent
cbae7610e6
commit
20ae092592
4
knob.h
4
knob.h
@ -9,15 +9,19 @@
|
||||
#define K_OSC1_VOL 2
|
||||
#define K_OSC1_WAVEF 3
|
||||
#define K_OSC1_PHASE 4
|
||||
#define K_OSC1_DET 22
|
||||
#define K_OSC2_VOL 5
|
||||
#define K_OSC2_WAVEF 6
|
||||
#define K_OSC2_PHASE 7
|
||||
#define K_OSC2_DET 23
|
||||
#define K_OSC3_VOL 8
|
||||
#define K_OSC3_WAVEF 9
|
||||
#define K_OSC3_PHASE 10
|
||||
#define K_OSC3_DET 24
|
||||
#define K_OSC4_VOL 11
|
||||
#define K_OSC4_WAVEF 12
|
||||
#define K_OSC4_PHASE 13
|
||||
#define K_OSC4_DET 25
|
||||
#define K_HP 14
|
||||
#define K_LP 15
|
||||
#define K_AENV_ATK 16
|
||||
|
15
main.c
15
main.c
@ -113,21 +113,25 @@ int main(void)
|
||||
create_knob(knobs+K_OSC1_VOL,"",x,y);++total_knobs;
|
||||
create_knob(knobs+K_OSC1_WAVEF,"",x+=knob_space,y);++total_knobs;
|
||||
create_knob(knobs+K_OSC1_PHASE,"Phs",x+=knob_space,y);++total_knobs;
|
||||
create_knob(knobs+K_OSC1_DET,"Fine",x+=knob_space,y);++total_knobs;
|
||||
|
||||
x=152+12;
|
||||
create_knob(knobs+K_OSC2_VOL,"",x,y);++total_knobs;
|
||||
create_knob(knobs+K_OSC2_WAVEF,"",x+=knob_space,y);++total_knobs;
|
||||
create_knob(knobs+K_OSC2_PHASE,"Phs",x+=knob_space,y);++total_knobs;
|
||||
create_knob(knobs+K_OSC2_DET,"Fine",x+=knob_space,y);++total_knobs;
|
||||
|
||||
x=152*2+12;
|
||||
create_knob(knobs+K_OSC3_VOL,"",x,y);++total_knobs;
|
||||
create_knob(knobs+K_OSC3_WAVEF,"",x+=knob_space,y);++total_knobs;
|
||||
create_knob(knobs+K_OSC3_PHASE,"Phs",x+=knob_space,y);++total_knobs;
|
||||
create_knob(knobs+K_OSC3_DET,"Fine",x+=knob_space,y);++total_knobs;
|
||||
|
||||
x=152*3+12;
|
||||
create_knob(knobs+K_OSC4_VOL,"",x,y);++total_knobs;
|
||||
create_knob(knobs+K_OSC4_WAVEF,"",x+=knob_space,y);++total_knobs;
|
||||
create_knob(knobs+K_OSC4_PHASE,"Phs",x+=knob_space,y);++total_knobs;
|
||||
create_knob(knobs+K_OSC4_DET,"Fine",x+=knob_space,y);++total_knobs;
|
||||
|
||||
x=0+12;
|
||||
y=148+90;
|
||||
@ -157,13 +161,15 @@ int main(void)
|
||||
knobs[K_OSC##o##_PHASE].value=ph;\
|
||||
knobs[K_OSC##o##_PHASE].def_value=ph;\
|
||||
knobs[K_OSC##o##_WAVEF].format=K_FMT_WAV;\
|
||||
knobs[K_OSC##o##_DET].maxval=2.0;\
|
||||
knobs[K_OSC##o##_DET].minval=-2.0;\
|
||||
}while(0)
|
||||
knobs[K_AMP].value=0.4;
|
||||
knobs[K_AMP].def_value=0.4;
|
||||
knobs[K_AMP].maxval=2.0;
|
||||
knobs[K_LIM].value=1.0;
|
||||
knobs[K_LIM].def_value=1.0;
|
||||
knobs[K_LIM].maxval=2.0;
|
||||
knobs[K_LIM].maxval=1.0;
|
||||
/* knobs[K_LIM].format=K_FMT_HEX; */
|
||||
knobs[K_AENV_ATK].value=0.0125;
|
||||
knobs[K_AENV_ATK].def_value=0.0125;
|
||||
@ -184,6 +190,8 @@ int main(void)
|
||||
knobs[K_OSC2_VOL].maxval=1.5;
|
||||
knobs[K_OSC3_VOL].maxval=1.5;
|
||||
knobs[K_OSC4_VOL].maxval=1.5;
|
||||
|
||||
|
||||
#undef create_osc
|
||||
|
||||
}
|
||||
@ -399,6 +407,7 @@ int main(void)
|
||||
uint32_t oscillator_vol[]={K_OSC1_VOL,K_OSC2_VOL,K_OSC3_VOL,K_OSC4_VOL};
|
||||
uint32_t oscillator_wavef[]={K_OSC1_WAVEF,K_OSC2_WAVEF,K_OSC3_WAVEF,K_OSC4_WAVEF};
|
||||
uint32_t oscillator_duty[]={K_OSC1_PHASE,K_OSC2_PHASE,K_OSC3_PHASE,K_OSC4_PHASE};
|
||||
uint32_t oscillator_det[]={K_OSC1_DET,K_OSC2_DET,K_OSC3_DET,K_OSC4_DET};
|
||||
|
||||
// Oscillators
|
||||
for(size_t cur_osc=0;cur_osc<4;++cur_osc)
|
||||
@ -413,6 +422,7 @@ int main(void)
|
||||
float amp=knobs[K_AMP].value*knobs[oscillator_vol[cur_osc]].value;
|
||||
float fr=(knobs[K_FREQ].value/knobs[K_FREQ].maxval)*4000.0;
|
||||
fr+=SEMITONE(fr,knobs[K_DET].value);
|
||||
fr+=SEMITONE(fr,knobs[oscillator_det[cur_osc]].value);
|
||||
float duty=knobs[oscillator_duty[cur_osc]].value;
|
||||
bool mix=cur_osc>0&&knobs[oscillator_vol[cur_osc-1]].value>0;
|
||||
if(fr==0.0)break;
|
||||
@ -425,6 +435,7 @@ int main(void)
|
||||
float amp=knobs[K_AMP].value*knobs[oscillator_vol[cur_osc]].value;
|
||||
float fr=(knobs[K_FREQ].value/knobs[K_FREQ].maxval)*4000.0;
|
||||
fr+=SEMITONE(fr,knobs[K_DET].value);
|
||||
fr+=SEMITONE(fr,knobs[oscillator_det[cur_osc]].value);
|
||||
float duty=knobs[oscillator_duty[cur_osc]].value;
|
||||
bool mix=cur_osc>0&&knobs[oscillator_vol[cur_osc-1]].value>0;
|
||||
if(fr==0.0)break;
|
||||
@ -437,6 +448,7 @@ int main(void)
|
||||
float amp=knobs[K_AMP].value*knobs[oscillator_vol[cur_osc]].value;
|
||||
float fr=(knobs[K_FREQ].value/knobs[K_FREQ].maxval)*4000.0/2.0;
|
||||
fr+=SEMITONE(fr,knobs[K_DET].value);
|
||||
fr+=SEMITONE(fr,knobs[oscillator_det[cur_osc]].value);
|
||||
float duty=knobs[oscillator_duty[cur_osc]].value;
|
||||
bool mix=cur_osc>0&&knobs[oscillator_vol[cur_osc-1]].value>0;
|
||||
if(fr==0.0)break;
|
||||
@ -449,6 +461,7 @@ int main(void)
|
||||
float amp=knobs[K_AMP].value*knobs[oscillator_vol[cur_osc]].value;
|
||||
float fr=(knobs[K_FREQ].value/knobs[K_FREQ].maxval)*4000.0;
|
||||
fr+=SEMITONE(fr,knobs[K_DET].value);
|
||||
fr+=SEMITONE(fr,knobs[oscillator_det[cur_osc]].value);
|
||||
bool mix=cur_osc>0&&knobs[oscillator_vol[cur_osc-1]].value>0;
|
||||
float duty=knobs[oscillator_duty[cur_osc]].value;
|
||||
if(fr==0.0)break;
|
||||
|
Loading…
Reference in New Issue
Block a user