asio

package module
v0.0.0-...-6c4b099 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2015 License: MIT Imports: 5 Imported by: 0

README

go-asio

ASIO client library for Go (golang) on Windows

Documentation

Index

Constants

View Source
const (
	ASE_OK      = 0          // This value will be returned whenever the call succeeded
	ASE_SUCCESS = 0x3f4847a0 // unique success return value for ASIOFuture calls
)

Special ASIO error values:

View Source
const (
	ASE_NotPresent       = -1000 + iota // hardware input or output is not present or available
	ASE_HWMalfunction                   // hardware is malfunctioning (can be returned by any ASIO function)
	ASE_InvalidParameter                // input parameter invalid
	ASE_InvalidMode                     // hardware is in a bad mode or used in a bad mode
	ASE_SPNotAdvancing                  // hardware is not running when sample position is inquired
	ASE_NoClock                         // sample clock or rate cannot be determined or is not present
	ASE_NoMemory                        // not enough memory for completing the request
)

Known ASIO error values:

View Source
const (
	CLSCTX_INPROC_SERVER = 1
	CLSCTX_LOCAL_SERVER  = 4
)

Variables

View Source
var (
	ErrorNotPresent       = &Error{errno: ASE_NotPresent, msg: "hardware input or output is not present or available"}
	ErrorHWMalfunction    = &Error{errno: ASE_HWMalfunction, msg: "hardware is malfunctioning (can be returned by any ASIO function)"}
	ErrorInvalidParameter = &Error{errno: ASE_InvalidParameter, msg: "input parameter invalid"}
	ErrorInvalidMode      = &Error{errno: ASE_InvalidMode, msg: "hardware is in a bad mode or used in a bad mode"}
	ErrorSPNotAdvancing   = &Error{errno: ASE_SPNotAdvancing, msg: "hardware is not running when sample position is inquired"}
	ErrorNoClock          = &Error{errno: ASE_NoClock, msg: "sample clock or rate cannot be determined or is not present"}
	ErrorNoMemory         = &Error{errno: ASE_NoMemory, msg: "not enough memory for completing the request"}
)

Fixed instances of errors:

View Source
var (
	IID_NULL = &GUID{0x00000000, 0x0000, 0x0000, [8]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}
)

Functions

func CoInitialize

func CoInitialize(p uintptr) (hr uintptr)

func CoUninitialize

func CoUninitialize()

func ListDrivers

func ListDrivers() (drivers map[string]*ASIODriver, err error)

Enumerate list of ASIO drivers registered on the system

func RegOpenKey

func RegOpenKey(key syscall.Handle, subkey string, desiredAccess uint32) (handle syscall.Handle, err error)

Types

type ASIODriver

type ASIODriver struct {
	Name  string
	CLSID string
	GUID  *GUID

	ASIO *IASIO
}

func (*ASIODriver) Close

func (drv *ASIODriver) Close()

func (*ASIODriver) Open

func (drv *ASIODriver) Open() (err error)

type ASIOTime

type ASIOTime struct {
}

type BufferInfo

type BufferInfo struct {
	Channel int
	IsInput bool
	Buffers [2]*int32 // double buffers - may need to recast based on sample type (int32 most popular; ASIOSTInt32LSB)
}

type Callbacks

type Callbacks struct {
	BufferSwitch func(doubleBufferIndex int, directProcess bool)

	SampleRateDidChange func(rate float64)

	Message func(selector, value int32, message uintptr, opt *float64) int32

	BufferSwitchTimeInfo func(params *ASIOTime, doubleBufferIndex int32, directProcess bool) *ASIOTime
}

type ChannelInfo

type ChannelInfo struct {
	Channel      int
	IsInput      bool
	IsActive     bool
	ChannelGroup int
	SampleType   int
	Name         string
}

type Error

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

func (*Error) Error

func (err *Error) Error() string

type GUID

type GUID struct {
	Data1 uint32
	Data2 uint16
	Data3 uint16
	Data4 [8]byte
}

func CLSIDFromString

func CLSIDFromString(str string) (clsid *GUID, err error)

func CLSIDFromStringUTF16

func CLSIDFromStringUTF16(str *uint16) (clsid *GUID, err error)

type IASIO

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

COM Interface for ASIO driver

func (*IASIO) AsIUnknown

func (drv *IASIO) AsIUnknown() *IUnknown

Cast to *IUnknown.

func (*IASIO) CanSampleRate

func (drv *IASIO) CanSampleRate(sampleRate float64) (err error)

virtual ASIOError canSampleRate(ASIOSampleRate sampleRate) = 0;

func (*IASIO) ControlPanel

func (drv *IASIO) ControlPanel() (err error)

virtual ASIOError controlPanel() = 0;

func (*IASIO) CreateBuffers

func (drv *IASIO) CreateBuffers(bufferDescriptors []BufferInfo, bufferSize int, callbacks Callbacks) (err error)

virtual ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels, long bufferSize, ASIOCallbacks *callbacks) = 0;

func (*IASIO) DisposeBuffers

func (drv *IASIO) DisposeBuffers() (err error)

virtual ASIOError disposeBuffers() = 0;

func (*IASIO) GetBufferSize

func (drv *IASIO) GetBufferSize() (minSize, maxSize, preferredSize, granularity int, err error)

virtual ASIOError getBufferSize(long *minSize, long *maxSize, long *preferredSize, long *granularity) = 0;

func (*IASIO) GetChannelInfo

func (drv *IASIO) GetChannelInfo(channel int, isInput bool) (info *ChannelInfo, err error)

virtual ASIOError getChannelInfo(ASIOChannelInfo *info) = 0;

func (*IASIO) GetChannels

func (drv *IASIO) GetChannels() (numInputChannels, numOutputChannels int, err error)

virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels) = 0;

func (*IASIO) GetDriverName

func (drv *IASIO) GetDriverName() string

virtual void getDriverName(char *name) = 0;

func (*IASIO) GetDriverVersion

func (drv *IASIO) GetDriverVersion() int32

virtual long getDriverVersion() = 0;

func (*IASIO) GetErrorMessage

func (drv *IASIO) GetErrorMessage() string

virtual void getErrorMessage(char *string) = 0;

func (*IASIO) GetLatencies

func (drv *IASIO) GetLatencies() (inputLatency, outputLatency int, err error)

virtual ASIOError getLatencies(long *inputLatency, long *outputLatency) = 0;

func (*IASIO) GetSampleRate

func (drv *IASIO) GetSampleRate() (sampleRate float64, err error)

virtual ASIOError getSampleRate(ASIOSampleRate *sampleRate) = 0;

func (*IASIO) Init

func (drv *IASIO) Init(sysHandle uintptr) (ok bool)

virtual ASIOBool init(void *sysHandle) = 0;

func (*IASIO) OutputReady

func (drv *IASIO) OutputReady() bool

virtual ASIOError outputReady() = 0;

func (*IASIO) SetSampleRate

func (drv *IASIO) SetSampleRate(sampleRate float64) (err error)

virtual ASIOError setSampleRate(ASIOSampleRate sampleRate) = 0;

func (*IASIO) Start

func (drv *IASIO) Start() (err error)

virtual ASIOError start() = 0;

func (*IASIO) Stop

func (drv *IASIO) Stop() (err error)

virtual ASIOError stop() = 0;

type IUnknown

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

func CreateInstance

func CreateInstance(clsid *GUID, iid *GUID) (unk *IUnknown, err error)

func (*IUnknown) AddRef

func (unk *IUnknown) AddRef() (r1 uintptr, err error)

func (*IUnknown) Release

func (unk *IUnknown) Release() (r1 uintptr, err error)

type SampleType

type SampleType int32
const (
	ASIOSTInt16MSB   SampleType = 0
	ASIOSTInt24MSB   SampleType = 1 // used for 20 bits as well
	ASIOSTInt32MSB   SampleType = 2
	ASIOSTFloat32MSB SampleType = 3 // IEEE 754 32 bit float
	ASIOSTFloat64MSB SampleType = 4 // IEEE 754 64 bit double float

	// these are used for 32 bit data buffer, with different alignment of the data inside
	// 32 bit PCI bus systems can be more easily used with these
	ASIOSTInt32MSB16 SampleType = 8  // 32 bit data with 16 bit alignment
	ASIOSTInt32MSB18 SampleType = 9  // 32 bit data with 18 bit alignment
	ASIOSTInt32MSB20 SampleType = 10 // 32 bit data with 20 bit alignment
	ASIOSTInt32MSB24 SampleType = 11 // 32 bit data with 24 bit alignment

	ASIOSTInt16LSB   SampleType = 16
	ASIOSTInt24LSB   SampleType = 17 // used for 20 bits as well
	ASIOSTInt32LSB   SampleType = 18
	ASIOSTFloat32LSB SampleType = 19 // IEEE 754 32 bit float, as found on Intel x86 architecture
	ASIOSTFloat64LSB SampleType = 20 // IEEE 754 64 bit double float, as found on Intel x86 architecture

	// these are used for 32 bit data buffer, with different alignment of the data inside
	// 32 bit PCI bus systems can more easily used with these
	ASIOSTInt32LSB16 SampleType = 24 // 32 bit data with 18 bit alignment
	ASIOSTInt32LSB18 SampleType = 25 // 32 bit data with 18 bit alignment
	ASIOSTInt32LSB20 SampleType = 26 // 32 bit data with 20 bit alignment
	ASIOSTInt32LSB24 SampleType = 27 // 32 bit data with 24 bit alignment

	//	ASIO DSD format.
	ASIOSTDSDInt8LSB1 SampleType = 32 // DSD 1 bit data, 8 samples per byte. First sample in Least significant bit.
	ASIOSTDSDInt8MSB1 SampleType = 33 // DSD 1 bit data, 8 samples per byte. First sample in Most significant bit.
	ASIOSTDSDInt8NER8 SampleType = 40 // DSD 8 bit data, 1 sample per byte. No Endianness required.
)

Jump to

Keyboard shortcuts

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