You can try this (tested, works): create a class that implements both AudioSignal and AudioListener. Whatever is sampled from input is then copied to output. Example solution (not really elegant):
loop sketch file (only setup method):
Code:
void setup()
{
size(512, 200, P2D);
minim = new Minim(this);
int buffer = 1024;
out = minim.getLineOut(Minim.STEREO, buffer);
in = minim.getLineIn(Minim.STEREO, buffer);
signal = new InputOutputBind(1024);
//add listener to gather incoming data
in.addListener(signal);
// adds the signal to the output
out.addSignal(signal);
}
class implementing AudioSignal and AudioListener:
Code:class InputOutputBind implements AudioSignal, AudioListener
{
private float[] leftChannel ;
private float[] rightChannel;
InputOutputBind(int sample)
{
leftChannel = new float[sample];
rightChannel= new float[sample];
}
// This part is implementing AudioSignal interface, see Minim reference
void generate(float[] samp)
{
arraycopy(leftChannel,samp);
}
void generate(float[] left, float[] right)
{
arraycopy(leftChannel,left);
arraycopy(rightChannel,right);
}
// This part is implementing AudioListener interface, see Minim reference
synchronized void samples(float[] samp)
{
arraycopy(samp,leftChannel);
}
synchronized void samples(float[] sampL, float[] sampR)
{
arraycopy(sampL,leftChannel);
arraycopy(sampR,rightChannel);
}
}
HTH,
Tomek