Documentation
¶
Overview ¶
Package pulseaudio allows clients to read audio from, or send audio to a pulseaudio server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Format denoes the Audio format type. Currently only "NE" or
// "Native Endian" is supported, since we're providing a way to write
// things like `[]float` into the audio stream, and it's unlikely this
// will be used to play back flat files on the system without processing
// them.
Format SampleFormat
// Rate is the numbers of samples per second.
Rate uint
// Channels is the number of channels in the audio stream.
Channels uint
// AppName is the name of the Application doing the streaming.
AppName string
// StreamName is the name of the audio stream from the Application.
StreamName string
// SinkName is the name of the PulseAudio sink to write to.
SinkName string
}
Config will allow you to set the parameters that pulseaudio will be initialized with at creation time.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is a handle to the underlying pulseaudio stream to allow for reading from the microphone on the system.
type SampleFormat ¶
type SampleFormat int
SampleFormat denotes the audio format to be used by the pulse streamer.
var ( // SampleFormatFloat32NE is used when the provided data is comprised of // 32 bit floating point numbers in the native endian format. This means // the data can be passed to `Write` as either []float32 or [][2]float32, // depending on the channels provided. SampleFormatFloat32NE SampleFormat = C.PA_SAMPLE_FLOAT32NE )
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer is an encapsulation of the underlying pulseaudio stream, allowing for an idiomatic Go library interface to that stream.
func NewWriter ¶
NewWriter creates a new pulseaudio.Writer object, allowing audio to be written into Pulse.
func (Writer) Close ¶
func (w Writer) Close()
Close will close the stream, and perform all cleanup required.
func (Writer) Write ¶
Write will write the provided data to the pulseaudio stream. This function accepts any type, but will return an error if th type is not something that this library understands, the number of channels and the stream format.
Currently accepted types:
- []float32 (Format: SampleFormatFloat32NE, Channels: 1)
- [][2]float32 (Format: SampleFormatFloat32NE, Channels: 2)