Skip to content

Commit

Permalink
Made the pointer to the biquads constant so that they can't be modified.
Browse files Browse the repository at this point in the history
  • Loading branch information
berndporr committed Dec 11, 2024
1 parent 789e4fd commit 05af7d2
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions iir/Cascade.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ namespace Iir {
**/
struct IIR_EXPORT Storage
{
int maxStages = 0;
Biquad* stageArray = nullptr;
Storage(const int maxNumBiquads, Biquad* const biquadArray) : maxStages(maxNumBiquads), stageArray(biquadArray) {}
const int maxStages = 0;
Biquad* const stageArray = nullptr;
};

/**
Expand Down Expand Up @@ -166,10 +167,8 @@ namespace Iir {
**/
const Cascade::Storage getCascadeStorage()
{
Cascade::Storage s;
s.maxStages = MaxStages;
s.stageArray = m_stages;
return s;
const Cascade::Storage s(MaxStages, m_stages);
return s;
}

private:
Expand Down

0 comments on commit 05af7d2

Please sign in to comment.