asound

package
v0.0.0-...-17244d7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PCMFormatS8        = C.SND_PCM_FORMAT_S8
	PCMFormatU8        = C.SND_PCM_FORMAT_U8
	PCMFormatS16LE     = C.SND_PCM_FORMAT_S16_LE
	PCMFormatS16BE     = C.SND_PCM_FORMAT_S16_BE
	PCMFormatU16LE     = C.SND_PCM_FORMAT_U16_LE
	PCMFormatU16BE     = C.SND_PCM_FORMAT_U16_BE
	PCMFormatS24LE     = C.SND_PCM_FORMAT_S24_LE
	PCMFormatS24BE     = C.SND_PCM_FORMAT_S24_BE
	PCMFormatU24LE     = C.SND_PCM_FORMAT_U24_LE
	PCMFormatU24BE     = C.SND_PCM_FORMAT_U24_BE
	PCMFormatS32LE     = C.SND_PCM_FORMAT_S32_LE
	PCMFormatS32BE     = C.SND_PCM_FORMAT_S32_BE
	PCMFormatU32LE     = C.SND_PCM_FORMAT_U32_LE
	PCMFormatU32BE     = C.SND_PCM_FORMAT_U32_BE
	PCMFormatFloatLE   = C.SND_PCM_FORMAT_FLOAT_LE
	PCMFormatFloatBE   = C.SND_PCM_FORMAT_FLOAT_BE
	PCMFormatFloat64LE = C.SND_PCM_FORMAT_FLOAT64_LE
	PCMFormatFloat64BE = C.SND_PCM_FORMAT_FLOAT64_BE
)

The range of sample formats supported by ALSA.

View Source
const (
	PCMStreamPlayback = C.SND_PCM_STREAM_PLAYBACK
	PCMStreamCapture  = C.SND_PCM_STREAM_CAPTURE
)
View Source
const (
	PCMAccessMMapInterleaved    = C.SND_PCM_ACCESS_MMAP_INTERLEAVED
	PCMAccessMMapNonInterleaved = C.SND_PCM_ACCESS_MMAP_NONINTERLEAVED
	PCMAccessMMapComplex        = C.SND_PCM_ACCESS_MMAP_COMPLEX
	PCMAccessRWInterleaved      = C.SND_PCM_ACCESS_RW_INTERLEAVED
	PCMAccessRWNonInterleaved   = C.SND_PCM_ACCESS_RW_NONINTERLEAVED
)
View Source
const (
	MixerSChanUnknown = C.SND_MIXER_SCHN_UNKNOWN
	/* Front left */
	MixerSChanFrontLeft = C.SND_MIXER_SCHN_FRONT_LEFT
	/* Front right */
	MixerSChanFrontRight = C.SND_MIXER_SCHN_FRONT_RIGHT
	/* Rear left */
	MixerSChanRearLeft = C.SND_MIXER_SCHN_REAR_LEFT
	/* Rear right */
	MixerSChanRearRight = C.SND_MIXER_SCHN_REAR_RIGHT
	/* Front center */
	MixerSChanFrontCenter = C.SND_MIXER_SCHN_FRONT_CENTER
	/* Woofer */
	MixerSChanWoofer = C.SND_MIXER_SCHN_WOOFER
	/* Side Left */
	MixerSChanSideLeft = C.SND_MIXER_SCHN_SIDE_LEFT
	/* Side Right */
	MixerSChanSideRight = C.SND_MIXER_SCHN_SIDE_RIGHT
	/* Rear Center */
	MixerSChanRearCenter = C.SND_MIXER_SCHN_REAR_CENTER
	/* Mono (Front left alias) */
	MixerSChanMono = C.SND_MIXER_SCHN_MONO
	MixerSChanLast = C.SND_MIXER_SCHN_LAST
)
View Source
const (
	MixerSAbstractNone  = C.SND_MIXER_SABSTRACT_NONE
	MixerSAbstractBasic = C.SND_MIXER_SABSTRACT_BASIC
)

Variables

View Source
var ErrUnderrun = errors.New("underrun")

Functions

func CardLoad

func CardLoad(card int) bool

Try to load the driver for a card.

return true if driver is present, false if driver is not present

func CardNext

func CardNext(rcard *int) error

Try to determine the next card.

Tries to determine the next card from given card number. If card number is -1, then the first available card is returned. If the result card number is -1, no more cards are available.

Types

type CTL

type CTL struct {
	Ptr unsafe.Pointer
}

CTL handle

func CTLOpen

func CTLOpen(name string, mode int) (CTL, error)

Opens a CTL.

func (CTL) CardInfo

func (ctl CTL) CardInfo(info CTLCardInfo) error

Get card related information.

func (CTL) Close

func (ctl CTL) Close() error

close CTL handle

Closes the specified CTL handle and frees all associated resources.

func (CTL) PCMInfo

func (ctl CTL) PCMInfo(info PCMInfo) error

Get info about a PCM device.

func (CTL) PCMNextDevice

func (ctl CTL) PCMNextDevice(device *int) error

Get next PCM device number.

type CTLCardInfo

type CTLCardInfo struct {
	Ptr unsafe.Pointer
}

CTL card info container

func NewCTLCardInfo

func NewCTLCardInfo() (CTLCardInfo, error)

func (CTLCardInfo) Free

func (info CTLCardInfo) Free()

func (CTLCardInfo) GetCard

func (info CTLCardInfo) GetCard() int

Get card number from a CTL card info.

func (CTLCardInfo) GetComponents

func (info CTLCardInfo) GetComponents() string

Get card component list from a CTL card info.

func (CTLCardInfo) GetDriver

func (info CTLCardInfo) GetDriver() string

Get card driver name from a CTL card info.

func (CTLCardInfo) GetID

func (info CTLCardInfo) GetID() string

Get card identifier from a CTL card info.

func (CTLCardInfo) GetLongName

func (info CTLCardInfo) GetLongName() string

Get card long name from a CTL card info.

func (CTLCardInfo) GetMixerName

func (info CTLCardInfo) GetMixerName() string

Get card mixer name from a CTL card info.

func (CTLCardInfo) GetName

func (info CTLCardInfo) GetName() string

Get card name from a CTL card info.

type DeviceNameHints

type DeviceNameHints struct {
	// it pointer to a array of unsafe.Pointer, type in C is void**
	Ptr *unsafe.Pointer
}

func GetDeviceNameHints

func GetDeviceNameHints(card int, iface string) (DeviceNameHints, error)

Get a set of device name hints.

func (DeviceNameHints) Free

func (v DeviceNameHints) Free()

func (DeviceNameHints) Iter

type DeviceNameHintsIter

type DeviceNameHintsIter struct {
	// contains filtered or unexported fields
}

func (DeviceNameHintsIter) Get

func (iter DeviceNameHintsIter) Get(id string) string

func (*DeviceNameHintsIter) Next

func (iter *DeviceNameHintsIter) Next() bool

type Error

type Error struct {
	// contains filtered or unexported fields
}

func (*Error) Error

func (err *Error) Error() string

type Mixer

type Mixer struct {
	Ptr unsafe.Pointer
}

func OpenMixer

func OpenMixer(mode int) (Mixer, error)

Opens an empty mixer.

func (Mixer) Attach

func (m Mixer) Attach(name string) error

Attach an HCTL specified with the CTL device name to an opened mixer.

func (Mixer) Close

func (m Mixer) Close() error

Close a mixer and free all related resources.

func (Mixer) FindSelem

func (m Mixer) FindSelem(id MixerSelemId) MixerElem

Find a mixer simple element.

func (Mixer) FirstElem

func (m Mixer) FirstElem() MixerElem

get first element for a mixer

func (Mixer) Free

func (m Mixer) Free()

Unload all mixer elements and free all related resources.

func (Mixer) Load

func (m Mixer) Load() error

Load a mixer elements.

func (Mixer) SelemRegister

func (m Mixer) SelemRegister(options *MixerSelemRegopt, class *MixerClass) error

Register mixer simple element class.

type MixerClass

type MixerClass struct {
	Ptr unsafe.Pointer
}

type MixerElem

type MixerElem struct {
	Ptr unsafe.Pointer
}

func (MixerElem) GetSelemId

func (e MixerElem) GetSelemId(id MixerSelemId)

Get mixer simple element identifier.

func (MixerElem) Next

func (e MixerElem) Next() MixerElem

get next mixer element

func (MixerElem) Prev

func (e MixerElem) Prev() MixerElem

get previous mixer element

func (MixerElem) SelemGetCaptureDB

func (e MixerElem) SelemGetCaptureDB(channel MixerSelemChannelId) (int, error)

Return value of capture volume in dB control of a mixer simple element. return value (dB * 100)

func (MixerElem) SelemGetCaptureDBRange

func (e MixerElem) SelemGetCaptureDBRange() (min, max int)

Get range in dB for capture volume of a mixer simple element. return minimum (dB * 100) and maximum (dB * 100)

func (MixerElem) SelemGetCaptureGroup

func (e MixerElem) SelemGetCaptureGroup() int

Return info about capture switch control of a mixer simple element. return group for switch exclusivity

func (MixerElem) SelemGetCaptureSwitch

func (e MixerElem) SelemGetCaptureSwitch(channel MixerSelemChannelId) (bool, error)

Return value of capture switch control of a mixer simple element.

func (MixerElem) SelemGetCaptureVolume

func (e MixerElem) SelemGetCaptureVolume(channel MixerSelemChannelId) (int, error)

Return value of capture volume control of a mixer simple element.

func (MixerElem) SelemGetCaptureVolumeRange

func (e MixerElem) SelemGetCaptureVolumeRange() (min, max int)

Get range for capture volume of a mixer simple element.

func (MixerElem) SelemGetEnumItem

func (e MixerElem) SelemGetEnumItem(channel MixerSelemChannelId) (uint, error)

get the current selected enumerated item for the given mixer simple element

func (MixerElem) SelemGetEnumItemName

func (e MixerElem) SelemGetEnumItemName(item uint, maxLen int) (string, error)

get the enumerated item string for the given mixer simple element

func (MixerElem) SelemGetEnumItems

func (e MixerElem) SelemGetEnumItems() (int, error)

Return the number of enumerated items of the given mixer simple element.

func (MixerElem) SelemGetPlaybackDB

func (e MixerElem) SelemGetPlaybackDB(channel MixerSelemChannelId) (int, error)

Return value of playback volume in dB control of a mixer simple element. return value (dB * 100)

func (MixerElem) SelemGetPlaybackDBRange

func (e MixerElem) SelemGetPlaybackDBRange() (min, max int)

Get range in dB for playback volume of a mixer simple element. return minimum (dB * 100) and maximum (dB * 100)

func (MixerElem) SelemGetPlaybackSwitch

func (e MixerElem) SelemGetPlaybackSwitch(channel MixerSelemChannelId) (bool, error)

Return value of playback switch control of a mixer simple element.

func (MixerElem) SelemGetPlaybackVolume

func (e MixerElem) SelemGetPlaybackVolume(channel MixerSelemChannelId) (int, error)

Return value of playback volume control of a mixer simple element.

func (MixerElem) SelemGetPlaybackVolumeRange

func (e MixerElem) SelemGetPlaybackVolumeRange() (min, max int)

Get range for playback volume of a mixer simple element.

func (MixerElem) SelemHasCaptureChannel

func (e MixerElem) SelemHasCaptureChannel(channel MixerSelemChannelId) bool

Get info about channels of capture stream of a mixer simple element. return false if channel is not present, true if present

func (MixerElem) SelemHasCaptureSwitch

func (e MixerElem) SelemHasCaptureSwitch() bool

Return info about capture switch control existence of a mixer simple element. return false if no control is present, true if it's present

func (MixerElem) SelemHasCaptureSwitchExclusive

func (e MixerElem) SelemHasCaptureSwitchExclusive() bool

Return info about capture switch control of a mixer simple element. return false if control is separated per element, true if control acts on other elements too (i.e. only one active at a time inside a group)

func (MixerElem) SelemHasCaptureSwitchJoined

func (e MixerElem) SelemHasCaptureSwitchJoined() bool

Return info about capture switch control of a mixer simple element. return false if control is separated per channel, true if control acts on all channels together

func (MixerElem) SelemHasCaptureVolume

func (e MixerElem) SelemHasCaptureVolume() bool

Return info about capture volume control of a mixer simple element. return false if no control is present, true if it's present

func (MixerElem) SelemHasCaptureVolumeJoined

func (e MixerElem) SelemHasCaptureVolumeJoined() bool

Return info about capture volume control of a mixer simple element. return false if control is separated per channel, true if control acts on all channels together

func (MixerElem) SelemHasCommonSwitch

func (e MixerElem) SelemHasCommonSwitch() bool

Return true if mixer simple element has only one switch control for both playback and capture.

func (MixerElem) SelemHasCommonVolume

func (e MixerElem) SelemHasCommonVolume() bool

Return true if mixer simple element has only one volume control for both playback and capture.

func (MixerElem) SelemHasPlaybackChannel

func (e MixerElem) SelemHasPlaybackChannel(channel MixerSelemChannelId) bool

Get info about channels of playback stream of a mixer simple element. return false if channel is not present, true if present

func (MixerElem) SelemHasPlaybackSwitch

func (e MixerElem) SelemHasPlaybackSwitch() bool

Return info about playback switch control existence of a mixer simple element.

func (MixerElem) SelemHasPlaybackSwitchJoined

func (e MixerElem) SelemHasPlaybackSwitchJoined() bool

Return info about playback switch control of a mixer simple element. return false if control is separated per channel, true if control acts on all channels together

func (MixerElem) SelemHasPlaybackVolume

func (e MixerElem) SelemHasPlaybackVolume() bool

Return info about playback volume control of a mixer simple element. return false if no control is present, true if it's present

func (MixerElem) SelemHasPlaybackVolumeJoined

func (e MixerElem) SelemHasPlaybackVolumeJoined() bool

Return info about playback volume control of a mixer simple element. return false if control is separated per channel, true if control acts on all channels together

func (MixerElem) SelemIsActive

func (e MixerElem) SelemIsActive() bool

Get info about the active state of a mixer simple element.

func (MixerElem) SelemIsCaptureMono

func (e MixerElem) SelemIsCaptureMono() bool

Get info about channels of capture stream of a mixer simple element. return false if not mono, true if mono

func (MixerElem) SelemIsEnumCapture

func (e MixerElem) SelemIsEnumCapture() bool

Return true if mixer simple enumerated element belongs to the capture direction.

func (MixerElem) SelemIsEnumPlayback

func (e MixerElem) SelemIsEnumPlayback() bool

Return true if mixer simple enumerated element belongs to the playback direction.

func (MixerElem) SelemIsEnumerated

func (e MixerElem) SelemIsEnumerated() bool

Return true if mixer simple element is an enumerated control.

func (MixerElem) SelemIsPlaybackMono

func (e MixerElem) SelemIsPlaybackMono() bool

Get info about channels of playback stream of a mixer simple element. return false if not mono, true if mono

func (MixerElem) SelemSetCaptureDB

func (e MixerElem) SelemSetCaptureDB(channel MixerSelemChannelId, value, dir int) error

Set value in dB of capture volume control of a mixer simple element. value: control value in dB * 100 dir: rounding mode - rounds up if dir > 0, otherwise rounds down

func (MixerElem) SelemSetCaptureDBAll

func (e MixerElem) SelemSetCaptureDBAll(value, dir int) error

Set value in dB of capture volume control for all channels of a mixer simple element. value: control value in dB * 100 dir: rounding mode - rounds up if dir > 0, otherwise rounds down

func (MixerElem) SelemSetCaptureSwitch

func (e MixerElem) SelemSetCaptureSwitch(channel MixerSelemChannelId, value bool) error

Set value of capture switch control of a mixer simple element.

func (MixerElem) SelemSetCaptureSwitchAll

func (e MixerElem) SelemSetCaptureSwitchAll(value bool) error

Set value of capture switch control for all channels of a mixer simple element.

func (MixerElem) SelemSetCaptureVolume

func (e MixerElem) SelemSetCaptureVolume(channel MixerSelemChannelId, value int) error

Set value of capture volume control of a mixer simple element.

func (MixerElem) SelemSetCaptureVolumeAll

func (e MixerElem) SelemSetCaptureVolumeAll(value int) error

Set value of capture volume control for all channels of a mixer simple element.

func (MixerElem) SelemSetPlaybackDB

func (e MixerElem) SelemSetPlaybackDB(channel MixerSelemChannelId, value, dir int) error

Set value in dB of playback volume control of a mixer simple element. value: control value in dB * 100 dir: rounding mode - rounds up if dir > 0, otherwise rounds down

func (MixerElem) SelemSetPlaybackDBAll

func (e MixerElem) SelemSetPlaybackDBAll(value, dir int) error

Set value in dB of playback volume control for all channels of a mixer simple element. value: control value in dB * 100 dir: rounding mode - rounds up if dir > 0, otherwise rounds down

func (MixerElem) SelemSetPlaybackSwitch

func (e MixerElem) SelemSetPlaybackSwitch(channel MixerSelemChannelId, value bool) error

Set value of playback switch control of a mixer simple element.

func (MixerElem) SelemSetPlaybackSwitchAll

func (e MixerElem) SelemSetPlaybackSwitchAll(value bool) error

Set value of playback switch control for all channels of a mixer simple element.

func (MixerElem) SelemSetPlaybackVolume

func (e MixerElem) SelemSetPlaybackVolume(channel MixerSelemChannelId, value int) error

Set value of playback volume control of a mixer simple element.

func (MixerElem) SelemSetPlaybackVolumeAll

func (e MixerElem) SelemSetPlaybackVolumeAll(value int) error

Set value of playback volume control for all channels of a mixer simple element.

type MixerSelem

type MixerSelem struct {
	Ptr unsafe.Pointer
}

type MixerSelemChannelId

type MixerSelemChannelId C.snd_mixer_selem_channel_id_t

Mixer simple element channel identifier

func (MixerSelemChannelId) Name

func (id MixerSelemChannelId) Name() string

Return name of mixer simple element channel.

type MixerSelemId

type MixerSelemId struct {
	Ptr unsafe.Pointer
}

func NewMixerSelemId

func NewMixerSelemId() (MixerSelemId, error)

func (MixerSelemId) Free

func (id MixerSelemId) Free()

func (MixerSelemId) GetIndex

func (id MixerSelemId) GetIndex() uint

Get index part of a mixer simple element identifier.

func (MixerSelemId) GetName

func (id MixerSelemId) GetName() string

Get name part of mixer simple element identifier.

type MixerSelemRegopt

type MixerSelemRegopt struct {
	// contains filtered or unexported fields
}

func (*MixerSelemRegopt) Free

func (opt *MixerSelemRegopt) Free()

func (*MixerSelemRegopt) SetAbstract

func (opt *MixerSelemRegopt) SetAbstract(val int)

func (*MixerSelemRegopt) SetCapturePCM

func (opt *MixerSelemRegopt) SetCapturePCM(pcm PCM)

func (*MixerSelemRegopt) SetDevice

func (opt *MixerSelemRegopt) SetDevice(device string)

func (*MixerSelemRegopt) SetPlaybackPCM

func (opt *MixerSelemRegopt) SetPlaybackPCM(pcm PCM)

func (*MixerSelemRegopt) SetVer

func (opt *MixerSelemRegopt) SetVer(ver int)

type Output

type Output struct {
	Ptr unsafe.Pointer
}

Internal structure for an output object.

The ALSA library uses a pointer to this structure as a handle to an output object. Applications don't access its contents directly.

func OpenOutput

func OpenOutput(file, mode string) (Output, error)

Creates a new output object writing to a file.

func (Output) Close

func (o Output) Close() error

Closes an output handle.

func (Output) Flush

func (o Output) Flush() error

Flushes an output handle (like fflush(3)).

func (Output) Printf

func (o Output) Printf(format string, a ...interface{}) error

func (Output) Println

func (o Output) Println(a ...interface{}) error

func (Output) WriteString

func (o Output) WriteString(str string) error

Writes a string to an output handle (like fputs(3)).

type PCM

type PCM struct {
	Ptr unsafe.Pointer
}

PCM handle

func OpenPCM

func OpenPCM(name string, stream PCMStream, mode int) (PCM, error)

Opens a PCM.

func (PCM) Close

func (pcm PCM) Close() error

close PCM handle

Closes the specified PCM handle and frees all associated resources.

func (PCM) Drain

func (pcm PCM) Drain() error

Stop a PCM preserving pending frames.

For playback wait for all pending frames to be played and then stop the PCM. For capture stop PCM permitting to retrieve residual frames.

func (PCM) Drop

func (pcm PCM) Drop() error

Stop a PCM dropping pending frames.

This function stops the PCM immediately. The pending samples on the buffer are ignored.

func (PCM) Dump

func (pcm PCM) Dump(out Output) error

func (PCM) DumpHwSetup

func (pcm PCM) DumpHwSetup(out Output) error

func (PCM) DumpSetup

func (pcm PCM) DumpSetup(out Output) error

func (PCM) DumpSwSetup

func (pcm PCM) DumpSwSetup(out Output) error

func (PCM) HwFree

func (pcm PCM) HwFree() error

Remove PCM hardware configuration and free associated resources.

func (PCM) HwParams

func (pcm PCM) HwParams(params PCMHwParams) error

Install one PCM hardware configuration chosen from a configuration space and snd_pcm_prepare it.

The configuration is chosen fixing single parameters in this order: first access, first format, first subformat, min channels, min rate, min period time, max buffer size, min tick time. If no mutually compatible set of parameters can be chosen, a negative error code will be returned.

After this call, snd_pcm_prepare() is called automatically and the stream is brought to SND_PCM_STATE_PREPARED state.

The hardware parameters cannot be changed when the stream is running (active). The software parameters can be changed at any time.

The configuration space will be updated to reflect the chosen parameters.

func (PCM) HwParamsAny

func (pcm PCM) HwParamsAny(params PCMHwParams)

Fill params with a full configuration space for a PCM.

The configuration space will be filled with all possible ranges for the PCM device.

func (PCM) HwParamsSetAccess

func (pcm PCM) HwParamsSetAccess(params PCMHwParams, access PCMAccess) error

Restrict a configuration space to contain only one access type.

func (PCM) HwParamsSetBufferSize

func (pcm PCM) HwParamsSetBufferSize(params PCMHwParams, val PCMUFrames) error

Restrict a configuration space to contain only one buffer size.

func (PCM) HwParamsSetBufferTimeNear

func (pcm PCM) HwParamsSetBufferTimeNear(params PCMHwParams, val uint) (uint, int, error)

Restrict a configuration space to have buffer time nearest to a target.

func (PCM) HwParamsSetChannels

func (pcm PCM) HwParamsSetChannels(params PCMHwParams, val uint) error

Restrict a configuration space to contain only one channels count.

func (PCM) HwParamsSetFormat

func (pcm PCM) HwParamsSetFormat(params PCMHwParams, format PCMFormat) error

Restrict a configuration space to contain only one format.

func (PCM) HwParamsSetPeriodSize

func (pcm PCM) HwParamsSetPeriodSize(params PCMHwParams, val PCMUFrames, dir int) error

Restrict a configuration space to contain only one period size.

func (PCM) HwParamsSetPeriodSizeNear

func (pcm PCM) HwParamsSetPeriodSizeNear(params PCMHwParams, val PCMUFrames) (PCMUFrames, int, error)

Restrict a configuration space to have period size nearest to a target.

func (PCM) HwParamsSetPeriodTimeNear

func (pcm PCM) HwParamsSetPeriodTimeNear(params PCMHwParams, val uint) (uint, int, error)

Restrict a configuration space to have period time nearest to a target.

func (PCM) HwParamsSetRate

func (pcm PCM) HwParamsSetRate(params PCMHwParams, val uint, dir int) error

Restrict a configuration space to contain only one rate.

func (PCM) HwParamsSetRateNear

func (pcm PCM) HwParamsSetRateNear(params PCMHwParams, val uint) (uint, int, error)

Restrict a configuration space to have rate nearest to a target.

func (PCM) Info

func (pcm PCM) Info(info PCMInfo) error

Obtain general (static) information for PCM handle.

func (PCM) Name

func (pcm PCM) Name() string

get identifier of PCM handle

func (PCM) Pause

func (pcm PCM) Pause(enable bool) error

Pause/resume PCM.

func (PCM) Prepare

func (pcm PCM) Prepare() error

Prepare PCM for use.

func (PCM) Recover

func (pcm PCM) Recover(err int, silent bool) error

Recover the stream state from an error or suspend.

This a high-level helper function building on other functions.

This functions handles -EINTR (interrupted system call), -EPIPE (overrun or underrun) and -ESTRPIPE (stream is suspended) error codes trying to prepare given stream for next I/O.

Note that this function returs the original error code when it is not handled inside this function (for example -EAGAIN is returned back).

func (PCM) Reset

func (pcm PCM) Reset() error

Reset PCM position.

Reduce PCM delay to 0.

func (PCM) Resume

func (pcm PCM) Resume() error

Resume from suspend, no samples are lost.

This function can be used when the stream is in the suspend state to do the fine resume from this state. Not all hardware supports this feature, when an -ENOSYS error is returned, use the PCM.Prepare() function to recovery.

func (PCM) Start

func (pcm PCM) Start() error

Start a PCM.

func (PCM) State

func (pcm PCM) State() PCMState

Return PCM state.

This is a faster way to obtain only the PCM state without calling PCM.Status().

func (PCM) Stream

func (pcm PCM) Stream() PCMStream

get stream for a PCM handle

func (PCM) Type

func (pcm PCM) Type() PCMType

get type of PCM handle

func (PCM) Writei

func (pcm PCM) Writei(buffer unsafe.Pointer, size PCMUFrames) (PCMUFrames, error)

Write interleaved frames to a PCM.

If the blocking behaviour is selected and it is running, then routine waits until all requested frames are played or put to the playback ring buffer. The returned number of frames can be less only if a signal or underrun occurred.

If the non-blocking behaviour is selected, then routine doesn't wait at all.

type PCMAccess

type PCMAccess C.snd_pcm_access_t

PCM access type

func (PCMAccess) Name

func (access PCMAccess) Name() string

get name of PCM access type

type PCMClass

type PCMClass C.snd_pcm_class_t

PCM class

type PCMFormat

type PCMFormat C.snd_pcm_format_t

Format is the type used for specifying sample formats.

func (PCMFormat) Name

func (format PCMFormat) Name() string

func (PCMFormat) Size

func (format PCMFormat) Size(samples uint) int

Size return bytes needed to store a quantity of PCM sample.

type PCMHwParams

type PCMHwParams struct {
	Ptr unsafe.Pointer
}

PCM hardware configuration space container

snd_pcm_hw_params_t is an opaque structure which contains a set of possible PCM hardware configurations. For example, a given instance might include a range of buffer sizes, a range of period sizes, and a set of several sample formats. Some subset of all possible combinations these sets may be valid, but not necessarily any combination will be valid.

When a parameter is set or restricted using a snd_pcm_hw_params_set* function, all of the other ranges will be updated to exclude as many impossible configurations as possible. Attempting to set a parameter outside of its acceptable range will result in the function failing and an error code being returned.

func NewPCMHwParams

func NewPCMHwParams() (PCMHwParams, error)

func (PCMHwParams) Dump

func (params PCMHwParams) Dump(out Output) error

Dump a PCM hardware configuration space.

func (PCMHwParams) Free

func (params PCMHwParams) Free()

func (PCMHwParams) GetBufferTimeMax

func (params PCMHwParams) GetBufferTimeMax() (val uint, dir int, err error)

Extract maximum buffer time from a configuration space. val approximate maximum buffer duration in us

func (PCMHwParams) GetPeriodSize

func (params PCMHwParams) GetPeriodSize() (PCMUFrames, int, error)

Extract period size from a configuration space.

func (PCMHwParams) GetPeriodTime

func (params PCMHwParams) GetPeriodTime() (uint, int, error)

Extract period time from a configuration space. time unit us microseconds

type PCMInfo

type PCMInfo struct {
	Ptr unsafe.Pointer
}

PCM generic info container

func NewPCMInfo

func NewPCMInfo() (PCMInfo, error)

func (PCMInfo) Free

func (info PCMInfo) Free()

func (PCMInfo) GetCard

func (info PCMInfo) GetCard() int

Get card from a PCM info container.

func (PCMInfo) GetClass

func (info PCMInfo) GetClass() PCMClass

Get class from a PCM info container.

func (PCMInfo) GetID

func (info PCMInfo) GetID() string

Get id from a PCM info container.

func (PCMInfo) GetName

func (info PCMInfo) GetName() string

Get name from a PCM info container.

func (PCMInfo) GetStream

func (info PCMInfo) GetStream() PCMStream

Get stream (direction) from a PCM info container.

func (PCMInfo) GetSubclass

func (info PCMInfo) GetSubclass() PCMSubclass

Get subclass from a PCM info container.

func (PCMInfo) GetSubdevice

func (info PCMInfo) GetSubdevice() uint

Get subdevice from a PCM info container.

func (PCMInfo) GetSubdeviceName

func (info PCMInfo) GetSubdeviceName() string

Get subdevice name from a PCM info container.

func (PCMInfo) GetSubdevicesAvail

func (info PCMInfo) GetSubdevicesAvail() uint

Get available subdevices count from a PCM info container.

func (PCMInfo) GetSubdevicesCount

func (info PCMInfo) GetSubdevicesCount() uint

Get subdevices count from a PCM info container.

func (PCMInfo) SetDevice

func (info PCMInfo) SetDevice(val uint)

Set wanted device inside a PCM info container

func (PCMInfo) SetStream

func (info PCMInfo) SetStream(val PCMStream)

Set wanted stream inside a PCM info container

func (PCMInfo) SetSubdevice

func (info PCMInfo) SetSubdevice(val uint)

Set wanted sub device inside a PCM info container

type PCMSFrames

type PCMSFrames C.snd_pcm_sframes_t

Signed frames quantity

type PCMState

type PCMState C.snd_pcm_state_t

PCM state

type PCMStream

type PCMStream C.snd_pcm_stream_t

PCM Stream

func (PCMStream) Name

func (stream PCMStream) Name() string

type PCMSubclass

type PCMSubclass C.snd_pcm_subclass_t

PCM subclass

type PCMSubformat

type PCMSubformat C.snd_pcm_subformat_t

PCM sample subformat

func (PCMSubformat) Desc

func (subformat PCMSubformat) Desc() string

func (PCMSubformat) Name

func (subformat PCMSubformat) Name() string

type PCMType

type PCMType C.snd_pcm_type_t

PCM type

func (PCMType) Name

func (typ PCMType) Name() string

type PCMUFrames

type PCMUFrames C.snd_pcm_uframes_t

Unsigned frames quantity

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL