@@ -33,7 +33,7 @@ class AudioEffects : public SoundGenerator<effect_t> {
3333 AudioEffects (AudioEffects ©) {
3434 LOGI (LOG_METHOD);
3535 // create a copy of the source and all effects
36- generator_obj = copy.generator_obj ;
36+ p_generator = copy.p_generator ;
3737 for (int j=0 ;j<copy.size ();j++){
3838 effects.push_back (copy[j]->clone ());
3939 }
@@ -56,7 +56,7 @@ class AudioEffects : public SoundGenerator<effect_t> {
5656 // / Defines the input source for the raw guitar input
5757 void setInput (GeneratorT &in){
5858 LOGD (LOG_METHOD);
59- generator_obj = in;
59+ p_generator = & in;
6060 // automatically activate this object
6161 AudioBaseInfo info;
6262 info.channels = 1 ;
@@ -79,10 +79,13 @@ class AudioEffects : public SoundGenerator<effect_t> {
7979
8080 // / provides the resulting sample
8181 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+ }
8689 }
8790 return sample;
8891 }
@@ -100,7 +103,7 @@ class AudioEffects : public SoundGenerator<effect_t> {
100103
101104 // / Provides access to the sound generator
102105 GeneratorT &generator (){
103- return generator_obj ;
106+ return p_generator ;
104107 }
105108
106109 // / gets an effect by index
@@ -124,7 +127,7 @@ class AudioEffects : public SoundGenerator<effect_t> {
124127
125128 protected:
126129 Vector<AudioEffect*> effects;
127- GeneratorT generator_obj ;
130+ GeneratorT *p_generator= nullptr ;
128131};
129132
130133
0 commit comments