Skip to content

Commit

Permalink
WindowOscillator with tables > 1024 (#1172)
Browse files Browse the repository at this point in the history
The window oscillator had an assumption that tables <= 1024 size
and then intermixed with the 1024 interpolation tables. Now
tables can be 2048 or 4096 we have to assume that either is
bigger to get large tables working.

Closes #1170
  • Loading branch information
baconpaul authored Sep 15, 2019
1 parent 5d2b133 commit 7d2277e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/common/dsp/WindowOscillator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,27 @@ void WindowOscillator::ProcessSubOscs(bool stereo)
const unsigned int M0Mask = 0x07f8;
unsigned int SizeMask = (oscdata->wt.size << 16) - 1;
unsigned int SizeMaskWin = (storage->WindowWT.size << 16) - 1;
unsigned int WindowVsWavePO2 = storage->WindowWT.size_po2 - oscdata->wt.size_po2;


unsigned char Window = limit_range(oscdata->p[2].val.i, 0, 8);

int Table = limit_range(
(int)(float)(oscdata->wt.n_tables * localcopy[oscdata->p[0].param_id_in_scene].f), 0,
(int)oscdata->wt.n_tables - 1);
int FormantMul =
(int)(float)(65536.f * storage->note_to_pitch_tuningctr(localcopy[oscdata->p[1].param_id_in_scene].f));
FormantMul = std::max(FormantMul >> WindowVsWavePO2, 1);

// We can actually get input tables bigger than the convolution table
int WindowVsWavePO2 = storage->WindowWT.size_po2 - oscdata->wt.size_po2;
if( WindowVsWavePO2 < 0 )
{
FormantMul = std::max(FormantMul << -WindowVsWavePO2, 1);
}
else
{
FormantMul = std::max(FormantMul >> WindowVsWavePO2, 1);
}

{
// SSE2 path
for (int so = 0; so < ActiveSubOscs; so++)
Expand Down

0 comments on commit 7d2277e

Please sign in to comment.