Exemplo n.º 1
0
Arquivo: alc.go Projeto: nzlov/goal
/*
 * 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
}
Exemplo n.º 2
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())}
}
Exemplo n.º 3
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}
}
Exemplo n.º 4
0
// Temporary, I have no idea what format this comes out in.
// After I do I'll make something more sane
func (dev Device) Attributes(size int) ([]int, error) {
	dest := make([]C.int, size)
	C.alcGetIntegerv(dev.device, C.ALC_ALL_ATTRIBUTES, C.ALCsizei(size), (*C.ALCint)(&dest[0]))

	toReturn := make([]int, size)
	for i, dat := range dest {
		toReturn[i] = int(dat)
	}

	return toReturn, GetError()
}
Exemplo n.º 5
0
Arquivo: alc.go Projeto: nzlov/goal
func (device *Device) CaptureSamples(buffer interface{}, samples int) {
	C.alcCaptureSamples((*C.ALCdevice)(device), ptr(buffer), C.ALCsizei(samples))
}
Exemplo n.º 6
0
func (self *CaptureDevice) CaptureStereo16To(data [][2]int16) {
	C.alcCaptureSamples(self.handle, unsafe.Pointer(&data[0]), C.ALCsizei(uint32(len(data))*4/self.sampleSize))
}
Exemplo n.º 7
0
func (self *CaptureDevice) CaptureTo(data []byte) {
	C.alcCaptureSamples(self.handle, unsafe.Pointer(&data[0]), C.ALCsizei(uint32(len(data))/self.sampleSize))
}
Exemplo n.º 8
0
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
}
Exemplo n.º 9
0
func (self *CaptureDevice) CaptureSamples(size uint32) (data []byte) {
	data = make([]byte, size*self.sampleSize)
	C.alcCaptureSamples(self.handle, unsafe.Pointer(&data[0]), C.ALCsizei(size))
	return
}
Exemplo n.º 10
0
func (dev Device) AttributesSize() (int, error) {
	var dest *C.int
	C.alcGetIntegerv(dev.device, C.ALC_ATTRIBUTES_SIZE, C.ALCsizei(1), (*C.ALCint)(dest))
	return int(*dest), GetError()
}
Exemplo n.º 11
0
func (dev Device) MinorVersion() (int, error) {
	var dest *C.int
	C.alcGetIntegerv(dev.device, C.ALC_MINOR_VERSION, C.ALCsizei(1), (*C.ALCint)(dest))
	return int(*dest), GetError()
}