hoa_audio::MusicDescriptor Class Reference

#include <audio_music.h>

Collaboration diagram for hoa_audio::MusicDescriptor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void DEBUG_dataProperties ()
 Displays the properties of the music descriptor's buffer.
void FreeMusic ()
 Removes a reference to the music data.
const std::string & GetFilename ()
 Returns a const reference to the filename of the buffer that the source points to.
uint8 GetMusicState ()
 Retrieves the state of the music.
bool IsPlaying ()
 Returns true if this piece of music is currently playing.
bool LoadMusic (const std::string &fname)
 Loads the music file from memory.
 MusicDescriptor ()
 ~MusicDescriptor ()
Standard Music Operations
The basic functions that can change the state of music playback.

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


void PauseMusic ()
void PlayMusic ()
void ResumeMusic ()
void RewindMusic ()
void SeekMusic (float seconds)
void StopMusic ()
Set Music 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

private_audio::MusicData_data
 A pointer to the music 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 -1, meaning it plays indefinitely until it is explicitly stopped.
  • 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

Definition at line 64 of file audio_music.h.


Constructor & Destructor Documentation

hoa_audio::MusicDescriptor::MusicDescriptor (  ) 

Definition at line 99 of file audio_music.cpp.

hoa_audio::MusicDescriptor::~MusicDescriptor (  ) 

Definition at line 109 of file audio_music.cpp.

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

Here is the call graph for this function:


Member Function Documentation

void hoa_audio::MusicDescriptor::DEBUG_dataProperties (  )  [inline]

Displays the properties of the music descriptor's buffer.

Definition at line 120 of file audio_music.h.

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

Here is the call graph for this function:

void hoa_audio::MusicDescriptor::FreeMusic (  ) 

Removes a reference to the music data.

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

Definition at line 133 of file audio_music.cpp.

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

Here is the call graph for this function:

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

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

Definition at line 71 of file audio_music.h.

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

Referenced by hoa_battle::BattleMode::Reset().

uint8 hoa_audio::MusicDescriptor::GetMusicState (  ) 

Retrieves the state of the music.

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

Definition at line 214 of file audio_music.cpp.

References _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, and hoa_audio::AUDIO_STATE_UNLOADED.

Referenced by PlayMusic().

bool hoa_audio::MusicDescriptor::IsPlaying (  ) 

Returns true if this piece of music is currently playing.

Definition at line 240 of file audio_music.cpp.

References _data, and hoa_audio::private_audio::MusicData::playing.

bool hoa_audio::MusicDescriptor::LoadMusic ( const std::string &  fname  ) 

Loads the music file from memory.

Parameters:
fname The name of the file to load, without path information or file extension attached.

Definition at line 117 of file audio_music.cpp.

References hoa_audio::GameAudio::_AcquireMusicData(), _data, hoa_audio::AudioManager, and hoa_audio::private_audio::MusicData::RemoveReference().

Referenced by hoa_battle::BattleMode::Reset().

Here is the call graph for this function:

void hoa_audio::MusicDescriptor::PauseMusic (  ) 

Definition at line 158 of file audio_music.cpp.

References hoa_audio::GameAudio::_audio_errors, _data, hoa_audio::AUDIO_ERROR_NO_DATA, hoa_audio::AudioManager, and hoa_audio::private_audio::MusicData::playing.

void hoa_audio::MusicDescriptor::PlayMusic (  ) 

Definition at line 141 of file audio_music.cpp.

References _data, _fade_in_time, _loop_count, hoa_audio::AUDIO_STATE_STOPPED, hoa_audio::AudioManager, GetMusicState(), hoa_audio::private_audio::MusicData::music, hoa_audio::private_audio::MusicData::playing, and hoa_audio::GameAudio::StopAllMusic().

Here is the call graph for this function:

void hoa_audio::MusicDescriptor::ResumeMusic (  ) 

Definition at line 170 of file audio_music.cpp.

References hoa_audio::GameAudio::_audio_errors, _data, hoa_audio::AUDIO_ERROR_NO_DATA, hoa_audio::AudioManager, and hoa_audio::private_audio::MusicData::playing.

void hoa_audio::MusicDescriptor::RewindMusic (  ) 

Definition at line 194 of file audio_music.cpp.

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

void hoa_audio::MusicDescriptor::SeekMusic ( float  seconds  ) 

Definition at line 204 of file audio_music.cpp.

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

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

Definition at line 111 of file audio_music.h.

References _fade_in_time.

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

Definition at line 113 of file audio_music.h.

References _fade_out_time.

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

Definition at line 109 of file audio_music.h.

References _loop_count.

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

Definition at line 115 of file audio_music.h.

References _play_timeout.

void hoa_audio::MusicDescriptor::StopMusic (  ) 

Definition at line 182 of file audio_music.cpp.

References hoa_audio::GameAudio::_audio_errors, _data, _fade_out_time, hoa_audio::AUDIO_ERROR_NO_DATA, hoa_audio::AudioManager, and hoa_audio::private_audio::MusicData::playing.


Friends And Related Function Documentation

friend class GameAudio [friend]

Definition at line 65 of file audio_music.h.


Member Data Documentation

private_audio::MusicData* hoa_audio::MusicDescriptor::_data [private]

A pointer to the music data that is used.

Definition at line 124 of file audio_music.h.

Referenced by DEBUG_dataProperties(), FreeMusic(), GetFilename(), GetMusicState(), IsPlaying(), LoadMusic(), PauseMusic(), PlayMusic(), ResumeMusic(), RewindMusic(), SeekMusic(), StopMusic(), and ~MusicDescriptor().

uint32 hoa_audio::MusicDescriptor::_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 134 of file audio_music.h.

Referenced by PlayMusic(), and SetFadeInTime().

uint32 hoa_audio::MusicDescriptor::_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 138 of file audio_music.h.

Referenced by SetFadeOutTime(), and StopMusic().

int32 hoa_audio::MusicDescriptor::_loop_count [private]

The number of loops to play the sound for By default this member is set to -1, meaning it plays indefinitely until it is explicitly stopped.

Definition at line 130 of file audio_music.h.

Referenced by PlayMusic(), and SetLoopCount().

int32 hoa_audio::MusicDescriptor::_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 142 of file audio_music.h.

Referenced by SetPlayTimeout().


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