/* * Capture functions */ func CaptureOpenDevice(devicename string, frequency int, format ALCenum, buffersize int) *Device { s := alcString(devicename) d := (*Device)(C.alcCaptureOpenDevice( s, C.ALCuint(frequency), C.ALCenum(format), C.ALCsizei(buffersize))) freeString(s) return d }
func (device *Device) GetIntegerv(param ALCenum, data []int32) { C.alcGetIntegerv( (*C.ALCdevice)(device), C.ALCenum(param), (C.ALCsizei)(len(data)), (*C.ALCint)(&data[0]), ) }
func CaptureOpenDevice(name string, freq uint32, format Format, size uint32) *CaptureDevice { // TODO: turn empty string into nil? // TODO: what about an error return? p := C.CString(name) h := C.walcCaptureOpenDevice(p, C.ALCuint(freq), C.ALCenum(format), C.ALCsizei(size)) C.free(unsafe.Pointer(p)) return &CaptureDevice{Device{h}, uint32(format.SampleSize())} }
func CaptureOpenDevice(name string, freq uint32, format uint32, size uint32) *CaptureDevice { // TODO: turn empty string into nil? // TODO: what about an error return? p := C.CString(name) h := C.walcCaptureOpenDevice(p, C.ALCuint(freq), C.ALCenum(format), C.ALCsizei(size)) C.free(unsafe.Pointer(p)) s := map[uint32]uint32{FormatMono8: 1, FormatMono16: 2, FormatStereo8: 2, FormatStereo16: 4}[format] return &CaptureDevice{Device{h}, s} }
/* * Query functions */ func (device *Device) GetString(param ALCenum) string { return goString(C.alcGetString((*C.ALCdevice)(device), C.ALCenum(param))) }
func (self *Device) GetInteger(param uint32) int32 { return int32(C.walcGetInteger(self.handle, C.ALCenum(param))) }
func (self *Device) GetIntegerv(param uint32, size uint32) (result []int32) { result = make([]int32, size) C.walcGetIntegerv(self.handle, C.ALCenum(param), C.ALCsizei(size), unsafe.Pointer(&result[0])) return }