@@ -33,7 +33,7 @@ class AudioEffects : public SoundGenerator<effect_t> {
33
33
AudioEffects (AudioEffects ©) {
34
34
LOGI (LOG_METHOD);
35
35
// create a copy of the source and all effects
36
- generator_obj = copy.generator_obj ;
36
+ p_generator = copy.p_generator ;
37
37
for (int j=0 ;j<copy.size ();j++){
38
38
effects.push_back (copy[j]->clone ());
39
39
}
@@ -56,7 +56,7 @@ class AudioEffects : public SoundGenerator<effect_t> {
56
56
// / Defines the input source for the raw guitar input
57
57
void setInput (GeneratorT &in){
58
58
LOGD (LOG_METHOD);
59
- generator_obj = in;
59
+ p_generator = & in;
60
60
// automatically activate this object
61
61
AudioBaseInfo info;
62
62
info.channels = 1 ;
@@ -79,10 +79,13 @@ class AudioEffects : public SoundGenerator<effect_t> {
79
79
80
80
// / provides the resulting sample
81
81
effect_t readSample () override {
82
- effect_t sample = generator_obj.readSample ();
83
- int size = effects.size ();
84
- for (int j=0 ; j<size; j++){
85
- sample = effects[j]->process (sample);
82
+ effect_t sample;
83
+ if (p_generator!=nullptr ){
84
+ sample = p_generator->readSample ();
85
+ int size = effects.size ();
86
+ for (int j=0 ; j<size; j++){
87
+ sample = effects[j]->process (sample);
88
+ }
86
89
}
87
90
return sample;
88
91
}
@@ -100,7 +103,7 @@ class AudioEffects : public SoundGenerator<effect_t> {
100
103
101
104
// / Provides access to the sound generator
102
105
GeneratorT &generator (){
103
- return generator_obj ;
106
+ return p_generator ;
104
107
}
105
108
106
109
// / gets an effect by index
@@ -124,7 +127,7 @@ class AudioEffects : public SoundGenerator<effect_t> {
124
127
125
128
protected:
126
129
Vector<AudioEffect*> effects;
127
- GeneratorT generator_obj ;
130
+ GeneratorT *p_generator= nullptr ;
128
131
};
129
132
130
133
0 commit comments