Browse files

Merge branch 'upstream'

  • Loading branch information...
2 parents 0e00222 + 3f03ce5 commit 3966557e957a95599bb3b138fc49f818d1099a26 Jeremy Salwen committed Jan 4, 2011
Showing with 11 additions and 19 deletions.
  1. +6 −3 so-404.c
  2. +3 −13 so-kl5.c
  3. +1 −2 so-kl5.h
  4. +1 −1 so-kl5.ttl
View
9 so-404.c
@@ -38,9 +38,9 @@ void runSO_404( LV2_Handle arg, uint32_t nframes ) {
if( so->noteson == 0 )
{
so->freq = so->tfreq;
+ so->amp = ((float)evt[2])/127.0;
+ so->cdelay = 0;
}
- so->amp = ((float)evt[2])/127.0;
- so->cdelay = 0;
so->noteson += 1;
}
else if((evt[0]&MIDI_COMMANDMASK)==MIDI_NOTEOFF ) {
@@ -77,7 +77,10 @@ void runSO_404( LV2_Handle arg, uint32_t nframes ) {
if( so->cdelay <= 0 )
{
so->freq = ((so->portamento/127.0)*0.9)*so->freq + (1.0-((so->portamento/127.0)*0.9))*so->tfreq;
- so->amp *= 0.8+(so->release/127.0)/5.1;
+ if( so->noteson > 0 )
+ so->amp *= 0.8+(so->release/127.0)/5.1;
+ else
+ so->amp *= 0.5;
so->fcutoff = powf(so->cutoff/127.0,5.0)+so->amp*so->amp*powf(so->envmod/128.0,2.0);
if( so->fcutoff > 1.0 ) {
so->fcutoff = 1.0;
View
16 so-kl5.c
@@ -117,7 +117,7 @@ void runSO_kl5( LV2_Handle arg, uint32_t nframes ) {
so->fcutoff = (cutoff+5.0)/400.0;
} else if( evt[1]== 71 ) {
unsigned int resonance = evt[2];
- so->freso = (resonance/160.0)*(1.0-so->fcutoff);
+ so->freso = (resonance/140.0)*(1.0-so->fcutoff);
} else if( evt[1]== 73 ) {
unsigned int attack = evt[2];
so->sattack = (attack+5.0)/800.0;
@@ -146,7 +146,7 @@ void runSO_kl5( LV2_Handle arg, uint32_t nframes ) {
strings[note][stringpos[note]] = strings[note][stringpos[note]]*damp +
strings[note][stringlength[note]-1]*(1.0-damp);
- damp = ((float)note/(float)NUMNOTES)*0.009999;
+ damp = ((float)note/(float)NUMNOTES)*0.0049995 + 0.0049995;
if( status[note] == 0 )
strings[note][stringpos[note]] *= 0.8+so->ssustain*0.19+damp;
@@ -156,16 +156,8 @@ void runSO_kl5( LV2_Handle arg, uint32_t nframes ) {
sample += strings[note][stringpos[note]];
}
- so->hpval += (sample-(so->hplast)) * 0.00001;
- so->hplast += so->hpval;
- so->hpval *= 0.96;
- sample -= so->hplast;
-
for( note=0; note<NUMNOTES; note++ )
{
- damp = 1.0-((float)note/(float)NUMNOTES);
- strings[note][stringpos[note]] += sample*damp*0.001;
-
if( fabs( strings[note][stringpos[note]] ) <= 0.00001 )
strings[note][stringpos[note]] = 0.0;
@@ -209,8 +201,6 @@ LV2_Handle instantiateSO_kl5(const LV2_Descriptor *descriptor,double s_rate, con
so->lplast=0;
so->lpval=0;
- so->hplast=0;
- so->hpval=0;
so->fcutoff = (cutoff+5.0)/400.0;
so->sattack = (attack+5.0)/800.0;
@@ -220,7 +210,7 @@ LV2_Handle instantiateSO_kl5(const LV2_Descriptor *descriptor,double s_rate, con
int note;
for( note=0; note<NUMNOTES; note++ ) {
float freq = 440.0*powf( 2.0, (note+BASENOTE-69) / 12.0 );
- so->stringcutoff[note] = 0.3 + powf( (float)note / (float)NUMNOTES, 0.5 ) * 0.65;
+ so->stringcutoff[note] = 0.5 + pow( (double)note / (double)NUMNOTES, 0.5 ) * 0.45;
int length = round( (float)s_rate / freq );
so->stringlength[note] = length;
so->strings[note] = malloc( length * sizeof( float ) );
View
3 so-kl5.h
@@ -85,10 +85,9 @@ typedef struct so_kl5_t {
unsigned int volume;
float lpval, lplast;
- float hpval, hplast;
float fcutoff, freso, ssustain,sattack;
float* channel_p;
float* tempstring;
-} so_kl5;
+} so_kl5;
View
2 so-kl5.ttl
@@ -51,7 +51,7 @@
lv2:name "Filter Resonance";
lv2:default 0.625;
lv2:minimum 0;
- lv2:maximum 0.793;
+ lv2:maximum 0.907;
],[
a lv2:InputPort;
a lv2:ControlPort;

0 comments on commit 3966557

Please sign in to comment.