Luanti
5.19.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
14
namespace
sound
{
15
19
class
SoundManagerSingleton
20
{
21
public
:
22
struct
AlcDeviceDeleter
{
23
void
operator()
(ALCdevice *p)
24
{
25
alcCloseDevice(p);
26
}
27
};
28
29
struct
AlcContextDeleter
{
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
40
unique_ptr_alcdevice
m_device
;
41
unique_ptr_alccontext
m_context
;
42
43
public
:
44
bool
init
();
45
46
~SoundManagerSingleton
();
47
};
48
49
}
// namespace sound
al_helpers.h
sound::SoundManagerSingleton
Class for the openal device and context.
Definition
sound_singleton.h:20
sound::SoundManagerSingleton::unique_ptr_alccontext
std::unique_ptr< ALCcontext, AlcContextDeleter > unique_ptr_alccontext
Definition
sound_singleton.h:38
sound::SoundManagerSingleton::init
bool init()
Definition
sound_singleton.cpp:13
sound::SoundManagerSingleton::m_context
unique_ptr_alccontext m_context
Definition
sound_singleton.h:41
sound::SoundManagerSingleton::unique_ptr_alcdevice
std::unique_ptr< ALCdevice, AlcDeviceDeleter > unique_ptr_alcdevice
Definition
sound_singleton.h:37
sound::SoundManagerSingleton::m_device
unique_ptr_alcdevice m_device
Definition
sound_singleton.h:40
sound
Definition
al_extensions.cpp:11
sound::SoundManagerSingleton::AlcContextDeleter
Definition
sound_singleton.h:29
sound::SoundManagerSingleton::AlcContextDeleter::operator()
void operator()(ALCcontext *p)
Definition
sound_singleton.h:30
sound::SoundManagerSingleton::AlcDeviceDeleter
Definition
sound_singleton.h:22
sound::SoundManagerSingleton::AlcDeviceDeleter::operator()
void operator()(ALCdevice *p)
Definition
sound_singleton.h:23
client
sound
sound_singleton.h
Generated on
for Luanti by
1.18.0