samples need to be accumulated at each call of HandleInt
special processing should start the scheduling Before fix some signals containing a harmonic of FREQ/16 would producing peaks at all harmonics of FREQ/16.
This commit is contained in:
parent
bcc3347893
commit
2c8a022aca
|
@ -199,11 +199,17 @@ static void HandleInt( int16_t sample )
|
||||||
Swhichoctaveplace ++;
|
Swhichoctaveplace ++;
|
||||||
Swhichoctaveplace &= BINCYCLE-1;
|
Swhichoctaveplace &= BINCYCLE-1;
|
||||||
|
|
||||||
|
for( i = 0; i < OCTAVES;i++ )
|
||||||
|
{
|
||||||
|
Saccum_octavebins[i] += sample;
|
||||||
|
}
|
||||||
|
|
||||||
if( oct > 128 )
|
if( oct > 128 )
|
||||||
{
|
{
|
||||||
//Special: This is when we can update everything.
|
//Special: This is when we can update everything.
|
||||||
//This gets run one out of every 1/(1<<OCTAVES) times.
|
//This gets run once out of every (1<<OCTAVES) times.
|
||||||
//It handles updating part of the DFT.
|
//It handles updating part of the DFT.
|
||||||
|
//It should happen at the very first call to HandleInit
|
||||||
int32_t * bins = &Sdatspace32B[0];
|
int32_t * bins = &Sdatspace32B[0];
|
||||||
int32_t * binsOut = &Sdatspace32BOut[0];
|
int32_t * binsOut = &Sdatspace32BOut[0];
|
||||||
|
|
||||||
|
@ -221,12 +227,6 @@ static void HandleInt( int16_t sample )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for( i = 0; i < OCTAVES;i++ )
|
|
||||||
{
|
|
||||||
Saccum_octavebins[i] += sample;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t * dsA = &Sdatspace32A[oct*FIXBPERO*2];
|
uint16_t * dsA = &Sdatspace32A[oct*FIXBPERO*2];
|
||||||
int32_t * dsB = &Sdatspace32B[oct*FIXBPERO*2];
|
int32_t * dsB = &Sdatspace32B[oct*FIXBPERO*2];
|
||||||
|
|
||||||
|
@ -252,11 +252,12 @@ int SetupDFTProgressive32()
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
Sdonefirstrun = 1;
|
Sdonefirstrun = 1;
|
||||||
|
Sdo_this_octave[0] = 0xff;
|
||||||
for( i = 0; i < BINCYCLE; i++ )
|
for( i = 0; i < BINCYCLE-1; i++ )
|
||||||
{
|
{
|
||||||
// Sdo_this_octave =
|
// Sdo_this_octave =
|
||||||
// 4 3 4 2 4 3 4 ...
|
// 255 4 3 4 2 4 3 4 1 4 3 4 2 4 3 4 0 4 3 4 2 4 3 4 1 4 3 4 2 4 3 4 is case for 5 octaves.
|
||||||
|
// Initial state is special one, then at step i do octave = Sdo_this_octave with averaged samples from last update of that octave
|
||||||
//search for "first" zero
|
//search for "first" zero
|
||||||
|
|
||||||
for( j = 0; j <= OCTAVES; j++ )
|
for( j = 0; j <= OCTAVES; j++ )
|
||||||
|
@ -271,7 +272,7 @@ int SetupDFTProgressive32()
|
||||||
#endif
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
Sdo_this_octave[i] = OCTAVES-j-1;
|
Sdo_this_octave[i+1] = OCTAVES-j-1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue