JNGL
Easy to use cross-platform 2D game library
|
An audio channel, different channels could be for example: "Music", "Speech" and "Sound Effects". More...
#include <jngl/Channel.hpp>
Public Member Functions | |
void | play (const std::string &filename) |
Play OGG file on this channel. | |
std::shared_ptr< SoundFile > | loop (const std::string &filename) |
Play an OGG audio file on this channel in a loop. | |
void | stop (const std::string &filename) |
Stop OGG file playing on this channel. | |
Finally | pause () |
Pauses the Channel; destroying the returned Finally object will resume again. | |
void | setVolume (float volume) |
Set volume of this channel in [0, ∞]. Default is 1.0f. | |
void | add (std::shared_ptr< Stream >) |
Internal function for now. | |
void | remove (const Stream *) |
Internal function for now. | |
Static Public Member Functions | |
static Channel & | main () |
Returns the main Channel on which jngl::play, jngl::loop, jngl::stop operate. | |
An audio channel, different channels could be for example: "Music", "Speech" and "Sound Effects".
Example:
Definition at line 29 of file Channel.hpp.
std::shared_ptr< SoundFile > loop | ( | const std::string & | filename | ) |
Play an OGG audio file on this channel in a loop.
If it's already playing, this function won't play it twice.
Finally pause | ( | ) |
Pauses the Channel; destroying the returned Finally object will resume again.
Note that this doesn't change the status of jngl::isPlaying as that only depends on the status of the SoundFile.
Example where you want to pause audio in a menu:
Or if you want to toggle pausing audio using Space
: