diff src/com/aurellem/capture/audio/AudioSendRenderer.java @ 39:784a3f4e6202

updating capture-video
author Robert McIntyre <rlm@mit.edu>
date Thu, 03 Nov 2011 16:00:46 -0700
parents adeb88787645
children 2f129118e2d6
line wrap: on
line diff
     1.1 --- a/src/com/aurellem/capture/audio/AudioSendRenderer.java	Mon Oct 31 07:43:44 2011 -0700
     1.2 +++ b/src/com/aurellem/capture/audio/AudioSendRenderer.java	Thu Nov 03 16:00:46 2011 -0700
     1.3 @@ -136,8 +136,7 @@
     1.4  		this.audioSend = new AudioSend(this.deviceID);
     1.5  		this.outFormat = audioSend.getAudioFormat();
     1.6  		initBuffer();
     1.7 -		System.out.println(outFormat);
     1.8 -		
     1.9 +				
    1.10  		// The LWJGL context must be established as the master context before 
    1.11  		// any other listeners can be created on this device.
    1.12  		audioSend.initDevice();
    1.13 @@ -173,22 +172,14 @@
    1.14  	}
    1.15  	
    1.16  	
    1.17 -	//public final static int BYTES_PER_SAMPLE = 4;
    1.18 -	
    1.19 -	
    1.20  	private ByteBuffer buffer;;
    1.21 -	private byte[] debug0;
    1.22 -	private byte[] debug1;
    1.23 -	
    1.24 +
    1.25  	public static final int MIN_FRAMERATE = 10;
    1.26  	
    1.27  	private void initBuffer(){
    1.28  		int bufferSize = (int)(this.outFormat.getSampleRate() / ((float)MIN_FRAMERATE)) * 
    1.29  					this.outFormat.getFrameSize();
    1.30  		this.buffer = BufferUtils.createByteBuffer(bufferSize);
    1.31 -		debug0 = new byte[4096];
    1.32 -		debug1 = new byte[4096];
    1.33 -			
    1.34  	}
    1.35  	/*
    1.36  	
    1.37 @@ -196,33 +187,19 @@
    1.38  	public void dispatchAudio(float tpf){
    1.39  		
    1.40  		int samplesToGet = (int) (tpf * outFormat.getSampleRate());
    1.41 -		System.out.println("want " + samplesToGet + " samples");
    1.42  		try {latch.await();} 
    1.43  		catch (InterruptedException e) {e.printStackTrace();}
    1.44  		audioSend.step(samplesToGet);
    1.45  		updateAllListeners();
    1.46 -		
    1.47 +
    1.48  		for (int i = 0; i < this.listeners.size(); i++){		
    1.49  			buffer.clear();
    1.50  			audioSend.getSamples(buffer, samplesToGet, i);
    1.51 -			if (i == 0 ) buffer.get(debug0);
    1.52 -			if (i == 1 ) buffer.get(debug1);
    1.53  			SoundProcessor sp = 
    1.54 -			this.soundProcessorMap.get(this.listeners.get(i));
    1.55 +					this.soundProcessorMap.get(this.listeners.get(i));
    1.56  			if (null != sp){sp.process(buffer, samplesToGet*outFormat.getFrameSize(), outFormat);}
    1.57  		}
    1.58 -		
    1.59 -		for (int i = 0; i < samplesToGet; i++){
    1.60 -			if (debug1[i] != debug0[i]){
    1.61 -				System.out.println("inconsistency detected @ sample " + i);
    1.62 -				System.out.println("main : " + debug0[i]);
    1.63 -				System.out.println("aux : " + debug1[i]);
    1.64 -				
    1.65 -				break;
    1.66 -			}
    1.67 -			
    1.68 -		}
    1.69 -		
    1.70 +
    1.71  	}
    1.72  		
    1.73  	public void update(float tpf){