ge211  2021.5.1
A student game engine
Sound_effect_handle Class Reference

Detailed Description

Used to control a Sound_effect after it is started playing on a Mixer.

This is returned by Mixer::play_effect.

Definition at line 391 of file ge211_audio.hxx.

Public Member Functions

 Sound_effect_handle ()
 Default-constructs the empty sound effect handle. More...
 
bool empty () const
 Recognizes the empty sound effect handle.
 
 operator bool () const
 Recognizes a non-empty sound effect handle. More...
 
void pause ()
 Pauses the effect. More...
 
void resume ()
 Unpauses the effect. More...
 
void stop ()
 Stops the effect from playing and detaches it. More...
 
const Sound_effectget_effect () const
 Gets the Sound_effect being played by this handle. More...
 
Mixer::State get_state () const
 Gets the state of this effect. More...
 
double get_volume () const
 Returns the playing sound effect's volume as a number from 0.0 to 1.0.
 
void set_volume (double unit_value)
 Sets the playing sound effect's volume as a number from 0.0 to 1.0.
 

Constructor & Destructor Documentation

◆ Sound_effect_handle()

Sound_effect_handle ( )
inline

Default-constructs the empty sound effect handle.

The empty handle is not associated with a channel, and it is an error to attempt to perform operations on it.

To get a non-empty Sound_effect_handle, play a Sound_effect with Mixer::play_effect.

Definition at line 400 of file ge211_audio.hxx.

Member Function Documentation

◆ get_effect()

const Sound_effect & get_effect ( ) const

Gets the Sound_effect being played by this handle.

Preconditions

  • !empty(), undefined behavior if violated.

Definition at line 239 of file ge211_audio.cxx.

◆ get_state()

Mixer::State get_state ( ) const

Gets the state of this effect.

As with the mixer's music state, the state of a side effect channel only changes synchronously, either with client requests, or between frames, in the case where the sound effect finishes and is detached.

Preconditions

  • !empty(), undefined behavior if violated.

Definition at line 244 of file ge211_audio.cxx.

◆ operator bool()

operator bool ( ) const
explicit

Recognizes a non-empty sound effect handle.

Equivalent to !empty().

Definition at line 437 of file ge211_audio.cxx.

◆ pause()

void pause ( )

Pauses the effect.

Preconditions

Definition at line 339 of file ge211_audio.cxx.

◆ resume()

void resume ( )

Unpauses the effect.

Preconditions

Definition at line 319 of file ge211_audio.cxx.

◆ stop()

void stop ( )

Stops the effect from playing and detaches it.

Preconditions

Definition at line 359 of file ge211_audio.cxx.


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