Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
sound_singleton.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2022 DS
4// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5// Copyright (C) 2011 Sebastian 'Bahamada' Rühl
6// Copyright (C) 2011 Cyriaque 'Cisoun' Skrapits <cysoun@gmail.com>
7// Copyright (C) 2011 Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
8
9#pragma once
10
11#include <memory>
12#include "al_helpers.h"
13
14namespace sound {
15
20{
21public:
23 void operator()(ALCdevice *p)
24 {
25 alcCloseDevice(p);
26 }
27 };
28
30 void operator()(ALCcontext *p)
31 {
32 alcMakeContextCurrent(nullptr);
33 alcDestroyContext(p);
34 }
35 };
36
37 using unique_ptr_alcdevice = std::unique_ptr<ALCdevice, AlcDeviceDeleter>;
38 using unique_ptr_alccontext = std::unique_ptr<ALCcontext, AlcContextDeleter>;
39
42
43public:
44 bool init();
45
47};
48
49} // namespace sound
Class for the openal device and context.
Definition sound_singleton.h:20
~SoundManagerSingleton()
Definition sound_singleton.cpp:52
std::unique_ptr< ALCcontext, AlcContextDeleter > unique_ptr_alccontext
Definition sound_singleton.h:38
bool init()
Definition sound_singleton.cpp:13
unique_ptr_alccontext m_context
Definition sound_singleton.h:41
std::unique_ptr< ALCdevice, AlcDeviceDeleter > unique_ptr_alcdevice
Definition sound_singleton.h:37
unique_ptr_alcdevice m_device
Definition sound_singleton.h:40
Definition al_extensions.cpp:11
void operator()(ALCcontext *p)
Definition sound_singleton.h:30
Definition sound_singleton.h:22
void operator()(ALCdevice *p)
Definition sound_singleton.h:23
static std::string p(std::string path)
Definition test_filesys.cpp:53