comparison src/com/aurellem/capture/audio/AudioSendRenderer.java @ 28:7184bc09a92e

need to solve audio recording clicks
author Robert McIntyre <rlm@mit.edu>
date Sun, 30 Oct 2011 10:00:29 -0700
parents 5249c8a9603c
children
comparison
equal deleted inserted replaced
27:5249c8a9603c 28:7184bc09a92e
169 169
170 170
171 171
172 private ByteBuffer buffer = BufferUtils.createByteBuffer(4096); 172 private ByteBuffer buffer = BufferUtils.createByteBuffer(4096);
173 173
174
175
176
177
174 public void dispatchAudio(float tpf){ 178 public void dispatchAudio(float tpf){
175 int samplesToGet = (int) (tpf * outputFormat.getSampleRate()); 179
180 int samplesToGet = (int)(tpf * 44100);
181 org.lwjgl.input.Mouse.setGrabbed(false);
176 try {latch.await();} 182 try {latch.await();}
177 catch (InterruptedException e) {e.printStackTrace();} 183 catch (InterruptedException e) {e.printStackTrace();}
178 audioSend.step(samplesToGet); 184 audioSend.step(samplesToGet);
179 updateAllListeners(); 185 updateAllListeners();
180 186
182 buffer.clear(); 188 buffer.clear();
183 audioSend.getSamples(buffer, samplesToGet, i); 189 audioSend.getSamples(buffer, samplesToGet, i);
184 SoundProcessor sp = 190 SoundProcessor sp =
185 this.soundProcessorMap.get(this.listeners.get(i)); 191 this.soundProcessorMap.get(this.listeners.get(i));
186 if (null != sp){sp.process(buffer, outputFormat, 192 if (null != sp){sp.process(buffer, outputFormat,
187 samplesToGet*outputFormat.getSampleSizeInBits()/8);} 193 samplesToGet*4);}
188 } 194 }
189 195
190 } 196 }
191 197
192 public void update(float tpf){ 198 public void update(float tpf){