예제 #1
0
파일: source.go 프로젝트: Jragonmiris/go-al
func RewindSources(sources ...Source) error {
	if len(sources) == 0 {
		return nil
	}
	C.alSourceRewindv(C.ALsizei(C.int(len(sources))), (*C.ALuint)(unsafe.Pointer(&sources[0])))
	return GetError()
}
예제 #2
0
파일: source.go 프로젝트: Jragonmiris/go-al
func (source Source) UnqueueBuffers(buffers ...Buffer) error {
	if len(buffers) == 0 {
		return nil
	}
	C.alSourceUnqueueBuffers(source.source, C.ALsizei(C.int(len(buffers))), (*C.ALuint)(unsafe.Pointer(&buffers[0])))
	return GetError()
}
예제 #3
0
파일: buffer.go 프로젝트: Jragonmiris/go-al
func DeleteBuffers(toDelete ...Buffer) error {
	if len(toDelete) == 0 {
		return nil
	}

	C.alDeleteBuffers(C.ALsizei(C.int(len(toDelete))), (*C.ALuint)(unsafe.Pointer(&toDelete[0])))
	return GetError()
}
예제 #4
0
파일: alut.go 프로젝트: nzlov/goal
func LoadMemoryFromFileImage(data interface{}, length int) (
	format al.ALenum, size int32, frequency float32, rdata unsafe.Pointer) {
	rdata = C.alutLoadMemoryFromFileImage(
		ptr(data), C.ALsizei(length),
		(*C.ALenum)(&format),
		(*C.ALsizei)(&size),
		(*C.ALfloat)(&frequency),
	)
	return
}
예제 #5
0
파일: buffer.go 프로젝트: Jragonmiris/go-al
func GenBuffers(numBuffers int) ([]Buffer, error) {
	if numBuffers == 0 {
		return nil, nil // AL guarantees that 0 will have no effect, so we'll save ourselves the C call
	}
	buf := make([]Buffer, numBuffers)
	C.alGenBuffers(C.ALsizei(C.int(numBuffers)), (*C.ALuint)(unsafe.Pointer(&buf[0]))) // Since a Buffer is a struct{C.ALuint} an array of Buffers is an array of ALuints
	if err := GetError(); err != nil {
		return nil, err
	}

	return buf, nil
}
예제 #6
0
파일: core.go 프로젝트: pigulon/go-openal
func DeleteBuffers(buffers []*Buffer) {
	n := len(buffers)
	bufferIds := make([]C.ALuint, n)

	for i, v := range buffers {
		forgetBuffer(v)
		bufferIds[i] = v.handle
	}

	C.walDeleteBuffers(C.ALsizei(n), unsafe.Pointer(&bufferIds[0]))
	return
}
예제 #7
0
파일: source.go 프로젝트: Jragonmiris/go-al
func GenSources(numSources int) ([]Source, error) {
	if numSources == 0 {
		return nil, nil // AL guarantees that 0 will have no effect, so we'll save ourselves the C call
	}
	buf := make([]Source, numSources)
	C.alGenSources(C.ALsizei(C.int(numSources)), (*C.ALuint)(unsafe.Pointer(&buf[0])))
	if err := GetError(); err != nil {
		return nil, err
	}

	return buf, nil
}
예제 #8
0
파일: core.go 프로젝트: pigulon/go-openal
func GenBuffers(n int) (buffers []*Buffer) {
	bufferIds := make([]C.ALuint, n)
	C.walGenBuffers(C.ALsizei(n), unsafe.Pointer(&bufferIds[0]))

	if GetError() != AlNoError {
		return
	}

	buffers = make([]*Buffer, n)
	for i, v := range bufferIds {
		b := new(Buffer)
		b.handle = v
		rememberBuffer(b)
		buffers[i] = b
	}
	return
}
예제 #9
0
파일: audio.go 프로젝트: anthonyrego/gosmf
func (s *Sound) LoadPCMData() {
	format := 0

	if s.Channels > 1 {
		switch s.BitsPerSample {
		case 8:
			format = C.AL_FORMAT_STEREO8
		case 16:
			format = C.AL_FORMAT_STEREO16
		}
	} else {
		switch s.BitsPerSample {
		case 8:
			format = C.AL_FORMAT_MONO8
		case 16:
			format = C.AL_FORMAT_MONO16
		}
	}

	C.alGenBuffers(1, &s.buffer)
	C.alBufferData(s.buffer, C.ALenum(format), unsafe.Pointer(&s.Data[0]), C.ALsizei(s.Size), C.ALsizei(s.Frequency))
}
예제 #10
0
파일: buffer.go 프로젝트: 9uuso/go-openal
// NewBuffers() creates n fresh buffers.
// Renamed, was GenBuffers.
func NewBuffers(n int) (buffers []Buffer) {
	buffers = make([]Buffer, n)
	C.walGenBuffers(C.ALsizei(n), unsafe.Pointer(&buffers[0]))
	return
}
예제 #11
0
파일: source.go 프로젝트: jaekwon/go-openal
// Renamed, was SourcePausev.
func PauseSources(sources []Source) {
	C.walSourcePausev(C.ALsizei(len(sources)), unsafe.Pointer(&sources[0]))
}
예제 #12
0
파일: source.go 프로젝트: jaekwon/go-openal
// Renamed, was SourceRewindv.
func RewindSources(sources []Source) {
	C.walSourceRewindv(C.ALsizei(len(sources)), unsafe.Pointer(&sources[0]))
}
예제 #13
0
파일: source.go 프로젝트: jaekwon/go-openal
// Renamed, was SourceStopv.
func StopSources(sources []Source) {
	C.walSourceStopv(C.ALsizei(len(sources)), unsafe.Pointer(&sources[0]))
}
예제 #14
0
파일: source.go 프로젝트: jaekwon/go-openal
// Renamed, was SourcePlayv.
func PlaySources(sources []Source) {
	C.walSourcePlayv(C.ALsizei(len(sources)), unsafe.Pointer(&sources[0]))
}
예제 #15
0
func alDeleteBuffers(b []Buffer) {
	C.call_alDeleteBuffers(alDeleteBuffersFunc, C.ALsizei(len(b)), (*C.ALuint)(unsafe.Pointer(&b[0])))
}
예제 #16
0
func alSourceUnqueueBuffers(s Source, b []Buffer) {
	C.call_alSourceUnqueueBuffers(alSourceUnqueueBuffersFunc, C.ALuint(s), C.ALsizei(len(b)), (*C.ALuint)(unsafe.Pointer(&b[0])))
}
예제 #17
0
func alSourceRewindv(s []Source) {
	C.call_alSourceRewindv(alSourceRewindvFunc, C.ALsizei(len(s)), (*C.ALuint)(unsafe.Pointer(&s[0])))
}
예제 #18
0
파일: core.go 프로젝트: pigulon/go-openal
func GenSources(sources []uint) {
	n := len(sources)
	C.walGenSources(C.ALsizei(n), unsafe.Pointer(&sources[0]))
}
예제 #19
0
파일: buffer.go 프로젝트: 9uuso/go-openal
// SetData() specifies the sample data the buffer should use.
// For FormatMono16 and FormatStereo8 the data slice must be a
// multiple of two bytes long; for FormatStereo16 the data slice
// must be a multiple of four bytes long. The frequency is given
// in Hz.
// Renamed, was BufferData.
func (self Buffer) SetData(format int32, data []byte, frequency int32) {
	C.alBufferData(C.ALuint(self), C.ALenum(format), unsafe.Pointer(&data[0]),
		C.ALsizei(len(data)), C.ALsizei(frequency))
}
예제 #20
0
파일: alut.go 프로젝트: nzlov/goal
func CreateBufferFromFileImage(data interface{}, length int) {
	C.alutCreateBufferFromFileImage(ptr(data), C.ALsizei(length))
}
예제 #21
0
// Renamed, was SourceStopv.
func (self Sources) Stop() {
	C.walSourceStopv(C.ALsizei(len(self)), unsafe.Pointer(&self[0]))
}
예제 #22
0
// Renamed, was SourcePlayv.
func (self Sources) Play() {
	C.walSourcePlayv(C.ALsizei(len(self)), unsafe.Pointer(&self[0]))
}
예제 #23
0
func alGenSources(n int) []Source {
	s := make([]Source, n)
	C.call_alGenSources(alGenSourcesFunc, C.ALsizei(n), (*C.ALuint)(unsafe.Pointer(&s[0])))
	return s
}
예제 #24
0
파일: buffer.go 프로젝트: 9uuso/go-openal
// DeleteBuffers() deletes the given buffers.
func DeleteBuffers(buffers []Buffer) {
	n := len(buffers)
	C.walDeleteBuffers(C.ALsizei(n), unsafe.Pointer(&buffers[0]))
}
예제 #25
0
func alDeleteSources(s []Source) {
	C.call_alDeleteSources(alDeleteSourcesFunc, C.ALsizei(len(s)), (*C.ALuint)(unsafe.Pointer(&s[0])))
}
예제 #26
0
파일: source.go 프로젝트: jaekwon/go-openal
// Renamed, was SourceUnqueueBuffers.
func (self Source) UnqueueBuffers(buffers []Buffer) {
	C.walSourceUnqueueBuffers(C.ALuint(self), C.ALsizei(len(buffers)), unsafe.Pointer(&buffers[0]))
}
예제 #27
0
func alGenBuffers(n int) []Buffer {
	s := make([]Buffer, n)
	C.call_alGenBuffers(alGenBuffersFunc, C.ALsizei(n), (*C.ALuint)(unsafe.Pointer(&s[0])))
	return s
}
예제 #28
0
파일: source.go 프로젝트: jaekwon/go-openal
// NewSources() creates n sources.
// Renamed, was GenSources.
func NewSources(n int) (sources []Source) {
	sources = make([]Source, n)
	C.walGenSources(C.ALsizei(n), unsafe.Pointer(&sources[0]))
	return
}
예제 #29
0
func alBufferData(b Buffer, format uint32, data []byte, freq int32) {
	C.call_alBufferData(alBufferDataFunc, C.ALuint(b), C.ALenum(format), unsafe.Pointer(&data[0]), C.ALsizei(len(data)), C.ALsizei(freq))
}
예제 #30
0
파일: source.go 프로젝트: jaekwon/go-openal
// DeleteSources() deletes the given sources.
func DeleteSources(sources []Source) {
	n := len(sources)
	C.walDeleteSources(C.ALsizei(n), unsafe.Pointer(&sources[0]))
}