hoa_audio::SoundDescriptor Class Reference

Manages sound data loaded from memory. More...

#include <audio_sound.h>

Collaboration diagram for hoa_audio::SoundDescriptor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void DEBUG_DataProperties ()
 Displays the properties of the sound descriptor's buffer.
void FreeSound ()
 Removes a reference to the sound data.
const std::string & GetFilename ()
 Returns a const reference to the filename of the buffer that the source points to.
uint8 GetSoundState ()
 Retrieves the state of the sound.
bool LoadSound (std::string fname)
 Loads new sound data from a file.
 SoundDescriptor ()
 ~SoundDescriptor ()
Retreive Sound Playback Properties Functions
Returns:
The value of the playback property that was queried


uint32 GetFadeInTime ()
uint32 GetFadeOutTime ()
int32 GetLoopCount ()
int32 GetPlayTimeout ()
Standard Sound Operations
The basic functions that can change the state of sound playback.

Note:
Calling these functions when the sound is already in a certain state results in a no-op.


void PauseSound ()
void PlaySound ()
void ResumeSound ()
void StopSound ()
Set Sound Playback Properties Functions
Parameters:
The value to set the playback property in question.


void SetFadeInTime (uint32 fade_time)
void SetFadeOutTime (uint32 fade_time)
void SetLoopCount (int32 loops)
void SetPlayTimeout (uint32 timeout)

Private Attributes

int32 _channel
 The audio channel that the sound is playing on This member is needed to perform specific queries on the playing channel.
private_audio::SoundData_data
 A pointer to the sound data that is used.
uint32 _fade_in_time
 The number of milliseconds to fade in the sound when playing begins A value of zero means that no fade in is done (this is the default).
uint32 _fade_out_time
 The number of milliseconds to fade out the sound when the sound is stopped A value of zero means that no fade out is done (this is the default).
int32 _loop_count
 The number of loops to play the sound for By default this member is set to zero, meaning it plays only once.
  • A value of 0 indicates no looping (plays the sound once and then stops)
  • A value of -1 indicates infinite looping (until the user tells the sound to stop).

int32 _play_timeout
 The number of milliseconds to play a sound before timing out and stopping the sound A value of -1 indicates no time out occurs (this is the default).

Friends

class GameAudio

Detailed Description

Manages sound data loaded from memory.

****************************************************************************

The purpose of this class is to provide the API user with an easy-to-use interface for manipulating sound data.This class holds all the properties about a given sound. Including its location, velocity, whether or not it loops, and numerous other properties.

Definition at line 69 of file audio_sound.h.


Constructor & Destructor Documentation

hoa_audio::SoundDescriptor::SoundDescriptor (  ) 

Definition at line 98 of file audio_sound.cpp.

References _data, _fade_in_time, _fade_out_time, _loop_count, and _play_timeout.

hoa_audio::SoundDescriptor::~SoundDescriptor (  ) 

Definition at line 108 of file audio_sound.cpp.

References _data, and hoa_audio::private_audio::SoundData::RemoveReference().

Here is the call graph for this function:


Member Function Documentation

void hoa_audio::SoundDescriptor::DEBUG_DataProperties (  )  [inline]

Displays the properties of the sound descriptor's buffer.

Definition at line 137 of file audio_sound.h.

References _data, and hoa_audio::private_audio::SoundData::DEBUG_PrintProperties().

Here is the call graph for this function:

void hoa_audio::SoundDescriptor::FreeSound (  ) 

Removes a reference to the sound data.

Note:
It is perfectly fine to call this function when a sound is playing. If that is the case, the sound will first be stopped, and then freed.

Definition at line 132 of file audio_sound.cpp.

References _data, and hoa_audio::private_audio::SoundData::RemoveReference().

Here is the call graph for this function:

uint32 hoa_audio::SoundDescriptor::GetFadeInTime (  )  [inline]

Definition at line 128 of file audio_sound.h.

References _fade_in_time.

uint32 hoa_audio::SoundDescriptor::GetFadeOutTime (  )  [inline]

Definition at line 130 of file audio_sound.h.

References _fade_out_time.

const std::string& hoa_audio::SoundDescriptor::GetFilename (  )  [inline]

Returns a const reference to the filename of the buffer that the source points to.

Definition at line 76 of file audio_sound.h.

References _data, and hoa_audio::private_audio::SoundData::filename.

int32 hoa_audio::SoundDescriptor::GetLoopCount (  )  [inline]

Definition at line 126 of file audio_sound.h.

References _loop_count.

int32 hoa_audio::SoundDescriptor::GetPlayTimeout (  )  [inline]

Definition at line 132 of file audio_sound.h.

References _play_timeout.

uint8 hoa_audio::SoundDescriptor::GetSoundState (  ) 

Retrieves the state of the sound.

Returns:
A value indicating the state. Refer to the audio state constants in audio.h.

Definition at line 141 of file audio_sound.cpp.

References _channel, _data, hoa_audio::AUDIO_STATE_FADING_IN, hoa_audio::AUDIO_STATE_FADING_OUT, hoa_audio::AUDIO_STATE_PAUSED, hoa_audio::AUDIO_STATE_PLAYING, hoa_audio::AUDIO_STATE_STOPPED, hoa_audio::AUDIO_STATE_UNLOADED, and hoa_audio::private_audio::SoundData::sound.

bool hoa_audio::SoundDescriptor::LoadSound ( std::string  fname  ) 

Loads new sound data from a file.

Parameters:
fname The name of the file, without path information or a file extension.
Returns:
Returns false if there was an error loading the sound.

void hoa_audio::SoundDescriptor::PauseSound (  ) 

Definition at line 191 of file audio_sound.cpp.

References hoa_audio::GameAudio::_audio_errors, _channel, _data, hoa_audio::AUDIO_ERROR_NO_DATA, and hoa_audio::AudioManager.

void hoa_audio::SoundDescriptor::PlaySound (  ) 

Definition at line 172 of file audio_sound.cpp.

References hoa_audio::GameAudio::_audio_errors, _channel, _data, _fade_in_time, _loop_count, _play_timeout, hoa_audio::private_audio::ANY_CHANNEL, hoa_audio::AUDIO_ERROR_NO_DATA, hoa_audio::AUDIO_ERROR_PLAY_FAILURE, hoa_audio::AudioManager, and hoa_audio::private_audio::SoundData::sound.

void hoa_audio::SoundDescriptor::ResumeSound (  ) 

Definition at line 201 of file audio_sound.cpp.

References hoa_audio::GameAudio::_audio_errors, _channel, _data, hoa_audio::AUDIO_ERROR_NO_DATA, and hoa_audio::AudioManager.

void hoa_audio::SoundDescriptor::SetFadeInTime ( uint32  fade_time  )  [inline]

Definition at line 114 of file audio_sound.h.

References _fade_in_time.

void hoa_audio::SoundDescriptor::SetFadeOutTime ( uint32  fade_time  )  [inline]

Definition at line 116 of file audio_sound.h.

References _fade_out_time.

void hoa_audio::SoundDescriptor::SetLoopCount ( int32  loops  )  [inline]

Definition at line 112 of file audio_sound.h.

References _loop_count.

void hoa_audio::SoundDescriptor::SetPlayTimeout ( uint32  timeout  )  [inline]

Definition at line 118 of file audio_sound.h.

References _play_timeout.

void hoa_audio::SoundDescriptor::StopSound (  ) 

Definition at line 211 of file audio_sound.cpp.

References hoa_audio::GameAudio::_audio_errors, _channel, _data, _fade_out_time, hoa_audio::AUDIO_ERROR_NO_DATA, and hoa_audio::AudioManager.


Friends And Related Function Documentation

friend class GameAudio [friend]

Definition at line 70 of file audio_sound.h.


Member Data Documentation

int32 hoa_audio::SoundDescriptor::_channel [private]

The audio channel that the sound is playing on This member is needed to perform specific queries on the playing channel.

Note:
This is actually quite a dangerous member to keep around because once a sound stops playing, the channel number is no longer valid and this member is not updated to reflect that. You should only rely on this member being correct if the sound is currently playing.

Definition at line 148 of file audio_sound.h.

Referenced by GetSoundState(), PauseSound(), PlaySound(), ResumeSound(), and StopSound().

private_audio::SoundData* hoa_audio::SoundDescriptor::_data [private]

A pointer to the sound data that is used.

Definition at line 141 of file audio_sound.h.

Referenced by DEBUG_DataProperties(), FreeSound(), GetFilename(), GetSoundState(), PauseSound(), PlaySound(), ResumeSound(), SoundDescriptor(), StopSound(), and ~SoundDescriptor().

uint32 hoa_audio::SoundDescriptor::_fade_in_time [private]

The number of milliseconds to fade in the sound when playing begins A value of zero means that no fade in is done (this is the default).

Definition at line 158 of file audio_sound.h.

Referenced by GetFadeInTime(), PlaySound(), SetFadeInTime(), and SoundDescriptor().

uint32 hoa_audio::SoundDescriptor::_fade_out_time [private]

The number of milliseconds to fade out the sound when the sound is stopped A value of zero means that no fade out is done (this is the default).

Definition at line 162 of file audio_sound.h.

Referenced by GetFadeOutTime(), SetFadeOutTime(), SoundDescriptor(), and StopSound().

int32 hoa_audio::SoundDescriptor::_loop_count [private]

The number of loops to play the sound for By default this member is set to zero, meaning it plays only once.

Definition at line 154 of file audio_sound.h.

Referenced by GetLoopCount(), PlaySound(), SetLoopCount(), and SoundDescriptor().

int32 hoa_audio::SoundDescriptor::_play_timeout [private]

The number of milliseconds to play a sound before timing out and stopping the sound A value of -1 indicates no time out occurs (this is the default).

Definition at line 166 of file audio_sound.h.

Referenced by GetPlayTimeout(), PlaySound(), SetPlayTimeout(), and SoundDescriptor().


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 23:12:37 2007 for Hero of Allacrost by  doxygen 1.5.1