QAudio Namespace

The QAudio namespace contains enums used by the audio classes. More...

Header: #include <QAudio>
CMake: find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia

Types

enum Error { NoError, OpenError, IOError, UnderrunError, FatalError }
enum State { ActiveState, SuspendedState, StoppedState, IdleState }
enum VolumeScale { LinearVolumeScale, CubicVolumeScale, LogarithmicVolumeScale, DecibelVolumeScale }

Detailed Description

Type Documentation

enum QAudio::Error

ConstantValueDescription
QAudio::NoError0No errors have occurred
QAudio::OpenError1An error occurred opening the audio device
QAudio::IOError2An error occurred during read/write of audio device
QAudio::UnderrunError3Audio data is not being fed to the audio device at a fast enough rate
QAudio::FatalError4A non-recoverable error has occurred, the audio device is not usable at this time.

enum QAudio::State

ConstantValueDescription
QAudio::ActiveState0Audio data is being processed, this state is set after start() is called and while audio data is available to be processed.
QAudio::SuspendedState1The audio stream is in a suspended state. Entered after suspend() is called or when another stream takes control of the audio device. In the later case, a call to resume will return control of the audio device to this stream. This should usually only be done upon user request.
QAudio::StoppedState2The audio device is closed, and is not processing any audio data
QAudio::IdleState3The QIODevice passed in has no data and audio system's buffer is empty, this state is set after start() is called and while no audio data is available to be processed.

enum QAudio::VolumeScale

This enum defines the different audio volume scales.

ConstantValueDescription
QAudio::LinearVolumeScale0Linear scale. 0.0 (0%) is silence and 1.0 (100%) is full volume. All Qt Multimedia classes that have an audio volume use a linear scale.
QAudio::CubicVolumeScale1Cubic scale. 0.0 (0%) is silence and 1.0 (100%) is full volume.
QAudio::LogarithmicVolumeScale2Logarithmic Scale. 0.0 (0%) is silence and 1.0 (100%) is full volume. UI volume controls should usually use a logarithmic scale.
QAudio::DecibelVolumeScale3Decibel (dB, amplitude) logarithmic scale. -200 is silence and 0 is full volume.

See also QAudio::convertVolume().