Hello h4yn0nnym0u5e, I'm lookin' for some help again.
I'm successfully using your library to create and delete synthesis objects. I've copied what you did in PlaySynthDynamic.ino and voice.h which is used by that example.
Now I'm trying to do the same with effects. Basically have a duplicate effects.h like your voice.h. The problem I'm running into is effects have inputs to the audio objects, not just outputs. In your example you connect synthesis objects as follows:
That does not have an option to connect an input and effects need input connections. I tried to rewrite the code you have in voice.h to have it accept an input using my connect2 function but I can't get it to work.
Can you point me in the right direction?
My effects.h, which does not work, is below. (I did temporarily put a wave generator within the effects.h to make sure that the class works if I'm not trying to use an input, and it does.)
I'm successfully using your library to create and delete synthesis objects. I've copied what you did in PlaySynthDynamic.ino and voice.h which is used by that example.
Now I'm trying to do the same with effects. Basically have a duplicate effects.h like your voice.h. The problem I'm running into is effects have inputs to the audio objects, not just outputs. In your example you connect synthesis objects as follows:
Code:
waves[chan]->connect(mixArray[chan&3],chan>>2)?"nope ":"");
Can you point me in the right direction?
My effects.h, which does not work, is below. (I did temporarily put a wave generator within the effects.h to make sure that the class works if I'm not trying to use an input, and it does.)
Code:
#include <Audio.h>
#include "AudioStream.h"
class SynthEffect
{
public:
AudioConnection outputCord;
AudioConnection inputCord;
virtual AudioStream& getOutputStream(void) = 0;
virtual AudioStream& getInputStream(void) = 0;
virtual ~SynthEffect(){};
int connect(AudioStream& str) { return connect(str,0);}
int connect(AudioStream& str, int inpt) {return outputCord.connect(getOutputStream(),0,str,inpt);}
int connect2(AudioStream& str, int oupt) {return inputCord.connect(str,0,getInputStream(),0);}
virtual void setparam(byte param, float input1) = 0;
virtual void setparam(byte param, float input1, float input2) = 0;
virtual void setparam(byte param, byte input1, float input2) = 0;
virtual void setparam(byte param, byte input1, float input2, float input3) = 0;
virtual void setparam(byte param, byte input1, byte input2) = 0;
};
class EffAmp : public SynthEffect {
public:
AudioAmplifier amp;
AudioMixer4 mixer;
AudioStream& getInputStream(void) {AudioStream& result {amp}; return result;};
AudioStream& getOutputStream(void) {AudioStream& result {amp}; return result;};
private:
public:
EffAmp()
{
amp.gain(1.0);
// wav.begin(.3,440,0);
};
~EffAmp() {};
void setparam(byte param, float input1) {
};
void setparam(byte param, float input1, float input2) {
};
void setparam(byte param, byte input1, float input2) {
};
void setparam(byte param, byte input1, byte input2) {
};
void setparam(byte param, byte input1, float input2, float input3) {
};
};