comparison 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
comparison
equal deleted inserted replaced
35:c969b04fa0dc 36:2a525e937d86
171 171
172 172
173 //public final static int BYTES_PER_SAMPLE = 4; 173 //public final static int BYTES_PER_SAMPLE = 4;
174 private ByteBuffer buffer = BufferUtils.createByteBuffer(4096); 174 private ByteBuffer buffer = BufferUtils.createByteBuffer(4096);
175 175
176 private byte[] debug0 = new byte[4096];
177 private byte[] debug1 = new byte[4096];
178
179
176 public void dispatchAudio(float tpf){ 180 public void dispatchAudio(float tpf){
181
177 int samplesToGet = (int) (tpf * outFormat.getSampleRate()); 182 int samplesToGet = (int) (tpf * outFormat.getSampleRate());
178 try {latch.await();} 183 try {latch.await();}
179 catch (InterruptedException e) {e.printStackTrace();} 184 catch (InterruptedException e) {e.printStackTrace();}
180 audioSend.step(samplesToGet); 185 audioSend.step(samplesToGet);
181 updateAllListeners(); 186 updateAllListeners();
182 187
183 for (int i = 0; i < this.listeners.size(); i++){ 188 for (int i = 0; i < this.listeners.size(); i++){
184 buffer.clear(); 189 buffer.clear();
185 audioSend.getSamples(buffer, samplesToGet, i); 190 audioSend.getSamples(buffer, samplesToGet, i);
191 if (i == 0 ) buffer.get(debug0);
192 if (i == 1 ) buffer.get(debug1);
186 SoundProcessor sp = 193 SoundProcessor sp =
187 this.soundProcessorMap.get(this.listeners.get(i)); 194 this.soundProcessorMap.get(this.listeners.get(i));
188 if (null != sp){sp.process(buffer, samplesToGet*outFormat.getFrameSize(), outFormat);} 195 if (null != sp){sp.process(buffer, samplesToGet*outFormat.getFrameSize(), outFormat);}
189 } 196 }
190 197
198 for (int i = 0; i < samplesToGet; i++){
199 if (debug1[i] != debug0[i]){
200 System.out.println("inconsistency detected @ sample " + i);
201 System.out.println("main : " + debug0[i]);
202 System.out.println("aux : " + debug1[i]);
203
204 break;
205 }
206
207 }
208
191 } 209 }
192 210
193 public void update(float tpf){ 211 public void update(float tpf){
194 super.update(tpf); 212 super.update(tpf);
195 dispatchAudio(tpf); 213 dispatchAudio(tpf);