diff src/com/aurellem/capture/audio/AudioSendRenderer.java @ 36:2a525e937d86

still debuging.
author Robert McIntyre <rlm@mit.edu>
date Mon, 31 Oct 2011 01:21:30 -0700
parents 13d354e1184b
children adeb88787645
line wrap: on
line diff
     1.1 --- a/src/com/aurellem/capture/audio/AudioSendRenderer.java	Mon Oct 31 00:14:46 2011 -0700
     1.2 +++ b/src/com/aurellem/capture/audio/AudioSendRenderer.java	Mon Oct 31 01:21:30 2011 -0700
     1.3 @@ -173,7 +173,12 @@
     1.4  	//public final static int BYTES_PER_SAMPLE = 4;
     1.5  	private ByteBuffer buffer = BufferUtils.createByteBuffer(4096); 
     1.6  	
     1.7 +	private byte[] debug0 = new byte[4096];
     1.8 +	private byte[] debug1 = new byte[4096];
     1.9 +	
    1.10 +	
    1.11  	public void dispatchAudio(float tpf){
    1.12 +		
    1.13  		int samplesToGet = (int) (tpf * outFormat.getSampleRate());
    1.14  		try {latch.await();} 
    1.15  		catch (InterruptedException e) {e.printStackTrace();}
    1.16 @@ -183,11 +188,24 @@
    1.17  		for (int i = 0; i < this.listeners.size(); i++){		
    1.18  			buffer.clear();
    1.19  			audioSend.getSamples(buffer, samplesToGet, i);
    1.20 +			if (i == 0 ) buffer.get(debug0);
    1.21 +			if (i == 1 ) buffer.get(debug1);
    1.22  			SoundProcessor sp = 
    1.23  			this.soundProcessorMap.get(this.listeners.get(i));
    1.24  			if (null != sp){sp.process(buffer, samplesToGet*outFormat.getFrameSize(), outFormat);}
    1.25  		}
    1.26  		
    1.27 +		for (int i = 0; i < samplesToGet; i++){
    1.28 +			if (debug1[i] != debug0[i]){
    1.29 +				System.out.println("inconsistency detected @ sample " + i);
    1.30 +				System.out.println("main : " + debug0[i]);
    1.31 +				System.out.println("aux : " + debug1[i]);
    1.32 +				
    1.33 +				break;
    1.34 +			}
    1.35 +			
    1.36 +		}
    1.37 +		
    1.38  	}
    1.39  		
    1.40  	public void update(float tpf){