JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
Channel.hpp
Go to the documentation of this file.
1// Copyright 2024 Jan Niklas Hasse <jhasse@bixense.com>
2// For conditions of distribution and use, see copyright notice in LICENSE.txt
5
6#include "Finally.hpp"
7
8#include <memory>
9#include <string>
10
11namespace jngl {
12
13struct Stream;
14
28class Channel {
29public:
30 Channel();
31 ~Channel();
32
34 void play(const std::string& filename);
35
39 void loop(const std::string& filename);
40
42 void stop(const std::string& filename);
43
79 [[nodiscard]] Finally pause();
80
82 static Channel& main();
83
87 void remove(const Stream*);
88
89private:
90 struct Impl;
92};
93
94} // namespace jngl
Contains jngl::Finally class.
An audio channel, different channels could be for example: "Music", "Speech" and "Sound Effects".
Definition: Channel.hpp:28
Finally pause()
Pauses the Channel; destroying the returned Finally object will resume again.
static Channel & main()
Returns the main Channel on which jngl::play, jngl::loop, jngl::stop operate.
void remove(const Stream *)
Internal function for now.
void loop(const std::string &filename)
Play an OGG audio file on this channel in a loop.
void add(std::shared_ptr< Stream >)
Internal function for now.
void play(const std::string &filename)
Play OGG file on this channel.
void stop(const std::string &filename)
Stop OGG file playing on this channel.
Helper class which calls a function when being destroyed.
Definition: Finally.hpp:22
JNGL's main namespace.
Definition: Achievement.hpp:10