Gateware Libraries  R6.5A
Beta Build
GW::AUDIO::GMusic Class Referenceabstract
Inheritance diagram for GW::AUDIO::GMusic:
Collaboration diagram for GW::AUDIO::GMusic:

Public Member Functions

virtual GReturn SetChannelVolumes (float *_values, int _numChannels)=0
 Attempts to set the output volume for the specified number of outputs to the passed in values. More...
 
virtual GReturn SetVolume (float _newVolume)=0
 Attempts to change the overall volume. More...
 
virtual GReturn StreamStart (bool _loop=false)=0
 Attempts to start a music stream. More...
 
virtual GReturn PauseStream ()=0
 Attempts to pause a currently playing music stream. More...
 
virtual GReturn ResumeStream ()=0
 Attempts to resume a currently paused music stream. More...
 
virtual GReturn StopStream ()=0
 Attempts to stop playback of a music stream and reset it to begining for future use. More...
 
virtual GReturn GetStreamSourceChannels (unsigned int &returnedChannelNum)=0
 Stores the .wav files internal amount of channels the sound was recorded with into the passed in unsigned int. More...
 
virtual GReturn GetStreamOutputChannels (unsigned int &returnedChannelNum)=0
 Stores the number of specified outputs into the passed in unsigned int. More...
 
virtual GReturn isStreamPlaying (bool &_returnedBool)=0
 Fills out the passed in bool with information as to if the music stream is playing or not. More...
 
virtual GReturn GetCount (unsigned int &_outCount)=0
 Return the total number of active references to this object. More...
 
virtual GReturn IncrementCount ()=0
 Increase the total number of active references to this object. More...
 
virtual GReturn DecrementCount ()=0
 Decrease the total number of active references to this object. More...
 
virtual GReturn RequestInterface (const GUUIID &_interfaceID, void **_outputInterface)=0
 Requests an interface that may or may not be supported by this object. More...
 

Member Function Documentation

◆ DecrementCount()

virtual GReturn GW::AUDIO::GMusic::DecrementCount ( )
pure virtual

Decrease the total number of active references to this object.

Once the internal count reaches zero this object will be deallocated and your pointer will become invalid.

Return values
SUCCESSSuccessfully decremented the internal reference count.
FAILUREDecrementing of internal reference count would underflow the value.

Implements GW::CORE::GInterface.

◆ GetCount()

virtual GReturn GW::AUDIO::GMusic::GetCount ( unsigned int &  _outCount)
pure virtual

Return the total number of active references to this object.

Parameters
[out]_outCountThe total number of active references of this object.
Return values
SUCCESSSuccessfully ran.
FAILUREEither class does not exist or the internal reference count is corrupt.

Implements GW::CORE::GInterface.

◆ GetStreamOutputChannels()

virtual GReturn GW::AUDIO::GMusic::GetStreamOutputChannels ( unsigned int &  returnedChannelNum)
pure virtual

Stores the number of specified outputs into the passed in unsigned int.

This value is obtained from the GAudio that created this GMusic. By default the number of output channels is 2 unless GAudio was created with a different amount.

Parameters
[out]Theunsigned int which will be stored with the value.
Return values
FAILUREGAudio has not filled out this object with GAudio's fuunction: "CreateMusicStream".
SUCCESSSuccessfully ran without running into any of the above issues.

◆ GetStreamSourceChannels()

virtual GReturn GW::AUDIO::GMusic::GetStreamSourceChannels ( unsigned int &  returnedChannelNum)
pure virtual

Stores the .wav files internal amount of channels the sound was recorded with into the passed in unsigned int.

This value is read and stored upon creation of GMusic.

Parameters
[out]Theunsigned int which will be stored with the value.
Return values
FAILUREGAudio has not filled out this object with GAudio's fuunction: "CreateMusicStream".
SUCCESSSuccessfully ran without running into any of the above issues.

◆ IncrementCount()

virtual GReturn GW::AUDIO::GMusic::IncrementCount ( )
pure virtual

Increase the total number of active references to this object.

End users should only call this operation if they are familiar with reference counting behavior.

Return values
SUCCESSSuccessfully incremented the internal reference count.
FAILUREIncrementation of internal reference count would overflow the value.

Implements GW::CORE::GInterface.

◆ isStreamPlaying()

virtual GReturn GW::AUDIO::GMusic::isStreamPlaying ( bool &  _returnedBool)
pure virtual

Fills out the passed in bool with information as to if the music stream is playing or not.

GMusic internally keeps track of whether or not it playing via the launched thread, as well as the Start/Pause/Resume/Stop functions.

Parameters
[out]Thebool which will be stored with the value.
Return values
SUCCESSAlways, boolean passed in will tell you if music is playing or not.

◆ PauseStream()

virtual GReturn GW::AUDIO::GMusic::PauseStream ( )
pure virtual

Attempts to pause a currently playing music stream.

Currenntly only supports .wav files. If a stream is currently paused, will not attempt to pause playback without returning an error.

Parameters
[in]

◆ RequestInterface()

virtual GReturn GW::AUDIO::GMusic::RequestInterface ( const GUUIID _interfaceID,
void **  _outputInterface 
)
pure virtual

Requests an interface that may or may not be supported by this object.

Can be used by the end-user to query for a new interface using the unique ID of the interface they want and implement an interface update.

Parameters
[in]_interfaceIDThe GUUIID of the interface you are requesting.
[out]_outputInterfaceWhere the interface will be stored if function is successful.
Return values
SUCCESSThe interface is supported and function succeded.
INTERFACE_UNSUPPORTEDThe requested interface is not supported.

Implements GW::CORE::GInterface.

◆ ResumeStream()

virtual GReturn GW::AUDIO::GMusic::ResumeStream ( )
pure virtual

Attempts to resume a currently paused music stream.

Currenntly only supports .wav files. If a music stream is currently playing, will not attempt to play file without returning an error.

Return values
FAILUREGAudio has not filled out this object with GAudio's fuunction: "CreateMusicStream".
FAILUREIf internal object incounters an error. Unlikely to occur if GAudio's "CreateMusicStream" did not return an error upon filling out this object.
SUCCESSSuccessfully ran without running into any of the above issues.

◆ SetChannelVolumes()

virtual GReturn GW::AUDIO::GMusic::SetChannelVolumes ( float *  _values,
int  _numChannels 
)
pure virtual

Attempts to set the output volume for the specified number of outputs to the passed in values.

The amount of values in _values that will be used is based on _numChannels. If you attempt to set the volume of an output your hardware does not support, it will be ignored. If you attempt to set a volume higher that GAudio's master volume, it will be set to the master volume without an error message.

Channels: Supports up to 6 channels AKA 5.1 Audio: INDEX[0] = Left, INDEX[1] = Right, INDEX[2] = Front Center, INDEX[3] = LFE, INDEX[4] = Rear Left, INDEX[5] = Rear Right,

Parameters
[in]_valuesThe output volumes to be set.
[in]_numChannelsThe number of channels affected.
Return values
FAILURE_numChannels is less than 1.
FAILUREGAudio has not filled it out this object with GAudio's fuunction: "CreateMusicStream".
FAILUREIf internal object incounters an error. Could occur if GAudio's number of outputs changed durring runtime.
FAILURE_values is NULL
FAILURE_values tried to read garbadge data - (_numChannels > amoutn of values in _values)
SUCCESSSuccessfully ran without running into any of the above issues.

◆ SetVolume()

virtual GReturn GW::AUDIO::GMusic::SetVolume ( float  _newVolume)
pure virtual

Attempts to change the overall volume.

If you attempt to set a volume higher that GAudio's master volume, it will be set to the master volume without an error message.

Parameters
[in]_newVolumeThe output volume to be set.
Return values
FAILUREGAudio has not filled out this object with GAudio's fuunction: "CreateMusicStream".
FAILURE_newVolume is less than Zero.
FAILUREIf internal object incounters an error. Unlikely to occur if GAudio's "CreateMusicStream" did not return an error upon filling out this object. *
SUCCESSSuccessfully ran without running into any of the above issues.
SUCCESSSuccessfully ran without running into any of the above issues.

◆ StopStream()

virtual GReturn GW::AUDIO::GMusic::StopStream ( )
pure virtual

Attempts to stop playback of a music stream and reset it to begining for future use.

Currenntly only supports .wav files. Tells the previously launched thread to stop, calls join on it, and resets thread for future use. Will attempt to comppletely stop playback regaurdless of whether or not music is playing or paused.

Return values
FAILUREGAudio has not filled it out this object with GAudio's fuunction: "CreateMusicStream".
FAILUREIf internal object incounters an error. Unlikely to occur if GAudio's "CreateMusicStream" did not return an error upon filling out this object.
SUCCESSSuccessfully ran without running into any of the above issues.

◆ StreamStart()

virtual GReturn GW::AUDIO::GMusic::StreamStart ( bool  _loop = false)
pure virtual

Attempts to start a music stream.

Currenntly only supports .wav files. Upon Succession will launch a new thread that will continously read in audio data from file. If a thread already has been launched, will not attempt to launch new thread without returning an error.

Return values
FAILUREGAudio has not filled out this object with GAudio's fuunction: "CreateMusicStream".
FAILUREIf specified .wav file could not be found or encountered an error upon reading in data (This happens when "CreateMusicStream" fills out data).
FAILUREIf internal object incounters an error. Unlikely to occur if GAudio's "CreateMusicStream" did not return an error upon filling out this object.
SUCCESSSuccessfully ran without running into any of the above issues.

The documentation for this class was generated from the following file: