Documentation
¶
Overview ¶
asoundlib package is the simple wrapper for C alsa binding library.
Index ¶
- Constants
- type Handle
- func (handle *Handle) ApplyHwParams() error
- func (handle *Handle) AvailUpdate() (freeBytes int, err error)
- func (handle *Handle) Close() error
- func (handle *Handle) FrameSize() int
- func (handle *Handle) Open(device string, streamType StreamType, mode int) error
- func (handle *Handle) Pause() error
- func (handle *Handle) Paused() bool
- func (handle *Handle) Reset()
- func (handle *Handle) SampleSize() int
- func (handle *Handle) Wait(maxDelay int) (ok bool, err error)
- func (handle *Handle) Write(buf []byte) (wrote int, err error)
- type SampleFormat
- type StreamType
Constants ¶
View Source
const ( // Playback stream StreamTypePlayback = C.SND_PCM_STREAM_PLAYBACK // Capture stream StreamTypeCapture = C.SND_PCM_STREAM_CAPTURE )
Stream type constants.
View Source
const ( // Unknown SampleFormatUnknown = C.SND_PCM_FORMAT_UNKNOWN // Signed 8 bit SampleFormatS8 = C.SND_PCM_FORMAT_S8 // Unsigned 8 bit SampleFormatU8 = C.SND_PCM_FORMAT_U8 // Signed 16 bit Little Endian SampleFormatS16LE = C.SND_PCM_FORMAT_S16_LE // Signed 16 bit Big Endian SampleFormatS16BE = C.SND_PCM_FORMAT_S16_BE // Unsigned 16 bit Little Endian SampleFormatU16LE = C.SND_PCM_FORMAT_U16_LE // Unsigned 16 bit Big Endian SampleFormatU16BE = C.SND_PCM_FORMAT_U16_BE // SND_PCM_FORMAT_S24_LE Signed 24 bit Little Endian using low three bytes in 32-bit word // SND_PCM_FORMAT_S24_BE Signed 24 bit Big Endian using low three bytes in 32-bit word // SND_PCM_FORMAT_U24_LE Unsigned 24 bit Little Endian using low three bytes in 32-bit word // SND_PCM_FORMAT_U24_BE Unsigned 24 bit Big Endian using low three bytes in 32-bit word // SND_PCM_FORMAT_S32_LE Signed 32 bit Little Endian // SND_PCM_FORMAT_S32_BE Signed 32 bit Big Endian // SND_PCM_FORMAT_U32_LE Unsigned 32 bit Little Endian // SND_PCM_FORMAT_U32_BE Unsigned 32 bit Big Endian // SND_PCM_FORMAT_FLOAT_LE Float 32 bit Little Endian, Range -1.0 to 1.0 // SND_PCM_FORMAT_FLOAT_BE Float 32 bit Big Endian, Range -1.0 to 1.0 // SND_PCM_FORMAT_FLOAT64_LE Float 64 bit Little Endian, Range -1.0 to 1.0 // SND_PCM_FORMAT_FLOAT64_BE Float 64 bit Big Endian, Range -1.0 to 1.0 // SND_PCM_FORMAT_IEC958_SUBFRAME_LE IEC-958 Little Endian // SND_PCM_FORMAT_IEC958_SUBFRAME_BE IEC-958 Big Endian // SND_PCM_FORMAT_MU_LAW Mu-Law // SND_PCM_FORMAT_A_LAW A-Law // SND_PCM_FORMAT_IMA_ADPCM Ima-ADPCM // SND_PCM_FORMAT_MPEG MPEG // SND_PCM_FORMAT_GSM GSM // SND_PCM_FORMAT_SPECIAL Special // SND_PCM_FORMAT_S24_3LE Signed 24bit Little Endian in 3bytes format // SND_PCM_FORMAT_S24_3BE Signed 24bit Big Endian in 3bytes format // SND_PCM_FORMAT_U24_3LE Unsigned 24bit Little Endian in 3bytes format // SND_PCM_FORMAT_U24_3BE Unsigned 24bit Big Endian in 3bytes format // SND_PCM_FORMAT_S20_3LE Signed 20bit Little Endian in 3bytes format // SND_PCM_FORMAT_S20_3BE Signed 20bit Big Endian in 3bytes format // SND_PCM_FORMAT_U20_3LE Unsigned 20bit Little Endian in 3bytes format // SND_PCM_FORMAT_U20_3BE Unsigned 20bit Big Endian in 3bytes format // SND_PCM_FORMAT_S18_3LE Signed 18bit Little Endian in 3bytes format // SND_PCM_FORMAT_S18_3BE Signed 18bit Big Endian in 3bytes format // SND_PCM_FORMAT_U18_3LE Unsigned 18bit Little Endian in 3bytes format // SND_PCM_FORMAT_U18_3BE Unsigned 18bit Big Endian in 3bytes format // Signed 16 bit CPU endian SampleFormatS16 = C.SND_PCM_FORMAT_S16 )
View Source
const ( ModeBlock = 0 ModeNonblock = C.SND_PCM_NONBLOCK ModeAsync = C.SND_PCM_ASYNC )
Open mode constants.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handle ¶
type Handle struct {
// Used samples format (size, endianness, signed).
SampleFormat SampleFormat
// Sample rate in Hz. Usual 44100.
SampleRate int
// Channels in the stream. 2 for stereo.
Channels int
// contains filtered or unexported fields
}
Handle represents ALSA stream handler.
func (*Handle) ApplyHwParams ¶
ApplyHwParams changes ALSA hardware parameters for the current stream.
func (*Handle) AvailUpdate ¶
AvailUpdate returns number of bytes ready to be read/written.
func (*Handle) Open ¶
func (handle *Handle) Open(device string, streamType StreamType, mode int) error
Open opens a stream.
func (*Handle) SampleSize ¶
SampleSize returns one sample size in bytes.
Click to show internal directories.
Click to hide internal directories.