gosoundio

package module
v0.0.0-...-50daa09 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2018 License: MIT Imports: 4 Imported by: 0

README

gosoundio

Go wrapper for libsoundio, a cross-platform library for real-time audio input and output.

Building on macOS

You need to have libsoundio installed. You can install it with Homebrew. If you don't have Homebrew, install it first.

$ brew install libsoundio

Install this package using go get:

$ go get github.com/mojbro/gosoundio

Try it out using an example:

$ cd $GOPATH/src/github.com/mojbro/gosoundio/examples
$ go run experiment.go

Building on Linux, Windows, etc

I haven't tried it yet. If you manage to build it on Linux or Windows, please contribute by updating this README.

Documentation

Overview

Package gosoundio is a Go wrapper for libsoundio, cross-platform library for real-time audio input and output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

func (Device) Id

func (d Device) Id() string

Id returns the the device ID, a string that uniquely identifies this device.

func (Device) IsRaw

func (d Device) IsRaw() bool

IsRaw returns true if you are directly opening the hardware device without going through a proxy such as dmix, PulseAudio, or JACK.

When you open a raw device, other applications on the computer are not able to simultaneously access the device. Raw devices do not perform automatic resampling and thus tend to have fewer formats available.

func (Device) Name

func (d Device) Name() string

Name returns a user-friendly name that describes this device.

func (Device) Unref

func (d Device) Unref()

Unref releases the device reference. Call this when you are done using the device.

type Error

type Error int

Error represents a libsoundio error.

const (
	ErrorNoMem               Error = Error(C.SoundIoErrorNoMem)
	ErrorInitAudioBackend    Error = Error(C.SoundIoErrorInitAudioBackend)
	ErrorSystemResources     Error = Error(C.SoundIoErrorSystemResources)
	ErrorOpeningDevice       Error = Error(C.SoundIoErrorOpeningDevice)
	ErrorNoSuchDevice        Error = Error(C.SoundIoErrorNoSuchDevice)
	ErrorInvalid             Error = Error(C.SoundIoErrorInvalid)
	ErrorBackendUnavailable  Error = Error(C.SoundIoErrorBackendUnavailable)
	ErrorStreaming           Error = Error(C.SoundIoErrorStreaming)
	ErrorIncompatibleDevice  Error = Error(C.SoundIoErrorIncompatibleDevice)
	ErrorNoSuchClient        Error = Error(C.SoundIoErrorNoSuchClient)
	ErrorIncompatibleBackend Error = Error(C.SoundIoErrorIncompatibleBackend)
	ErrorBackendDisconnected Error = Error(C.SoundIoErrorBackendDisconnected)
	ErrorInterrupted         Error = Error(C.SoundIoErrorInterrupted)
	ErrorUnderflow           Error = Error(C.SoundIoErrorUnderflow)
	ErrorEncodingString      Error = Error(C.SoundIoErrorEncodingString)
)

SoundIo Errors.

func (Error) Error

func (e Error) Error() string

type OutStream

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

func NewOutStream

func NewOutStream(d Device, f func(*OutStream, int, int)) (*OutStream, error)

func (*OutStream) ClearBuffer

func (o *OutStream) ClearBuffer() error

func (*OutStream) Destroy

func (o *OutStream) Destroy()

func (*OutStream) Open

func (o *OutStream) Open() error

func (*OutStream) Run

func (o *OutStream) Run()

Temporary function that starts out stream and waits for events forever

type SoundIO

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

func CreateSoundIO

func CreateSoundIO() (*SoundIO, error)

func (SoundIO) Connect

func (s SoundIO) Connect() error

func (SoundIO) DefaultOutputDeviceIndex

func (s SoundIO) DefaultOutputDeviceIndex() (index int, err error)

func (*SoundIO) Destroy

func (s *SoundIO) Destroy()

func (SoundIO) Disconnect

func (s SoundIO) Disconnect()

func (SoundIO) GetOutputDevice

func (s SoundIO) GetOutputDevice(index int) (*Device, error)

type WriteCallback

type WriteCallback struct {
	Func func(*OutStream, int, int)
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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