Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qambientsound_p.h
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-3.0-only
3
4
#
ifndef
QAMBIENTSOUND_P_H
5
#
define
QAMBIENTSOUND_P_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists for the convenience
12
// of other Qt classes. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
QtSpatialAudio
/
qambientsound
.
h
>
19
#
include
<
QtSpatialAudio
/
private
/
qtspatialaudioglobal_p
.
h
>
20
#
include
<
QtCore
/
qmutex
.
h
>
21
#
include
<
QtCore
/
qurl
.
h
>
22
#
include
<
QtCore
/
qfile
.
h
>
23
#
include
<
QtCore
/
private
/
qobject_p
.
h
>
24
#
include
<
QtMultimedia
/
qaudiodecoder
.
h
>
25
#
include
<
QtMultimedia
/
qaudiobuffer
.
h
>
26
27
QT_BEGIN_NAMESPACE
28
29
class
QAudioEngine;
30
31
class
QAmbientSoundPrivate
:
public
QObjectPrivate
32
{
33
Q_DECLARE_PUBLIC(QAmbientSound)
34
35
public
:
36
explicit
QAmbientSoundPrivate
(
int
nchannels
= 2) :
nchannels
(
nchannels
) { }
37
38
template
<
typename
T
>
39
static
QAmbientSoundPrivate
*
get
(
T
*
soundSource
)
40
{
41
return
soundSource
?
soundSource
->
d_func
() :
nullptr
;
42
}
43
44
QUrl
url
;
45
float
volume
= 1.;
46
int
nchannels
= 2;
47
std
::
unique_ptr
<
QAudioDecoder
>
decoder
;
48
std
::
unique_ptr
<
QFile
>
sourceDeviceFile
;
49
QAudioEngine *
engine
=
nullptr
;
50
51
QMutex
mutex
;
52
int
currentBuffer
= 0;
53
int
bufPos
= 0;
54
int
m_currentLoop
= 0;
55
QList
<
QAudioBuffer
>
buffers
;
56
int
sourceId
= -1;
// kInvalidSourceId
57
58
QAtomicInteger
<
bool
>
m_autoPlay
=
true
;
59
QAtomicInteger
<
bool
>
m_playing
=
false
;
60
QAtomicInt
m_loops
= 1;
61
bool
m_loading
=
false
;
62
63
void
play
() {
64
m_playing =
true
;
65
}
66
void
pause
() {
67
m_playing =
false
;
68
}
69
void
stop
() {
70
QMutexLocker locker(&mutex);
71
m_playing =
false
;
72
currentBuffer
= 0;
73
bufPos
= 0;
74
m_currentLoop
= 0;
75
}
76
77
void
load
();
78
void
getBuffer
(
float
*buf,
int
frames,
int
channels);
79
};
80
81
QT_END_NAMESPACE
82
83
#
endif
// QAMBIENTSOUND_P_H
QAmbientSoundPrivate
Definition
qambientsound_p.h:32
QAmbientSoundPrivate::decoder
std::unique_ptr< QAudioDecoder > decoder
Definition
qambientsound_p.h:47
QAmbientSoundPrivate::m_playing
QAtomicInteger< bool > m_playing
Definition
qambientsound_p.h:59
QAmbientSoundPrivate::engine
QAudioEngine * engine
Definition
qambientsound_p.h:49
QAmbientSoundPrivate::m_currentLoop
int m_currentLoop
Definition
qambientsound_p.h:54
QAmbientSoundPrivate::stop
void stop()
Definition
qambientsound_p.h:69
QAmbientSoundPrivate::pause
void pause()
Definition
qambientsound_p.h:66
QAmbientSoundPrivate::load
void load()
Definition
qambientsound.cpp:19
QAmbientSoundPrivate::buffers
QList< QAudioBuffer > buffers
Definition
qambientsound_p.h:55
QAmbientSoundPrivate::nchannels
int nchannels
Definition
qambientsound_p.h:46
QAmbientSoundPrivate::sourceId
int sourceId
Definition
qambientsound_p.h:56
QAmbientSoundPrivate::play
void play()
Definition
qambientsound_p.h:63
QAmbientSoundPrivate::m_autoPlay
QAtomicInteger< bool > m_autoPlay
Definition
qambientsound_p.h:58
QAmbientSoundPrivate::bufPos
int bufPos
Definition
qambientsound_p.h:53
QAmbientSoundPrivate::getBuffer
void getBuffer(float *buf, int frames, int channels)
Definition
qambientsound.cpp:58
QAmbientSoundPrivate::sourceDeviceFile
std::unique_ptr< QFile > sourceDeviceFile
Definition
qambientsound_p.h:48
QAmbientSoundPrivate::currentBuffer
int currentBuffer
Definition
qambientsound_p.h:52
QAmbientSoundPrivate::volume
float volume
Definition
qambientsound_p.h:45
QAmbientSoundPrivate::mutex
QMutex mutex
Definition
qambientsound_p.h:51
QAmbientSoundPrivate::m_loops
QAtomicInt m_loops
Definition
qambientsound_p.h:60
QAmbientSoundPrivate::m_loading
bool m_loading
Definition
qambientsound_p.h:61
qtmultimedia
src
spatialaudio
qambientsound_p.h
Generated on
for Qt by
1.14.0