ge211
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(Sound_effect, double).

Definition at line 328 of file ge211_audio.h.

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. More...
 
void set_volume (double unit_value)
 Sets the playing sound effect's volume as a number from 0.0 to 1.0. More...
 

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(Sound_effect, double).

Definition at line 337 of file ge211_audio.h.

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 200 of file ge211_audio.cpp.

◆ 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 205 of file ge211_audio.cpp.

◆ get_volume()

double get_volume ( ) const

Returns the playing sound effect's volume as a number from 0.0 to 1.0.

Definition at line 393 of file ge211_audio.cpp.

◆ operator bool()

operator bool ( ) const

Recognizes a non-empty sound effect handle.

Equivalent to !empty().

Definition at line 382 of file ge211_audio.cpp.

◆ pause()

void pause ( )

Pauses the effect.

Preconditions:

Definition at line 284 of file ge211_audio.cpp.

◆ resume()

void resume ( )

Unpauses the effect.

Preconditions:

Definition at line 264 of file ge211_audio.cpp.

◆ set_volume()

void set_volume ( double  unit_value)

Sets the playing sound effect's volume as a number from 0.0 to 1.0.

Definition at line 401 of file ge211_audio.cpp.

◆ stop()

void stop ( )

Stops the effect from playing and detaches it.

Preconditions:

Definition at line 304 of file ge211_audio.cpp.


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