Gosu
Public Member Functions | List of all members
Gosu::Channel Class Reference

Sample::play returns a Channel that represents the sound being played. More...

Public Member Functions

 Channel ()
 This creates an "empty" Channel which is expired and cannot be resumed. More...
 
 Channel (int channel, int token)
 For internal use only. More...
 
int current_channel () const
 For internal use only. More...
 
bool playing () const
 
bool paused () const
 
void pause ()
 Pauses this instance to be resumed afterwards. More...
 
void resume ()
 
void stop ()
 Stops this channel if the sample is still being played. More...
 
void set_volume (double volume)
 
void set_pan (double pan)
 
void set_speed (double speed)
 

Detailed Description

Sample::play returns a Channel that represents the sound being played.

This object can be used to stop sounds dynamically, or to check whether playback has finished.

Definition at line 17 of file Audio.hpp.

Constructor & Destructor Documentation

◆ Channel() [1/2]

Gosu::Channel::Channel ( )

This creates an "empty" Channel which is expired and cannot be resumed.

◆ Channel() [2/2]

Gosu::Channel::Channel ( int  channel,
int  token 
)

For internal use only.

Member Function Documentation

◆ current_channel()

int Gosu::Channel::current_channel ( ) const

For internal use only.

◆ pause()

void Gosu::Channel::pause ( )

Pauses this instance to be resumed afterwards.

Avoid leaving samples paused for too long, as they will still occupy one of Gosu's limited channels.

◆ paused()

bool Gosu::Channel::paused ( ) const

◆ playing()

bool Gosu::Channel::playing ( ) const

◆ resume()

void Gosu::Channel::resume ( )

◆ set_pan()

void Gosu::Channel::set_pan ( double  pan)
Parameters
panCan be anything from -1.0 (left) to 1.0 (right).

◆ set_speed()

void Gosu::Channel::set_speed ( double  speed)
Parameters
speedUse 1.0 for normal playback speed.

◆ set_volume()

void Gosu::Channel::set_volume ( double  volume)
Parameters
volumeCan be anything from 0.0 (silence) to 1.0 (full volume).

◆ stop()

void Gosu::Channel::stop ( )

Stops this channel if the sample is still being played.

If this method is called when playback has finished, it has no effect.


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