device

package
v1.9.13 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SNDRV_PCM_STREAM_PLAYBACK = 0
	SNDRV_PCM_STREAM_CAPTURE  = 1

	SNDRV_PCM_ACCESS_MMAP_INTERLEAVED    = 0
	SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED = 1
	SNDRV_PCM_ACCESS_MMAP_COMPLEX        = 2
	SNDRV_PCM_ACCESS_RW_INTERLEAVED      = 3
	SNDRV_PCM_ACCESS_RW_NONINTERLEAVED   = 4

	SNDRV_PCM_FORMAT_S8         = 0
	SNDRV_PCM_FORMAT_U8         = 1
	SNDRV_PCM_FORMAT_S16_LE     = 2
	SNDRV_PCM_FORMAT_S16_BE     = 3
	SNDRV_PCM_FORMAT_U16_LE     = 4
	SNDRV_PCM_FORMAT_U16_BE     = 5
	SNDRV_PCM_FORMAT_S24_LE     = 6
	SNDRV_PCM_FORMAT_S24_BE     = 7
	SNDRV_PCM_FORMAT_U24_LE     = 8
	SNDRV_PCM_FORMAT_U24_BE     = 9
	SNDRV_PCM_FORMAT_S32_LE     = 10
	SNDRV_PCM_FORMAT_S32_BE     = 11
	SNDRV_PCM_FORMAT_U32_LE     = 12
	SNDRV_PCM_FORMAT_U32_BE     = 13
	SNDRV_PCM_FORMAT_FLOAT_LE   = 14
	SNDRV_PCM_FORMAT_FLOAT_BE   = 15
	SNDRV_PCM_FORMAT_FLOAT64_LE = 16
	SNDRV_PCM_FORMAT_FLOAT64_BE = 17
	SNDRV_PCM_FORMAT_MU_LAW     = 20
	SNDRV_PCM_FORMAT_A_LAW      = 21
	SNDRV_PCM_FORMAT_MPEG       = 23

	SNDRV_PCM_IOCTL_PVERSION      = 0x80044100
	SNDRV_PCM_IOCTL_INFO          = 0x81204101
	SNDRV_PCM_IOCTL_HW_REFINE     = 0xc2604110
	SNDRV_PCM_IOCTL_HW_PARAMS     = 0xc2604111
	SNDRV_PCM_IOCTL_SW_PARAMS     = 0xc0884113
	SNDRV_PCM_IOCTL_PREPARE       = 0x00004140
	SNDRV_PCM_IOCTL_WRITEI_FRAMES = 0x40184150
	SNDRV_PCM_IOCTL_READI_FRAMES  = 0x80184151
)
View Source
const (
	SNDRV_PCM_HW_PARAM_ACCESS     = 0
	SNDRV_PCM_HW_PARAM_FORMAT     = 1
	SNDRV_PCM_HW_PARAM_SUBFORMAT  = 2
	SNDRV_PCM_HW_PARAM_FIRST_MASK = 0
	SNDRV_PCM_HW_PARAM_LAST_MASK  = 2

	SNDRV_PCM_HW_PARAM_SAMPLE_BITS    = 8
	SNDRV_PCM_HW_PARAM_FRAME_BITS     = 9
	SNDRV_PCM_HW_PARAM_CHANNELS       = 10
	SNDRV_PCM_HW_PARAM_RATE           = 11
	SNDRV_PCM_HW_PARAM_PERIOD_TIME    = 12
	SNDRV_PCM_HW_PARAM_PERIOD_SIZE    = 13
	SNDRV_PCM_HW_PARAM_PERIOD_BYTES   = 14
	SNDRV_PCM_HW_PARAM_PERIODS        = 15
	SNDRV_PCM_HW_PARAM_BUFFER_TIME    = 16
	SNDRV_PCM_HW_PARAM_BUFFER_SIZE    = 17
	SNDRV_PCM_HW_PARAM_BUFFER_BYTES   = 18
	SNDRV_PCM_HW_PARAM_TICK_TIME      = 19
	SNDRV_PCM_HW_PARAM_FIRST_INTERVAL = 8
	SNDRV_PCM_HW_PARAM_LAST_INTERVAL  = 19

	SNDRV_MASK_MAX = 256

	SNDRV_PCM_TSTAMP_NONE   = 0
	SNDRV_PCM_TSTAMP_ENABLE = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

func Open

func Open(path string) (*Device, error)

func (*Device) CheckFormat

func (d *Device) CheckFormat(format byte) bool

func (*Device) Close

func (d *Device) Close() error

func (*Device) GetChannelsNear

func (d *Device) GetChannelsNear(channels byte) byte

func (*Device) GetRateNear

func (d *Device) GetRateNear(rate uint32) uint32

func (*Device) Info

func (d *Device) Info() (*Info, error)

func (*Device) IsCapture

func (d *Device) IsCapture() bool

func (*Device) ListFormats

func (d *Device) ListFormats() (formats []byte)

func (*Device) RangeChannels

func (d *Device) RangeChannels() (byte, byte)

func (*Device) RangeRates

func (d *Device) RangeRates() (uint32, uint32)

func (*Device) Read

func (d *Device) Read(b []byte) (n int, err error)

func (*Device) SetHWParams

func (d *Device) SetHWParams(format byte, rate uint32, channels byte) error

func (*Device) Write

func (d *Device) Write(b []byte) (n int, err error)

type Info

type Info struct {
	Card      int
	Device    int
	SubDevice int
	Stream    int
	ID        string
	Name      string
	SubName   string
}

Jump to

Keyboard shortcuts

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