Beispiel #1
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())}
}
Beispiel #2
0
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}
}
Beispiel #3
0
func CaptureOpenDevice(name string, freq int, format int, size int) (device *CaptureDevice) {
	p := C.CString(name)
	h := C.walcCaptureOpenDevice(p, C.int(freq), C.int(format), C.int(size))
	C.free(unsafe.Pointer(p))

	if h == nil {
		return
	}

	device = new(CaptureDevice)
	device.handle = h
	return
}