Mercurial > jmeCapture
changeset 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 | 4d7ceab67ed0 |
files | src/com/aurellem/capture/audio/AudioSendRenderer.java src/com/aurellem/capture/examples/AdvancedAudio.java src/com/aurellem/capture/examples/Basic.java |
diffstat | 3 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/src/com/aurellem/capture/audio/AudioSendRenderer.java Sun Oct 30 08:10:26 2011 -0700 1.2 +++ b/src/com/aurellem/capture/audio/AudioSendRenderer.java Sun Oct 30 10:00:29 2011 -0700 1.3 @@ -171,8 +171,14 @@ 1.4 1.5 private ByteBuffer buffer = BufferUtils.createByteBuffer(4096); 1.6 1.7 + 1.8 + 1.9 + 1.10 + 1.11 public void dispatchAudio(float tpf){ 1.12 - int samplesToGet = (int) (tpf * outputFormat.getSampleRate()); 1.13 + 1.14 + int samplesToGet = (int)(tpf * 44100); 1.15 + org.lwjgl.input.Mouse.setGrabbed(false); 1.16 try {latch.await();} 1.17 catch (InterruptedException e) {e.printStackTrace();} 1.18 audioSend.step(samplesToGet); 1.19 @@ -184,7 +190,7 @@ 1.20 SoundProcessor sp = 1.21 this.soundProcessorMap.get(this.listeners.get(i)); 1.22 if (null != sp){sp.process(buffer, outputFormat, 1.23 - samplesToGet*outputFormat.getSampleSizeInBits()/8);} 1.24 + samplesToGet*4);} 1.25 } 1.26 1.27 }
2.1 --- a/src/com/aurellem/capture/examples/AdvancedAudio.java Sun Oct 30 08:10:26 2011 -0700 2.2 +++ b/src/com/aurellem/capture/examples/AdvancedAudio.java Sun Oct 30 10:00:29 2011 -0700 2.3 @@ -239,6 +239,9 @@ 2.4 */ 2.5 public void process(ByteBuffer audioSamples, AudioFormat format, int numSamples) { 2.6 //System.out.println("I'm DANCING <3"); 2.7 + 2.8 + 2.9 + 2.10 entity.scale(this.scale); 2.11 if (this.scale == 2f){this.scale = 0.5f;} 2.12 else {this.scale = 2;}
3.1 --- a/src/com/aurellem/capture/examples/Basic.java Sun Oct 30 08:10:26 2011 -0700 3.2 +++ b/src/com/aurellem/capture/examples/Basic.java Sun Oct 30 10:00:29 2011 -0700 3.3 @@ -26,6 +26,7 @@ 3.4 File video = File.createTempFile("JME-water-video", ".avi"); 3.5 File audio = File.createTempFile("JME-water-audio", ".wav"); 3.6 3.7 + 3.8 SimpleApplication app = new TestPostWater(); 3.9 app.setTimer(new IsoTimer(60)); 3.10 app.setShowSettings(false); 3.11 @@ -34,7 +35,7 @@ 3.12 Capture.captureAudio(app, audio); 3.13 3.14 app.start(); 3.15 - 3.16 + 3.17 System.out.println(video.getCanonicalPath()); 3.18 System.out.println(audio.getCanonicalPath()); 3.19 }