openal

package module
v0.0.0-...-a69e9a6 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2014 License: BSD-2-Clause Imports: 3 Imported by: 0

README

Experimental OpenAL bindings for Go.
====================================

Everything is evolving quickly and nothing is totally done.
If you want to see what the C-level API will look like I'd
recommend reading openal/al and not much else.

Even the C-level API *doesn't* follow the original API 100%
and it's much cleaner as a result. If you are an old-timer,
just relax and try to absorb it, you'll like it eventually.

The top-level openal package is totally out of date, I only
keep it around for reference while I refactor. Ignore it!

Random Notes
------------

We can now play some sounds and theoretically we can also
record something, but that's not tested yet. The code is
a mess since I am still in the middle of learning OpenAL.

I am trying to follow the ideas from my SQLite binding: a
low-level core.go cgo API to wrap away the C-level stuff,
and a more Go-like API on top of that.

Actually, scratch that. I am now experimenting with a
different approach, but I won't kill the stuff I did so
far just yet: In the experiment, /pkg/openal will be the
Go-level API while /pkg/openal/al[c|ut] will be exposed
C-level APIs with minimal attempts at using Go the right
way. I hope that this will allow hardcore hackers to go
all the way to the bottom instead of being tied to what
I think a Go-level API should look like. :-D

I am finally done wrapping OpenAL's "al" API in a way
that I am pretty happy with: all the functionality I can
expose is now exposed. I decided that a 100% clone of
the C API is just not good enough, even at a low level.
But check it out for yourself. I think this rendition of
OpenAL leads to much nicer code than the original C API
while still staying close enough to be understandable
for people with prior OpenAL experience.

The plan now is to wrap the essential parts of "alc" and
"alut" and then write some sensible demo application on
top. I've wrapped all of "al" so people can see what the
other ones will look like when they are done. But it's
not really my priority to get them all the way done right
now. Of course you're always welcome to help. :-D

If you have any OpenAL experience, please help! Just email
and we can get going. I have no OpenAL experience myself,
so I need all the help I can get. :-D

Documentation

Index

Constants

View Source
const (
	AlcNoError        = 0
	AlcInvalidDevice  = 0xA001
	AlcInvalidContext = 0xA002
	AlcInvalidEnum    = 0xA003
	AlcInvalidValue   = 0xA004
	AlcOutOfMemory    = 0xA005
)

what Device.GetError returns

View Source
const (
	AlNoError          = 0
	AlInvalidName      = 0xA001
	AlInvalidEnum      = 0xA002
	AlInvalidValue     = 0xA003
	AlInvalidOperation = 0xA004
)

what GetError returns

View Source
const (
	AlutErrorNoError                = 0
	AlutErrorOutOfMemory            = 0x200
	AlutErrorInvalidEnum            = 0x201
	AlutErrorInvalidValue           = 0x202
	AlutErrorInvalidOperation       = 0x203
	AlutErrorNoCurrentContext       = 0x204
	AlutErrorAlErrorOnEntry         = 0x205
	AlutErrorAlcErrorOnEntry        = 0x206
	AlutErrorOpenDevice             = 0x207
	AlutErrorCloseDevice            = 0x208
	AlutErrorCreateContext          = 0x209
	AlutErrorMakeContextCurrent     = 0x20A
	AlutErrorDestroyContext         = 0x20B
	AlutErrorGenBuffers             = 0x20C
	AlutErrorBufferData             = 0x20D
	AlutErrorIoError                = 0x20E
	AlutErrorUnsupportedFileType    = 0x20F
	AlutErrorUnsupportedFileSubtype = 0x210
	AlutErrorCorruptOrTruncatedData = 0x211
)

what alutGetError returns

View Source
const (
	AlutWaveformSine       = 0x100
	AlutWaveformSquare     = 0x101
	AlutWaveformSawtooth   = 0x102
	AlutWaveformWhitenoise = 0x103
	AlutWaveformImpulse    = 0x104
)

waveform for alutSomething

View Source
const (
	AlFormatMono8    = 0x1100
	AlFormatMono16   = 0x1101
	AlFormatStereo8  = 0x1102
	AlFormatStereo16 = 0x1103
)

format for CaptureOpenDevice

View Source
const (
	AlBuffer = 0x1009
)
View Source
const (
	AlcCaptureSamples = 0x312
)

Variables

This section is empty.

Functions

func AlutGetError

func AlutGetError() int

func DeleteBuffer

func DeleteBuffer(buffer *Buffer)

func DeleteBuffers

func DeleteBuffers(buffers []*Buffer)

func DumpRegistries

func DumpRegistries()

func Exit

func Exit()

func GenSources

func GenSources(sources []uint)

func GetError

func GetError() int

func Init

func Init()

Types

type Buffer

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

func CreateBufferFromFile

func CreateBufferFromFile(name string) (buffer *Buffer)

func CreateBufferHelloWorld

func CreateBufferHelloWorld() (buffer *Buffer)

func GenBuffer

func GenBuffer() (buffer *Buffer)

func GenBuffers

func GenBuffers(n int) (buffers []*Buffer)

type CaptureDevice

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

func CaptureOpenDevice

func CaptureOpenDevice(name string, freq int, format int, size int) (device *CaptureDevice)

func (*CaptureDevice) CaptureCloseDevice

func (self *CaptureDevice) CaptureCloseDevice() bool

func (*CaptureDevice) CaptureSamples

func (self *CaptureDevice) CaptureSamples(size int) []byte

func (*CaptureDevice) CaptureStart

func (self *CaptureDevice) CaptureStart()

func (*CaptureDevice) CaptureStop

func (self *CaptureDevice) CaptureStop()

func (*CaptureDevice) GetError

func (self *CaptureDevice) GetError() int

func (*CaptureDevice) GetInteger

func (self *CaptureDevice) GetInteger(param int) int

type Context

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

func (*Context) DestroyContext

func (self *Context) DestroyContext()

func (*Context) MakeContextCurrent

func (self *Context) MakeContextCurrent() bool

type Device

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

func OpenDevice

func OpenDevice(name string) (device *Device)

func (*Device) CloseDevice

func (self *Device) CloseDevice() bool

func (*Device) CreateContext

func (self *Device) CreateContext() (context *Context)

func (*Device) GetError

func (self *Device) GetError() int

type Source

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

func GenSource

func GenSource() (source *Source)

func (*Source) Pause

func (self *Source) Pause()

func (*Source) Play

func (self *Source) Play()

func (*Source) Rewind

func (self *Source) Rewind()

func (*Source) SetAttr

func (self *Source) SetAttr(param int, value *Buffer)

TODO: can't pass buffer really...

func (*Source) Stop

func (self *Source) Stop()

Directories

Path Synopsis
Go binding for OpenAL's "al" API.
Go binding for OpenAL's "al" API.
C-level binding for OpenAL's "alc" API.
C-level binding for OpenAL's "alc" API.

Jump to

Keyboard shortcuts

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