Here are a few changes to start using a Java ByteBuffer, which will allow us to just pass around a collection of bytes after a certain point. The canges include:
A new AudioCompressionType called AudioByteBuffer, which just hold a ByteBuffer for us to use
A new AlgorithmStep skeleton called ByteBufferizerStep, which will convert the MDCT output to bytes
Update to existing classes to use the new types, including now having the Huffman step input AND output an AudioByteBuffer
A simple demo of how to use the Java ByteBuffer class
I think with this change, we will be able to implement the Huffman encoder with absolutely NO assumptions about the incoming data, just that it is a bunch of bytes. You could implement the HuffmanStep class to just be a very thin wrapper around the code you have for Huffman, and just send in the byte[] array you get from the ByteBuffer, or something like that.
There is a test class called AudioByteBufferImpl that you can use, Taylor, for testing out your encoder. It just holds a given number of random ints. There is a block of code in the AudioByteBufferDemo class that shows how to instantiate and use it.
Let me know if this looks OK and I'll merge it in. Thanks!
Hey guys,
Here are a few changes to start using a Java
ByteBuffer
, which will allow us to just pass around a collection of bytes after a certain point. The canges include:AudioCompressionType
calledAudioByteBuffer
, which just hold aByteBuffer
for us to useAlgorithmStep
skeleton calledByteBufferizerStep
, which will convert the MDCT output to bytesAudioByteBuffer
ByteBuffer
classI think with this change, we will be able to implement the Huffman encoder with absolutely NO assumptions about the incoming data, just that it is a bunch of bytes. You could implement the
HuffmanStep
class to just be a very thin wrapper around the code you have for Huffman, and just send in thebyte[]
array you get from theByteBuffer
, or something like that.There is a test class called
AudioByteBufferImpl
that you can use, Taylor, for testing out your encoder. It just holds a given number of random ints. There is a block of code in theAudioByteBufferDemo
class that shows how to instantiate and use it.Let me know if this looks OK and I'll merge it in. Thanks!