-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into string_view
- Loading branch information
Showing
50 changed files
with
832 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,51 @@ | ||
// Copyright 2010-2023 Jan Niklas Hasse <jhasse@bixense.com> | ||
// Copyright 2010-2024 Jan Niklas Hasse <jhasse@bixense.com> | ||
// For conditions of distribution and use, see copyright notice in LICENSE.txt | ||
|
||
#pragma once | ||
|
||
#include "audio/mixer.hpp" | ||
#include "audio/engine.hpp" | ||
#include "jngl/Singleton.hpp" | ||
|
||
#include <memory> | ||
|
||
namespace jngl { | ||
|
||
void checkAlError(); | ||
void pauseAudioDevice(); | ||
void resumeAudioDevice(); | ||
class Mixer; | ||
class Sound; | ||
|
||
namespace audio { | ||
struct pitch_control; | ||
struct volume_control; | ||
} // namespace audio | ||
|
||
class Audio; | ||
void checkAlError(); | ||
|
||
Audio& GetAudio(); | ||
std::shared_ptr<Mixer> getMixer(); | ||
class Audio : public jngl::Singleton<Audio> { | ||
public: | ||
Audio(); | ||
Audio(const Audio&) = delete; | ||
Audio& operator=(const Audio&) = delete; | ||
Audio(Audio&&) = delete; | ||
Audio& operator=(Audio&&) = delete; | ||
~Audio(); | ||
|
||
void play(std::shared_ptr<Sound> sound); | ||
void stop(std::shared_ptr<Sound>& sound); | ||
void increasePauseDeviceCount(); | ||
void decreasePauseDeviceCount(); | ||
void setPitch(float pitch); | ||
float getVolume() const; | ||
void setVolume(float volume); | ||
std::shared_ptr<Mixer> getMixer(); | ||
void step(); | ||
|
||
private: | ||
std::vector<std::shared_ptr<Sound>> sounds_; | ||
std::shared_ptr<Mixer> mixer; | ||
std::shared_ptr<audio::pitch_control> pitchControl; | ||
std::shared_ptr<audio::volume_control> volumeControl; | ||
audio::engine engine; | ||
uint8_t pauseDeviceCount = 0; //< if >0 audio device is paused | ||
}; | ||
|
||
} // namespace jngl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.