Class LameStream
java.lang.Object
net.avadeaux.klipspringer.codec.ExternalEncodedStream
net.avadeaux.klipspringer.codec.LameStream
- All Implemented Interfaces:
Closeable,AutoCloseable,AudioStream,Device.Player,PcmWriter
Audio stream that sends MP3 encoded data to a channel. Also doubles as file encoder class when
created via
fileEncoder.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.avadeaux.klipspringer.codec.AudioStream
AudioStream.Factory -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Device.BitLayoutThe bit layout for PCM data sent to an MP3 stream. -
Constructor Summary
ConstructorsConstructorDescriptionLameStream(PcmFormat format, int bitrate, int quality, int bufferFrames, double writeaheadSecs, double timeoutSecs, WritableByteChannel channel, Executor keepAlivePool, double keepAliveTimeoutSecs) Creates a FLAC stream with the given specifications and destination channel. -
Method Summary
Modifier and TypeMethodDescriptionstatic PcmWriterfileEncoder(String fileName, PcmFormat dataFormat, int bitrate, int quality) Gets a player that encodes to a file rather than a stream.layout()Gets the bit layout expected by the player.quality()Gets the bitrate specified for this stream.static PcmFormatselectFormat(AudioFormat fmt) Selects format suitable for LAME streaming with the same semantics asPcmFormat.Selector.selectFormat(AudioFormat).Methods inherited from class net.avadeaux.klipspringer.codec.ExternalEncodedStream
close, drain, format, playedMillis, streaming, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.avadeaux.klipspringer.codec.Device.Player
bufferedFrames, canPause, pause, unpause
-
Field Details
-
BIT_LAYOUT
The bit layout for PCM data sent to an MP3 stream.
-
-
Constructor Details
-
LameStream
public LameStream(PcmFormat format, int bitrate, int quality, int bufferFrames, double writeaheadSecs, double timeoutSecs, WritableByteChannel channel, Executor keepAlivePool, double keepAliveTimeoutSecs) throws IOException Creates a FLAC stream with the given specifications and destination channel.If
keepAliveExecis non-null, it is used byExternalEncodedStream.close()to execute a wait loop that terminates when either the recipient has sent callback notification of having played (almost) all the data it has been sent, or no callback is made forkeepAliveTimeoutSecsseconds. (See alsoExternalEncodedStream.drain().)- Throws:
IOException
-
-
Method Details
-
selectFormat
Selects format suitable for LAME streaming with the same semantics asPcmFormat.Selector.selectFormat(AudioFormat).- Throws:
UnsupportedFormatException
-
layout
Description copied from interface:Device.PlayerGets the bit layout expected by the player. If the player is produced by aFactory, the layout should match the value returned byDevice.Player.Factory.layout(PcmFormat), and if the player is associated with a device, this should match what is returned byDevice.layout(PcmFormat). Default returnsDevice.BitLayout.LSB. Default returnsDevice.BitLayout.LSB. -
quality
Gets the bitrate specified for this stream. -
fileEncoder
public static PcmWriter fileEncoder(String fileName, PcmFormat dataFormat, int bitrate, int quality) throws IOException Gets a player that encodes to a file rather than a stream.- Throws:
IOException
-