Documentation ¶
Index ¶
- Constants
- Variables
- func CardLoad(card int) bool
- func CardNext(rcard *int) error
- type CTL
- type CTLCardInfo
- func (info CTLCardInfo) Free()
- func (info CTLCardInfo) GetCard() int
- func (info CTLCardInfo) GetComponents() string
- func (info CTLCardInfo) GetDriver() string
- func (info CTLCardInfo) GetID() string
- func (info CTLCardInfo) GetLongName() string
- func (info CTLCardInfo) GetMixerName() string
- func (info CTLCardInfo) GetName() string
- type DeviceNameHints
- type DeviceNameHintsIter
- type Error
- type Mixer
- type MixerClass
- type MixerElem
- func (e MixerElem) GetSelemId(id MixerSelemId)
- func (e MixerElem) Next() MixerElem
- func (e MixerElem) Prev() MixerElem
- func (e MixerElem) SelemGetCaptureDB(channel MixerSelemChannelId) (int, error)
- func (e MixerElem) SelemGetCaptureDBRange() (min, max int)
- func (e MixerElem) SelemGetCaptureGroup() int
- func (e MixerElem) SelemGetCaptureSwitch(channel MixerSelemChannelId) (bool, error)
- func (e MixerElem) SelemGetCaptureVolume(channel MixerSelemChannelId) (int, error)
- func (e MixerElem) SelemGetCaptureVolumeRange() (min, max int)
- func (e MixerElem) SelemGetEnumItem(channel MixerSelemChannelId) (uint, error)
- func (e MixerElem) SelemGetEnumItemName(item uint, maxLen int) (string, error)
- func (e MixerElem) SelemGetEnumItems() (int, error)
- func (e MixerElem) SelemGetPlaybackDB(channel MixerSelemChannelId) (int, error)
- func (e MixerElem) SelemGetPlaybackDBRange() (min, max int)
- func (e MixerElem) SelemGetPlaybackSwitch(channel MixerSelemChannelId) (bool, error)
- func (e MixerElem) SelemGetPlaybackVolume(channel MixerSelemChannelId) (int, error)
- func (e MixerElem) SelemGetPlaybackVolumeRange() (min, max int)
- func (e MixerElem) SelemHasCaptureChannel(channel MixerSelemChannelId) bool
- func (e MixerElem) SelemHasCaptureSwitch() bool
- func (e MixerElem) SelemHasCaptureSwitchExclusive() bool
- func (e MixerElem) SelemHasCaptureSwitchJoined() bool
- func (e MixerElem) SelemHasCaptureVolume() bool
- func (e MixerElem) SelemHasCaptureVolumeJoined() bool
- func (e MixerElem) SelemHasCommonSwitch() bool
- func (e MixerElem) SelemHasCommonVolume() bool
- func (e MixerElem) SelemHasPlaybackChannel(channel MixerSelemChannelId) bool
- func (e MixerElem) SelemHasPlaybackSwitch() bool
- func (e MixerElem) SelemHasPlaybackSwitchJoined() bool
- func (e MixerElem) SelemHasPlaybackVolume() bool
- func (e MixerElem) SelemHasPlaybackVolumeJoined() bool
- func (e MixerElem) SelemIsActive() bool
- func (e MixerElem) SelemIsCaptureMono() bool
- func (e MixerElem) SelemIsEnumCapture() bool
- func (e MixerElem) SelemIsEnumPlayback() bool
- func (e MixerElem) SelemIsEnumerated() bool
- func (e MixerElem) SelemIsPlaybackMono() bool
- func (e MixerElem) SelemSetCaptureDB(channel MixerSelemChannelId, value, dir int) error
- func (e MixerElem) SelemSetCaptureDBAll(value, dir int) error
- func (e MixerElem) SelemSetCaptureSwitch(channel MixerSelemChannelId, value bool) error
- func (e MixerElem) SelemSetCaptureSwitchAll(value bool) error
- func (e MixerElem) SelemSetCaptureVolume(channel MixerSelemChannelId, value int) error
- func (e MixerElem) SelemSetCaptureVolumeAll(value int) error
- func (e MixerElem) SelemSetPlaybackDB(channel MixerSelemChannelId, value, dir int) error
- func (e MixerElem) SelemSetPlaybackDBAll(value, dir int) error
- func (e MixerElem) SelemSetPlaybackSwitch(channel MixerSelemChannelId, value bool) error
- func (e MixerElem) SelemSetPlaybackSwitchAll(value bool) error
- func (e MixerElem) SelemSetPlaybackVolume(channel MixerSelemChannelId, value int) error
- func (e MixerElem) SelemSetPlaybackVolumeAll(value int) error
- type MixerSelem
- type MixerSelemChannelId
- type MixerSelemId
- type MixerSelemRegopt
- type Output
- type PCM
- func (pcm PCM) Close() error
- func (pcm PCM) Drain() error
- func (pcm PCM) Drop() error
- func (pcm PCM) Dump(out Output) error
- func (pcm PCM) DumpHwSetup(out Output) error
- func (pcm PCM) DumpSetup(out Output) error
- func (pcm PCM) DumpSwSetup(out Output) error
- func (pcm PCM) HwFree() error
- func (pcm PCM) HwParams(params PCMHwParams) error
- func (pcm PCM) HwParamsAny(params PCMHwParams)
- func (pcm PCM) HwParamsSetAccess(params PCMHwParams, access PCMAccess) error
- func (pcm PCM) HwParamsSetBufferSize(params PCMHwParams, val PCMUFrames) error
- func (pcm PCM) HwParamsSetBufferTimeNear(params PCMHwParams, val *uint) (int, error)
- func (pcm PCM) HwParamsSetChannels(params PCMHwParams, val uint) error
- func (pcm PCM) HwParamsSetFormat(params PCMHwParams, format PCMFormat) error
- func (pcm PCM) HwParamsSetPeriodSize(params PCMHwParams, val PCMUFrames, dir int) error
- func (pcm PCM) HwParamsSetPeriodSizeNear(params PCMHwParams, val PCMUFrames) (PCMUFrames, int, error)
- func (pcm PCM) HwParamsSetPeriodTimeNear(params PCMHwParams, val *uint) (int, error)
- func (pcm PCM) HwParamsSetRate(params PCMHwParams, val uint, dir int) error
- func (pcm PCM) HwParamsSetRateNear(params PCMHwParams, val *uint) (int, error)
- func (pcm PCM) Info(info PCMInfo) error
- func (pcm PCM) Name() string
- func (pcm PCM) Pause(enable bool) error
- func (pcm PCM) Prepare() error
- func (pcm PCM) Recover(err int, silent bool) error
- func (pcm PCM) Reset() error
- func (pcm PCM) Resume() error
- func (pcm PCM) Start() error
- func (pcm PCM) State() PCMState
- func (pcm PCM) Stream() PCMStream
- func (pcm PCM) Type() PCMType
- func (pcm PCM) Writei(buffer unsafe.Pointer, size PCMUFrames) (PCMUFrames, error)
- type PCMAccess
- type PCMClass
- type PCMFormat
- type PCMHwParams
- type PCMInfo
- func (info PCMInfo) Free()
- func (info PCMInfo) GetCard() int
- func (info PCMInfo) GetClass() PCMClass
- func (info PCMInfo) GetID() string
- func (info PCMInfo) GetName() string
- func (info PCMInfo) GetStream() PCMStream
- func (info PCMInfo) GetSubclass() PCMSubclass
- func (info PCMInfo) GetSubdevice() uint
- func (info PCMInfo) GetSubdeviceName() string
- func (info PCMInfo) GetSubdevicesAvail() uint
- func (info PCMInfo) GetSubdevicesCount() uint
- func (info PCMInfo) SetDevice(val uint)
- func (info PCMInfo) SetStream(val PCMStream)
- func (info PCMInfo) SetSubdevice(val uint)
- type PCMSFrames
- type PCMState
- type PCMStream
- type PCMSubclass
- type PCMSubformat
- type PCMType
- type PCMUFrames
Constants ¶
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 PCMFormatS24_3LE = C.SND_PCM_FORMAT_S24_3LE PCMFormatS24_3BE = C.SND_PCM_FORMAT_S24_3BE 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.
const ( PCMStreamPlayback = C.SND_PCM_STREAM_PLAYBACK PCMStreamCapture = C.SND_PCM_STREAM_CAPTURE )
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 )
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 )
const ( MixerSAbstractNone = C.SND_MIXER_SABSTRACT_NONE MixerSAbstractBasic = C.SND_MIXER_SABSTRACT_BASIC )
Variables ¶
var ErrUnderrun = errors.New("underrun")
Functions ¶
Types ¶
type CTL ¶
CTL handle
func (CTL) Close ¶
close CTL handle
Closes the specified CTL handle and frees all associated resources.
func (CTL) PCMNextDevice ¶
Get next PCM device number.
type CTLCardInfo ¶
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 ¶
func (v DeviceNameHints) Iter() *DeviceNameHintsIter
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 Mixer ¶
func (Mixer) FindSelem ¶
func (m Mixer) FindSelem(id MixerSelemId) MixerElem
Find a mixer simple element.
func (Mixer) SelemRegister ¶
func (m Mixer) SelemRegister(options *MixerSelemRegopt, class *MixerClass) error
Register mixer simple element class.
type MixerClass ¶
type MixerElem ¶
func (MixerElem) GetSelemId ¶
func (e MixerElem) GetSelemId(id MixerSelemId)
Get mixer simple element identifier.
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 ¶
Get range in dB for capture volume of a mixer simple element. return minimum (dB * 100) and maximum (dB * 100)
func (MixerElem) SelemGetCaptureGroup ¶
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 ¶
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 ¶
get the enumerated item string for the given mixer simple element
func (MixerElem) SelemGetEnumItems ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
Return true if mixer simple element has only one switch control for both playback and capture.
func (MixerElem) SelemHasCommonVolume ¶
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 ¶
Return info about playback switch control existence of a mixer simple element.
func (MixerElem) SelemHasPlaybackSwitchJoined ¶
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 ¶
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 ¶
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 ¶
Get info about the active state of a mixer simple element.
func (MixerElem) SelemIsCaptureMono ¶
Get info about channels of capture stream of a mixer simple element. return false if not mono, true if mono
func (MixerElem) SelemIsEnumCapture ¶
Return true if mixer simple enumerated element belongs to the capture direction.
func (MixerElem) SelemIsEnumPlayback ¶
Return true if mixer simple enumerated element belongs to the playback direction.
func (MixerElem) SelemIsEnumerated ¶
Return true if mixer simple element is an enumerated control.
func (MixerElem) SelemIsPlaybackMono ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
Set value of playback volume control for all channels of a mixer simple element.
type MixerSelem ¶
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 ¶
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) 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 ¶
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 ¶
Creates a new output object writing to a file.
func (Output) WriteString ¶
Writes a string to an output handle (like fputs(3)).
type PCM ¶
PCM handle
func (PCM) Close ¶
close PCM handle
Closes the specified PCM handle and frees all associated resources.
func (PCM) Drain ¶
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 ¶
Stop a PCM dropping pending frames.
This function stops the PCM immediately. The pending samples on the buffer are ignored.
func (PCM) DumpHwSetup ¶
func (PCM) DumpSwSetup ¶
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) (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) (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) (int, error)
Restrict a configuration space to have rate nearest to a target.
func (PCM) Recover ¶
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) Resume ¶
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) State ¶
Return PCM state.
This is a faster way to obtain only the PCM state without calling PCM.Status().
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 PCMFormat ¶
type PCMFormat C.snd_pcm_format_t
Format is the type used for specifying sample formats.
type PCMHwParams ¶
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 ¶
PCM generic info container
func NewPCMInfo ¶
func (PCMInfo) GetSubclass ¶
func (info PCMInfo) GetSubclass() PCMSubclass
Get subclass from a PCM info container.
func (PCMInfo) GetSubdevice ¶
Get subdevice from a PCM info container.
func (PCMInfo) GetSubdeviceName ¶
Get subdevice name from a PCM info container.
func (PCMInfo) GetSubdevicesAvail ¶
Get available subdevices count from a PCM info container.
func (PCMInfo) GetSubdevicesCount ¶
Get subdevices count from a PCM info container.
func (PCMInfo) SetSubdevice ¶
Set wanted sub device inside a PCM info container
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