class RemiAudio::Drivers::Tcp::TcpDevice
Overview
The TcpDevice
allows for raw audio to be sent over a TCP connection.
Audio input is always expected to be 32-bit floating point, but a
TcpDevice
can be configured to convert this to other formats before
transmitting the audio over the connection. This can optionally be done
with a RemiAudio::DSP::Ditherer
for higher quality.
Defined in:
remiaudio/drivers/tcp.crConstructors
-
.new(inSampleRate : Int, outFormat : RemiAudio::SampleFormat, inChannels : Int, *, host : String, port : UInt16)
Creates a new
TcpDevice
instance that will send audio to the given host and port.
Instance Method Summary
-
#ditherer : RemiAudio::DSP::Ditherer | Nil
When non-nil, then dithering will be used to convert the audio to the chosen
#outFormat
before transmission. -
#ditherer=(ditherer : RemiAudio::DSP::Ditherer | Nil)
When non-nil, then dithering will be used to convert the audio to the chosen
#outFormat
before transmission. -
#host : String
The remote hostname.
-
#noiseShaping=(noiseShaping : Bool)
Whether or not to use noise shaping when using a
#ditherer
. -
#noiseShaping? : Bool
Whether or not to use noise shaping when using a
#ditherer
. -
#outFormat : RemiAudio::SampleFormat
The format that audio will be converted to before transmission over the TCP connection.
-
#port : UInt16
The remote port.
-
#start : Nil
Opens the audio stream.
-
#stop : Nil
Closes the audio stream and frees resources.
-
#writeBuffer(buf : Array(Float32) | Slice(Float32)) : Nil
:inherit:
Instance methods inherited from class RemiAudio::Drivers::AudioDevice
<<(buf : Array(Float32) | Slice(Float32)) : Nil
<<,
bitDepth : UInt8
bitDepth,
bufferSize : UInt32
bufferSize,
bufferSize=(value : Int) : Nil
bufferSize=,
channels : UInt8
channels,
expectedBufferSize : UInt32
expectedBufferSize,
sampleRate : UInt32
sampleRate,
start : Nil
start,
started? : Bool
started?,
stop : Nil
stop,
writeBuffer(buf : Array(Float32) | Slice(Float32)) : Nil
writeBuffer
Constructor Detail
Creates a new TcpDevice
instance that will send audio to the given host
and port. The *outFormat` parameter is used to determine what format the
audio is converted to before being transmitted over the connection; the
input format is always 32-bit floating point.
The inSampleRate and *inChannelparameters are stored in
#sampleRateand
#channels`, respectively, and are just for informational purposes.
They are otherwise unused by this class.
Instance Method Detail
When non-nil, then dithering will be used to convert the audio to the
chosen #outFormat
before transmission. If this is nil
, then no
dithering is performaned during the conversion. If the output format is
already RemiAudio::SampleFormat:F32
, then this does nothing.
When non-nil, then dithering will be used to convert the audio to the
chosen #outFormat
before transmission. If this is nil
, then no
dithering is performaned during the conversion. If the output format is
already RemiAudio::SampleFormat:F32
, then this does nothing.
Whether or not to use noise shaping when using a #ditherer
.
The format that audio will be converted to before transmission over the TCP connection.
Closes the audio stream and frees resources. This must be called when you are finished using the instance to ensure that the resources are properly freed and the audio device is properly closed.