Class PcmChannelEncoder
java.lang.Object
net.avadeaux.klipspringer.codec.PcmChannelEncoder
- All Implemented Interfaces:
Closeable,AutoCloseable,PcmWriter
Channel for writing PCM data, with quality-compatible conversion.
-
Constructor Summary
ConstructorsConstructorDescriptionPcmChannelEncoder(PcmFormat inFormat, WritableByteChannel channel, PcmFormat outFormat, Device.BitLayout outLout) General constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()SeeCloseable.close().static PcmChannelEncoderofRaw(PcmFormat inFormat, WritableByteChannel channel, PcmFormat outFormat) Factory method that gets an encoder for producing raw PCM format output.static PcmChannelEncoderofWav(PcmFormat inFormat, WritableByteChannel channel, long totalFrames) Factory method that gets an encoder for producing PCM format output with a WAV header.booleanwrite(ByteBuffer data) Writes a block of audio data.
-
Constructor Details
-
PcmChannelEncoder
public PcmChannelEncoder(PcmFormat inFormat, WritableByteChannel channel, PcmFormat outFormat, Device.BitLayout outLout) General constructor. Note that there are factory methodsofWav(net.avadeaux.klipspringer.codec.PcmFormat,java.nio.channels.WritableByteChannel,long)andofWav(net.avadeaux.klipspringer.codec.PcmFormat,java.nio.channels.WritableByteChannel,long)
-
-
Method Details
-
write
Description copied from interface:PcmWriterWrites a block of audio data. Returning true is a signal to the caller to continue sending more blocks until the input is exhausted. Returning false is a signal that decoding should stop. In the context of areusableencoder, blocks may again start to arrive with the next call todecodeAll.- Specified by:
writein interfacePcmWriter- Throws:
IOException
-
close
Description copied from interface:PcmWriterSeeCloseable.close().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfacePcmWriter- Throws:
IOException
-
ofRaw
public static PcmChannelEncoder ofRaw(PcmFormat inFormat, WritableByteChannel channel, PcmFormat outFormat) Factory method that gets an encoder for producing raw PCM format output. -
ofWav
public static PcmChannelEncoder ofWav(PcmFormat inFormat, WritableByteChannel channel, long totalFrames) throws IOException Factory method that gets an encoder for producing PCM format output with a WAV header.- Throws:
IOException
-