audio

package
v1.3.1 Latest Latest
Warning

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

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

Documentation

Overview

Package audio provides access to 3D sound capability. The package is comprised of three interfaces:

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

The expected usage is to initialize the audio system and load some sounds. Then create sound listeners and sound makers. Associate the sound makers with sounds. Finally have the sound makers play sounds that are close enough to the sound listeners to be audible.

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                         // Get the audio layer up and running.
	Shutdown()                           // Closes and cleans up the audio layer.
	Mute(mute bool)                      // Turns the listener gain on/off.
	BindSound(s *data.Sound) (err error) // Copy sound data to the sound card.
}

Audio interacts with the underlying audio layer which in turn interfaces to the sound drivers and hardware. This must be initialized before SoundMakers or SoundListeners 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 float64) // Listener location.
	SetVelocity(x, y, z float64) // Listeners movement.
	SetGain(gain float64)        // 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 float64) // Where the noise occurs.
	SetPitch(pitch float64)      // Noise pitch.
	SetGain(gain float64)        // 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 a golang audio library based on OpenAL.
Package al provides a golang audio library based on OpenAL.

Jump to

Keyboard shortcuts

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