Skip to content

Commit cebb2fb

Browse files
authored
Merge pull request #26 from mike919192/rename2
Rename coeff functions
2 parents 223b3e4 + cdb8cc9 commit cebb2fb

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

include/sdsp/casc2orderIIR.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ class casc_2o_IIR_lp : casc_2o_IIR_base<M> {
294294
}
295295
}
296296

297-
void set_coeff(double f0, double fs, double gainIn = 1.0)
297+
void set_lp_coeff(double f0, double fs, double gainIn = 1.0)
298298
{
299299
this->gain = gainIn;
300300

@@ -352,7 +352,7 @@ class casc_2o_IIR_hp : casc_2o_IIR_base<M> {
352352
}
353353
}
354354

355-
void set_coeff(double f0, double fs, double gainIn = 1.0)
355+
void set_hp_coeff(double f0, double fs, double gainIn = 1.0)
356356
{
357357
this->gain = gainIn;
358358

@@ -410,7 +410,7 @@ class casc_2o_IIR_bp : casc_2o_IIR_base<M> {
410410
}
411411
}
412412

413-
void set_coeff(double f0, double fs, double Q, double gainIn = 1.0)
413+
void set_bp_coeff(double f0, double fs, double Q, double gainIn = 1.0)
414414
{
415415
double q2{ 2 * Q };
416416
this->gain = gainIn;

test/testIIR.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ TEST_CASE("LP compile time filter test")
232232
sdsp::casc_2o_IIR_lp<4> df;
233233

234234
if (fType == sdsp::FilterType::LowPass) {
235-
df.set_coeff(f0, fs);
235+
df.set_lp_coeff(f0, fs);
236236
} else {
237237
throw std::runtime_error("Unknown filter type");
238238
}
@@ -278,10 +278,10 @@ TEST_CASE("LP compile time filter test")
278278
impulse2.at(0) = 1.0;
279279

280280
sdsp::casc_2o_IIR_lp<4> df;
281-
df.set_coeff(f0, fs);
281+
df.set_lp_coeff(f0, fs);
282282

283283
sdsp::casc_2o_IIR_lp<4> df2;
284-
df2.set_coeff(f0, fs, 2.0);
284+
df2.set_lp_coeff(f0, fs, 2.0);
285285

286286
df.process(impulse1.begin(), impulse1.end());
287287
df2.process(impulse2.begin(), impulse2.end());
@@ -313,7 +313,7 @@ TEST_CASE("HP compile time filter test")
313313
sdsp::casc_2o_IIR_hp<4> df;
314314

315315
if (fType == sdsp::FilterType::HighPass) {
316-
df.set_coeff(f0, fs);
316+
df.set_hp_coeff(f0, fs);
317317
} else {
318318
throw std::runtime_error("Unknown filter type");
319319
}
@@ -359,10 +359,10 @@ TEST_CASE("HP compile time filter test")
359359
impulse2.at(0) = 1.0;
360360

361361
sdsp::casc_2o_IIR_hp<4> df;
362-
df.set_coeff(f0, fs);
362+
df.set_hp_coeff(f0, fs);
363363

364364
sdsp::casc_2o_IIR_hp<4> df2;
365-
df2.set_coeff(f0, fs, 2.0);
365+
df2.set_hp_coeff(f0, fs, 2.0);
366366

367367
df.process(impulse1.begin(), impulse1.end());
368368
df2.process(impulse2.begin(), impulse2.end());
@@ -394,7 +394,7 @@ TEST_CASE("BP compile time filter test")
394394
sdsp::casc_2o_IIR_bp<4> df;
395395

396396
if (fType == sdsp::FilterType::BandPass) {
397-
df.set_coeff(f0, fs, Q);
397+
df.set_bp_coeff(f0, fs, Q);
398398
} else {
399399
throw std::runtime_error("Unknown filter type");
400400
}
@@ -441,10 +441,10 @@ TEST_CASE("BP compile time filter test")
441441
impulse2.at(0) = 1.0;
442442

443443
sdsp::casc_2o_IIR_bp<4> df;
444-
df.set_coeff(f0, fs, Q);
444+
df.set_bp_coeff(f0, fs, Q);
445445

446446
sdsp::casc_2o_IIR_bp<4> df2;
447-
df2.set_coeff(f0, fs, Q, 2.0);
447+
df2.set_bp_coeff(f0, fs, Q, 2.0);
448448

449449
df.process(impulse1.begin(), impulse1.end());
450450
df2.process(impulse2.begin(), impulse2.end());
@@ -474,7 +474,7 @@ TEST_CASE("Filter benchmarks")
474474
df.set_lp_coeff(f0, fs);
475475

476476
sdsp::casc_2o_IIR_lp<4> df2;
477-
df2.set_coeff(f0, fs);
477+
df2.set_lp_coeff(f0, fs);
478478

479479
std::array<double, 4096> data{ 0.0 };
480480
data.at(0) = 1.0;
@@ -505,7 +505,7 @@ TEST_CASE("Filter benchmarks")
505505
df.set_hp_coeff(f0, fs);
506506

507507
sdsp::casc_2o_IIR_hp<4> df2;
508-
df2.set_coeff(f0, fs);
508+
df2.set_hp_coeff(f0, fs);
509509

510510
std::array<double, 4096> data{ 0.0 };
511511
data.at(0) = 1.0;
@@ -536,7 +536,7 @@ TEST_CASE("Filter benchmarks")
536536
df.set_bp_coeff(f0, fs, Q);
537537

538538
sdsp::casc_2o_IIR_bp<4> df2;
539-
df2.set_coeff(f0, fs, Q);
539+
df2.set_bp_coeff(f0, fs, Q);
540540

541541
std::array<double, 4096> data{ 0.0 };
542542
data.at(0) = 1.0;

0 commit comments

Comments
 (0)