History

clip vzfilter freq on init; handling for 0 cfxlen in sampler

Matthew Wang committed 6 years ago

Commit d57d77b1 parent 24675fa2 files · +5 −5Browse files

Unified · Split

2 files
  1. leaf/Src/leaf-filters.c +1 −1
  2. leaf/Src/leaf-sampling.c +4 −4
leaf/Src/leaf-filters.c+1−1
@@ -1241,7 +1241,7 @@ void tVZFilter_initToPool (tVZFilter* const vf, VZFilterType type, float · 1240 unmodified lines
12411241
12421242 LEAF* leaf = f->mempool->leaf;
12431243
1244− f->fc = freq;
1244+ f->fc = LEAF_clip(0.0f, freq, 0.5f * leaf->sampleRate);
12451245 f->type = type;
12461246 f->G = ONE_OVER_SQRT2;
12471247 f->invG = 1.0f/ONE_OVER_SQRT2;
leaf/Src/leaf-sampling.c+4−4
@@ -383,7 +383,8 @@ float tSampler_tick (tSampler* const sp) · 382 unmodified lines
383383 buff[c3],
384384 buff[c4],
385385 alpha);
386− crossfadeMix = (float) offset / (float) cfxlen;
386+ if (cfxlen > 0.0f) crossfadeMix = (float) offset / (float) cfxlen;
387+ else crossfadeMix = 0.0f;
387388 }
388389
389390 float flipLength = fabsf(p->flipIdx - p->flipStart);
@@ -525,8 +526,6 @@ float tSampler_tick (tSampler* const sp) · 135 unmodified lines
525526 }
526527 }
527528
528−
529−
530529 p->last = sample;
531530
532531
@@ -705,7 +704,8 @@ float tSampler_tickStereo (tSampler* const sp, float* outputArray) · 172 unmodified lines
705704 buff[(f4 * p->channels) + 1],
706705 falpha);
707706
708− flipMix = (float) (cfxlen - flipLength) / (float) cfxlen;
707+ if (cfxlen > 0) flipMix = (float) (cfxlen - flipLength) / (float) cfxlen;
708+ else flipMix = 1.0f;
709709 }
710710 }
711711

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t