Hi,

I am trying to write a JMF program which takes the microphone signal as input and simultaneously plays the sound of the microphone back out through the speakers, after having processed the signal in some way (in this case, implementing the GainEffect.java plugin given in the JMF API guide). I have code which is compiling with no errors, however when I start it, there is no sound coming out of the speakers at all. I could play the sound of the microphone straight back out through the speakers with no problem (apart from feedback!), so it must be the way I am attempting to implement the plug in. I have googled this a lot and looked at many web pages and tutorials, including following the API guide, and at this stage I think I just need a pointer on what I'm doing wrong.

Here is my code -

Java Code:
import java.io.IOException;
import java.util.Vector;
import javax.media.*;
import javax.media.control.TrackControl;
import javax.media.format.AudioFormat;
import javax.media.protocol.DataSource;

public class audioCapture { 
	
	public static void main(String[] args){
	
		MediaLocator audioCapDevLoc = null;
		CaptureDeviceInfo audioCapDevInfo = null;
		Vector audioCapDevList = null;
		Vector plugIn;
		Player p;
		Processor pro = null;
		TrackControl[] tracks;
		DataSource ds;
		Vector plug;
		TrackControl audioTrack = null;
		AudioFormat audFormat = new AudioFormat(
			AudioFormat.LINEAR,
			44100,
			16,
			2,
			AudioFormat.LITTLE_ENDIAN,
			AudioFormat.SIGNED,
			16,
			Format.NOT_SPECIFIED,
			Format.byteArray);
		Format[] alinear=new AudioFormat[]{new AudioFormat(	AudioFormat.LINEAR,
				44100,
				16,
				2,
				AudioFormat.LITTLE_ENDIAN,
				AudioFormat.SIGNED,
				16,
				Format.NOT_SPECIFIED,
				Format.byteArray)};

        audioCapDevList = CaptureDeviceManager.getDeviceList(audFormat);         
        if ((audioCapDevList.size() > 0)) {
        	audioCapDevInfo = (CaptureDeviceInfo) audioCapDevList.elementAt(0);
            audioCapDevLoc = audioCapDevInfo.getLocator();
        }
        
        try{
        MediaLocator dest = new MediaLocator("javasound://0"); //take signal from soundcard
        
        	PlugInManager.addPlugIn("GainEffect", alinear, alinear, 3); //register plug in
        	plug = PlugInManager.getPlugInList(audFormat, audFormat, 3);
        	int vectorSize = plug.size();
        	if(plug.elementAt(vectorSize - 1).equals("GainEffect")){ //take the last plug in
        		plug.removeElementAt(vectorSize - 1);
        		plug.insertElementAt("GainEffect", 0);
        		PlugInManager.setPlugInList(plug, 3);
        		PlugInManager.commit();
        	}
        	pro = Manager.createProcessor(dest);
        	pro.configure(); //must configure before call getTrackControls
        	while(pro.getState() != Processor.Configured);
        	
        	tracks = pro.getTrackControls();
        	for (int i = 0; i < tracks.length; i++){
        		if(tracks[i].getFormat() instanceof AudioFormat){
        			audioTrack = tracks[i];
        			break;
        		}
        	}
        	
                Codec codec[] = {new  GainEffect()}; //add plug in effect
        	audioTrack.setCodecChain(codec);
        
        	pro.realize();
        	while(pro.getState() != Processor.Realized); //don't move on until realized
        	ds = pro.getDataOutput();
        	p = Manager.createRealizedPlayer(ds); //create a player using the data source from the processor
        	p.start();
        	
        catch (IOException e){
        	e.printStackTrace();
        	
        }
        catch (CannotRealizeException e){
        	e.printStackTrace();
        }
        catch(NoPlayerException e){
        	e.printStackTrace();
        }
        catch(UnsupportedPlugInException e){
        	e.printStackTrace();
        }
    }
}
Any help is greatly appreciated!