Skip to content

Commit

Permalink
Thomas Gulde pointed out that if the order in the setup
Browse files Browse the repository at this point in the history
command is less than the max order then the output
is zero. That's fixed now in that if the order is lower
that the remaining biquads are now initialised as the
identity operation.
It would be better to actually run the loop only
through the biquads which have proper coefficients
but that's not accessible because of the template
mess. Would require a lot of re-writing to merge
memory and coefficient classes.
  • Loading branch information
berndporr committed Mar 2, 2020
1 parent 09afb2e commit d3af503
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
endif()

if(${CMAKE_VERSION} VERSION_LESS "3.0.0")
set(PROJECT_VERSION 1.7.6)
set(PROJECT_VERSION 1.7.7)
project(iir)
else()
cmake_policy(SET CMP0048 NEW) # set VERSION in project()
project(iir VERSION 1.7.6 LANGUAGES CXX)
project(iir VERSION 1.7.7 LANGUAGES CXX)
endif()
include(GNUInstallDirs)
add_subdirectory(test)
Expand Down
12 changes: 6 additions & 6 deletions iir/Biquad.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ namespace Iir {
void applyScale (double scale);

public:
double m_a0;
double m_a1;
double m_a2;
double m_b1;
double m_b2;
double m_b0;
double m_a0 = 1;
double m_a1 = 0;
double m_a2 = 0;
double m_b1 = 0;
double m_b2 = 0;
double m_b0 = 1;
};

//------------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions iir/Cascade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ namespace Iir {
throw std::invalid_argument("Number of stages is larger than the max stages.");

Biquad* stage = m_stageArray;
for (int i = 0; i < m_maxStages; ++i, ++stage)
stage->setIdentity();

stage = m_stageArray;
for (int i = 0; i < m_numStages; ++i, ++stage)
stage->setPoleZeroPair (proto[i]);

Expand Down

0 comments on commit d3af503

Please sign in to comment.