Skip to content

Commit 20e6904

Browse files
committed
AudioEffects
1 parent e4c8977 commit 20e6904

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/AudioEffects/AudioEffects.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace audio_tools {
2424

2525

2626
template <class GeneratorT>
27-
class AudioEffects : public GeneratorT {
27+
class AudioEffects : public SoundGenerator<effect_t> {
2828
public:
2929
/// Default constructor
3030
AudioEffects() = default;
@@ -57,6 +57,8 @@ class AudioEffects : public GeneratorT {
5757
void setInput(GeneratorT &in){
5858
LOGD(LOG_METHOD);
5959
generator_obj = in;
60+
// automatically activate this object
61+
begin();
6062
}
6163

6264
/// Adds an effect object (by reference)
@@ -73,13 +75,13 @@ class AudioEffects : public GeneratorT {
7375
}
7476

7577
/// provides the resulting sample
76-
effect_t readSample() {
77-
effect_t input = generator_obj.readSample();
78+
effect_t readSample() override {
79+
effect_t sample = generator_obj.readSample();
7880
int size = effects.size();
7981
for (int j=0; j<size; j++){
80-
input = effects[j]->process(input);
82+
sample = effects[j]->process(sample);
8183
}
82-
return input;
84+
return sample;
8385
}
8486

8587
/// deletes all defined effects

src/AudioEffects/SoundGenerator.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ class SoundGenerator {
9494
break;
9595
}
9696
} else {
97-
LOGE("SoundGenerator::readBytes -> inactive");
97+
if (!activeWarningIssued) {
98+
LOGE("SoundGenerator::readBytes -> inactive");
99+
activeWarningIssued=true;
100+
}
98101
result = 0;
99102
}
100103
//LOGD( "SoundGenerator::readBytes (channels: %d) %zu bytes -> %zu samples", ch, lengthBytes, result);

0 commit comments

Comments
 (0)