comparison org/ear.org @ 30:32c69ba451d9

fixed bug where sound-processor would generate too many floats
author Robert McIntyre <rlm@mit.edu>
date Mon, 23 Jan 2012 05:49:37 -0700
parents cdf320cb5949
children 0e794e48a0cc
comparison
equal deleted inserted replaced
29:cdf320cb5949 30:32c69ba451d9
771 (proxy [SoundProcessor] [] 771 (proxy [SoundProcessor] []
772 (cleanup []) 772 (cleanup [])
773 (process 773 (process
774 [#^ByteBuffer audioSamples numSamples #^AudioFormat audioFormat] 774 [#^ByteBuffer audioSamples numSamples #^AudioFormat audioFormat]
775 (let [bytes (byte-array numSamples) 775 (let [bytes (byte-array numSamples)
776 floats (float-array numSamples)] 776 num-floats (/ numSamples (.getFrameSize audioFormat))
777 floats (float-array num-floats)]
777 (.get audioSamples bytes 0 numSamples) 778 (.get audioSamples bytes 0 numSamples)
778 (FloatSampleTools/byte2floatInterleaved 779 (FloatSampleTools/byte2floatInterleaved
779 bytes 0 floats 0 780 bytes 0 floats 0 num-floats audioFormat)
780 (/ numSamples (.getFrameSize audioFormat)) audioFormat)
781 (continuation 781 (continuation
782 (vec floats)))))) 782 (vec floats))))))
783 783
784 (defn add-ear 784 (defn add-ear
785 "Add an ear to the world. The continuation function will be called 785 "Add an ear to the world. The continuation function will be called