overview wiki api reference download
 All Classes Functions Variables Typedefs Enumerations Enumerator
Public Types | Public Member Functions | Static Public Member Functions
gameplay::AudioSource Class Reference

#include <AudioSource.h>

Inheritance diagram for gameplay::AudioSource:
gameplay::Ref gameplay::Transform::Listener

List of all members.

Public Types

enum  State { INITIAL, PLAYING, PAUSED, STOPPED }

Public Member Functions

void play ()
void pause ()
void resume ()
void stop ()
void rewind ()
AudioSource::State getState () const
bool isStreamed () const
bool isLooped () const
void setLooped (bool looped)
float getGain () const
void setGain (float gain)
float getPitch () const
void setPitch (float pitch)
const Vector3getVelocity () const
void setVelocity (const Vector3 &velocity)
void setVelocity (float x, float y, float z)
NodegetNode () const

Static Public Member Functions

static AudioSourcecreate (const char *url, bool streamed=false)
static AudioSourcecreate (Properties *properties)

Detailed Description

Defines an audio source in 3D space.

This can be attached to a Node for applying its 3D transformation.

See also:
http://gameplay3d.github.io/GamePlay/docs/file-formats.html#wiki-Audio

Member Enumeration Documentation

The audio source's audio state.


Member Function Documentation

static AudioSource* gameplay::AudioSource::create ( const char *  url,
bool  streamed = false 
) [static]

Create an audio source. This is used to instantiate an Audio Source. Currently only wav, au, and raw files are supported. Alternately, a URL specifying a Properties object that defines an audio source can be used (where the URL is of the format "<file-path>.<extension>#<namespace-id>/<namespace-id>/.../<namespace-id>" and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional).

Parameters:
urlThe relative location on disk of the sound file or a URL specifying a Properties object defining an audio source.
streamedDon't read the entire audio buffer first before playing, instead play immediately from a stream that is read on demand.
Returns:
The newly created audio source, or NULL if an audio source cannot be created.
static AudioSource* gameplay::AudioSource::create ( Properties properties) [static]

Create an audio source from the given properties object.

Parameters:
propertiesThe properties object defining the audio source (must have namespace equal to 'audio').
Returns:
The newly created audio source, or NULL if the audio source failed to load.

Returns the gain of the audio source.

Returns:
The gain.

Gets the node that this source is attached to.

Returns:
The node that this audio source is attached to.

Returns the pitch of the audio source.

Returns:
The pitch.

Gets the current state of the audio source.

Returns:
PLAYING if the source is playing, STOPPED if the source is stopped, PAUSED if the source is paused and INITIAL otherwise.

Gets the velocity of the audio source.

Returns:
The velocity as a vector.

Determines whether the audio source is looped or not.

Returns:
true if the audio source is looped, false if not.

Determines whether the audio source is streaming or not.

Returns:
true if the audio source is streaming, false if not.

Pauses the playing of the audio source.

Plays the audio source.

Resumes playing of the audio source.

Rewinds the audio source to the beginning.

void gameplay::AudioSource::setGain ( float  gain)

Sets the gain/volume of the audio source.

Parameters:
gainThe gain/volume of the source.
void gameplay::AudioSource::setLooped ( bool  looped)

Sets the state of the audio source to be looping or not.

Parameters:
loopedtrue to loop the sound, false to not loop it.
void gameplay::AudioSource::setPitch ( float  pitch)

Sets the pitch of the audio source.

Parameters:
pitchThe pitch of the source.
void gameplay::AudioSource::setVelocity ( const Vector3 velocity)

Sets the velocity of the audio source.

Parameters:
velocityA vector representing the velocity.
void gameplay::AudioSource::setVelocity ( float  x,
float  y,
float  z 
)

Sets the velocity of the audio source.

Parameters:
xThe x coordinate of the velocity.
yThe y coordinate of the velocity.
zThe z coordinate of the velocity.

Stops the playing of the audio source.

 All Classes Functions Variables Typedefs Enumerations Enumerator