KgAudioScene
Typedefs | |
typedef QFlags< Capability > | Capabilities |
Enumerations | |
enum | Capability { SupportsLowLatencyPlayback = 1 << 0, SupportsPositionalPlayback = 1 << 1 } |
Functions | |
Capabilities | capabilities () |
bool | hasError () |
QPointF | listenerPos () |
void | setListenerPos (const QPointF &pos) |
void | setVolume (qreal volume) |
qreal | volume () |
Detailed Description
This class exposes general properties of the audio playback context. Actual sounds are represented in this context by KgSound instances.
The audio scene basically consists of a listener. The position of this listener is relevant when sounds are played at certain positions: The audio channels will then be balanced to make the sound appear to come from that direction.
Because there can ogly be one listener, all methods in this class are static.
- Warning
- Not all functionally exposed by the API of this class is guaranteed to be available on the compiled KgAudio backend. Check KgAudioScene::capabilities() if in doubt.
Enumeration Type Documentation
◆ Capability
This enumeration represents capabilities which may not be provided by every KgAudio backend.
Enumerator | |
---|---|
SupportsLowLatencyPlayback | Playback starts as soon as KgSound::start is called. |
Definition at line 36 of file audio/kgaudioscene.h.
Function Documentation
◆ capabilities()
KgAudioScene::Capabilities KgAudioScene::capabilities | ( | ) |
- Returns
- which capabilities are supported by the compiled KgAudio backend
Definition at line 19 of file kgaudioscene-openal.cpp.
◆ hasError()
bool KgAudioScene::hasError | ( | ) |
- Returns
- whether an error was detected in the audio backend
Since KgAudio is typically used by games where audio is not an absolutely vital part of the gameplay, we do not need to fail if sound does not work, over even make some sort of deep analysis why something did not work. The user will notice missing sound, and advanced users may investigate the kWarning() messages. That is usually enough. If not, use this method.
The state of hasError() may theoretically change while the application runs, but in practice, this is very unlikely. (The only tricky part is typically the initial allocation of resources.)
- See also
- KgSound::hasError()
Definition at line 52 of file kgaudioscene-openal.cpp.
◆ listenerPos()
QPointF KgAudioScene::listenerPos | ( | ) |
- Returns
- the position of the listener
Definition at line 24 of file kgaudioscene-openal.cpp.
◆ setListenerPos()
void KgAudioScene::setListenerPos | ( | const QPointF & | pos | ) |
Sets the position of the listener.
The default is (0.0, 0.0), the point of origin.
- Note
- Effective only if positional playback is supported.
Definition at line 29 of file kgaudioscene-openal.cpp.
◆ setVolume()
void KgAudioScene::setVolume | ( | qreal | volume | ) |
Sets the master volume for sounds outputted by TagaroAudio.
The default is 1.0, which means no volume change, compared to the original sounds. 0.0 means that all sounds are muted.
Definition at line 43 of file kgaudioscene-openal.cpp.
◆ volume()
qreal KgAudioScene::volume | ( | ) |
- Returns
- the master volume for sounds outputted by TagaroAudio
Definition at line 38 of file kgaudioscene-openal.cpp.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu May 26 2022 04:04:06 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.