Pārlūkot izejas kodu

fix updateCoefs(..) wasn't updating other coefficient sets

While trying to find why assigning more than one set of coefficients for
AudioFilterBiquad results in no output I discovered my check for flag
before updating other than 1st set of coefficients was flawed so I fixed
it.

I also modified the way 'data' is assigned so the assignment only occurs
once per set of coefficients, possibly not the most efficient but I like
it better than my previous method.

These changes don't appear to effect the use of AudioFilterBiquad for a
single set of coefficients and, unfortunately, it doesn't make it start
working either - implementation of a second (or more than one) set of
coefficients still results in output being silenced but the update to
updateCoefs(..) is necessary so I am committing it.
dds
robsoles pirms 11 gadiem
vecāks
revīzija
80155c9020
1 mainītis faili ar 3 papildinājumiem un 4 dzēšanām
  1. +3
    -4
      filter_biquad.cpp

+ 3
- 4
filter_biquad.cpp Parādīt failu

@@ -36,8 +36,7 @@ void AudioFilterBiquad::update(void)
int32_t *state;
block = receiveWritable();
if (!block) return;
data = (uint32_t *)(block->data);
end = data + AUDIO_BLOCK_SAMPLES/2;
end = (uint32_t *)(block->data) + AUDIO_BLOCK_SAMPLES/2;
state = (int32_t *)definition;
do {
a0 = *state++;
@@ -48,6 +47,7 @@ void AudioFilterBiquad::update(void)
aprev = *state++;
bprev = *state++;
sum = *state & 0x3FFF;
data = end - AUDIO_BLOCK_SAMPLES/2;
do {
in2 = *data;
sum = signed_multiply_accumulate_32x16b(sum, a0, in2);
@@ -72,7 +72,6 @@ void AudioFilterBiquad::update(void)
*state++ = sum | flag;
*(state-2) = bprev;
*(state-3) = aprev;
data = (uint32_t *)(block->data); // needs to be reset, may as well be done here
} while (flag);
transmit(block);
release(block);
@@ -84,7 +83,7 @@ void AudioFilterBiquad::updateCoefs(uint8_t set,int *source, bool doReset)
while(set)
{
*dest+=7;
if(!(*dest&0x80000000)) return;
if(!(*dest)&0x80000000) return;
*dest++;
set--;
}

Notiek ielāde…
Atcelt
Saglabāt