MPMA Framework 0.4
Classes | Enumerations | Functions | Variables
AUDIO Namespace Reference

Sound playback and streaming. More...

Classes

class  StaticBuffer
 Used to store static buffer data that can be re-used without having to re-read it from a source every time it is played. More...
class  Player
 Used to play sound buffers sources. More...
class  Source
 Represents a source of sound sample data. More...
class  WavFileSource
 Reads sound from a .wav file. More...
class  VorbisFileSource
 Reads sound from a .ogg/.ogm file. More...
class  FlacFileSource
 Reads sound from a .flac file. More...
class  LoopSource
 Source that creates a streaming infinite length loop from another source. If reading data reaches the end or the loop endpoint, it seeks back to the loop start point. More...
class  MonoToStereoSource
 Combines two mono sources into a stereo source. More...
class  EmptySource
 Generates nothing. More...
class  WhiteNoiseSource
 White noise generator. More...

Enumerations

enum  DistanceModel {
  DISTANCE_NONE = 0x300, DISTANCE_INVERSE, DISTANCE_INVERSE_CLAMPED, DISTANCE_LINEAR,
  DISTANCE_LINEAR_CLAMPED, DISTANCE_EXPONENTIAL, DISTANCE_EXPONENTIAL_CLAMPED
}
 Determines how distance affects the volume of 3D sounds. Most of the parameters used here can be found in the Player class (See Player.h). More...
enum  RenderMode { POSITIONAL = 0x200, FIXED }
 Determines how the sound should be played back. More...

Functions

void SetGlobalVolume (float value)
 Sets the global sound volume level that affects all sounds. Value can be from 0 being silence to 1 being normal. Default is 1.
void SetListenerPosition (float x, float y, float z)
 Sets the position the listener is at.
void SetListenerFacing (float x, float y, float z)
 Sets the direction the listener is facing.
void SetListenerUp (float x, float y, float z)
 Sets the direction that is up from the listener's head.
void SetListenerVelocity (float x, float y, float z)
 Sets the speed and direction that listener is moving. (used for doppler)
void SetDopplerFactor (float value)
 A scalar(>=0) that is can be used to emphasize or reduce the doppler effect globally. Default is 1. Setting to 0 disables doppler.
void SetSpeedOfSound (float value)
 Sets the speed of sound used for doppler calculations. Must be >0. Default is 343.3.
void SetDistanceModel (DistanceModel distanceModel)
 Sets the formula used to calculate how distance affects the volume of sounds in 3D space.
template<typename VectorType >
void SetListenerPosition (const VectorType &pos)
 Sets the position the listener is at.
template<typename VectorType >
void SetListenerFacing (const VectorType &dir)
 Sets the direction the listener is facing.
template<typename VectorType >
void SetListenerUp (const VectorType &up)
 Sets the direction that is up from the listener's head.
template<typename VectorType >
void SetListenerVelocity (const VectorType &vel)
 Sets the speed and direction that listener is moving. (used for doppler)
void SetBackgroundStreaming (bool enable)
 If enabled (default), streams will be refilled by a worker thread as needed. If disabled, the application must explicitely call UpdateStreams frequently enough that streaming buffers do not run out of data.
uint32 UpdateStreams ()
 If background streaming is enabled, this forces the background thread to wake up and run immediately (but does not block to wait for it to do anything) then returns 0. If background streaming is not enabled, this refills all streaming sound buffers and then returns the approximate number of milliseconds until any more buffer data can be queued.
bool SaveSourceToWaveFile (const std::string &filename, std::shared_ptr< AUDIO::Source > source, const std::string fileComment="")
 Saves the a finite audio source to a wave file. If source is infinite or on failure, returns false.
bool SaveSourceToVorbisFileVBR (const std::string &filename, std::shared_ptr< AUDIO::Source > source, float vbrQuality, const std::string fileComment="")
 Saves the a finite audio source to an ogg vorbis file using variable bit rate encoding. If source is infinite or on failure, returns false. vbrQuality may be from -0.1 to 1.0. 0.4 is roughly 128kbps.

Variables

const nuint FINITE_DATA = (nuint)(0-2)
 There is a finite amount of data left, but the source doesn't know exactly how much.
const nuint INFINITE_DATA = (nuint)(0-1)
 The source will never run out of data.

Detailed Description

Sound playback and streaming.


Enumeration Type Documentation

Determines how distance affects the volume of 3D sounds. Most of the parameters used here can be found in the Player class (See Player.h).

Enumerator:
DISTANCE_NONE 

Distance does not affect sound volume.

DISTANCE_INVERSE 

Works like 1/distance. (default) The exact volume scale is: ReferenceDistance / (ReferenceDistance + RolloffFactor * (distance - ReferenceDistance)).

DISTANCE_INVERSE_CLAMPED 

Same as DISTANCE_INVERSE, except the distance used in the calculation is clamped between ReferenceDistance and MaxDistance.

DISTANCE_LINEAR 

Works like 1-distance. The exact volume scale is: 1 - RolloffFactor * (distance - ReferenceDistance) / (MaxDistance - ReferenceDistance). The distance is clamped between 0 and MaxDistance.

DISTANCE_LINEAR_CLAMPED 

Same as DISTANCE_LINEAR, except the distance is clamped between ReferenceDistance and MaxDistance.

DISTANCE_EXPONENTIAL 

Works like distance^(-n). The exact volume scale is (distance / ReferenceDistance) ^ (-RolloffFactor).

DISTANCE_EXPONENTIAL_CLAMPED 

Same as DISTANCE_EXPONENTIAL, except the distance is clamped between ReferenceDistance and MaxDistance.

Determines how the sound should be played back.

Enumerator:
POSITIONAL 

The sound has a 3D position and orientation in space. Only mono sound sources may be used with this (stereo sources are automatically collapsed to mono).

FIXED 

The sound is played without any 3D positioning applied. This must be used to play stereo sources correctly.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends