audio

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2013 License: BSD-2-Clause-Views Imports: 5 Imported by: 0

Documentation

Overview

Package audio provides access to 3D sound capability. It interfaces to the sound card through a device layer (currently OpenAL). The audio package is comprised of three main interfaces:

  1. The overall audio system that needs to be initialized on application startup, and shutdown on application close. It also needs sound data that has been loaded from persistent store and bound to the sound card.
  2. Sound makers that are associated with a sound, location and volume.
  3. Sound listeners that are associated with a location.

The expected usage is to initialize the audio system and then load some sounds into it. Then setup some sound listeners and some sound makers. Associate the sound makers with the loaded sounds. Then play sounds that are close enough to the SoundListeners to be audible.

OSX has OpenAL. To install 64-bit OpenAL on windows use:

http://connect.creativelabs.com/openal/Downloads/oalinst.zip

Package audio is provided as part of the vu (virtual universe) 3D engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Audio

type Audio interface {
	Init() error    // Init gets the audio layer up and running.
	Shutdown()      // Shutdown closes and cleans up the audio layer.
	Mute(mute bool) // Mute turns the listener gain on/off.

	// BindSound copies sound data to the sound card.
	BindSound(s *data.Sound) (err error)
}

Audio interfaces to the underling audio layer which in turn interfaces to the sound drivers and hardware. This must be initialized before SoundMakers's or SoundListener's can be created and used.

func New

func New() Audio

New provides a default Audio implementation.

type SoundListener

type SoundListener interface {
	SetLocation(x, y, z float32) // The listener location.
	SetVelocity(x, y, z float32) // The listeners movement.
	SetGain(gain float32)        // Crank this up for the hard of hearing.
}

SoundListener is the sound receiver. The listeners location relative to where the noise was played determines how much sound comes out of the speakers.

func NewSoundListener

func NewSoundListener() SoundListener

NewSoundListener provides an audio receiver.

type SoundMaker

type SoundMaker interface {
	SetLocation(x, y, z float32) // Where the noise occurs.
	SetPitch(pitch float32)      // The noise pitch.
	SetGain(gain float32)        // The noise volume.
	Play()                       // Make the noise happen now.
}

SoundMaker associates a sound with a location and other information. A sound maker will only produce an audible sound if there are active sound listeners within a reasonable distance.

func NewSoundMaker

func NewSoundMaker(sound *data.Sound) SoundMaker

NewSoundMaker provides an audio generator.

Directories

Path Synopsis
Package al provides the golang bindings for the OpenAL audio library.
Package al provides the golang bindings for the OpenAL audio library.

Jump to

Keyboard shortcuts

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