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
QtAudio Namespace Reference

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

Typedefs

template<typename Callback>
using if_audio_source_callback = std::enable_if_t<isAudioSourceCallback<Callback>, bool>
template<typename Callback>
using if_audio_sink_callback = std::enable_if_t<isAudioSinkCallback<Callback>, bool>
using Error = QAudio::Error
using State = QAudio::State
using VolumeScale = QAudio::VolumeScale

Functions

float convertVolume (float volume, VolumeScale from, VolumeScale to)
 Converts an audio volume from a volume scale to another, and returns the result.

Variables

template<typename F>
constexpr bool isAudioSourceCallback
template<typename F>
constexpr bool isAudioSinkCallback
constexpr auto NoError = QAudio::NoError
constexpr auto OpenError = QAudio::OpenError
constexpr auto IOError = QAudio::IOError
QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED constexpr auto UnderrunError = QAudio::UnderrunError
QT_WARNING_POP constexpr auto FatalError = QAudio::FatalError
constexpr auto ActiveState = QAudio::ActiveState
constexpr auto SuspendedState = QAudio::SuspendedState
constexpr auto StoppedState = QAudio::StoppedState
constexpr auto IdleState = QAudio::IdleState
constexpr auto LinearVolumeScale = QAudio::LinearVolumeScale
constexpr auto CubicVolumeScale = QAudio::CubicVolumeScale
constexpr auto LogarithmicVolumeScale = QAudio::LogarithmicVolumeScale
constexpr auto DecibelVolumeScale = QAudio::DecibelVolumeScale

Detailed Description

The QtAudio namespace contains enums used by the audio classes.

\inmodule QtMultimedia

Typedef Documentation

◆ Error

Definition at line 53 of file qaudio.h.

◆ if_audio_sink_callback

template<typename Callback>
using QtAudio::if_audio_sink_callback = std::enable_if_t<isAudioSinkCallback<Callback>, bool>

Definition at line 121 of file qtaudio.h.

◆ if_audio_source_callback

template<typename Callback>
using QtAudio::if_audio_source_callback = std::enable_if_t<isAudioSourceCallback<Callback>, bool>

Definition at line 118 of file qtaudio.h.

◆ State

Definition at line 54 of file qaudio.h.

◆ VolumeScale

Definition at line 55 of file qaudio.h.

Function Documentation

◆ convertVolume()

float QtAudio::convertVolume ( float volume,
VolumeScale from,
VolumeScale to )

Converts an audio volume from a volume scale to another, and returns the result.

Depending on the context, different scales are used to represent audio volume. All Qt Multimedia classes that have an audio volume use a linear scale, the reason is that the loudness of a speaker is controlled by modulating its voltage on a linear scale. The human ear on the other hand, perceives loudness in a logarithmic way. Using a logarithmic scale for volume controls is therefore appropriate in most applications. The decibel scale is logarithmic by nature and is commonly used to define sound levels, it is usually used for UI volume controls in professional audio applications. The cubic scale is a computationally cheap approximation of a logarithmic scale, it provides more control over lower volume levels.

The following example shows how to convert the volume value from a slider control before passing it to a QMediaPlayer. As a result, the perceived increase in volume is the same when increasing the volume slider from 20 to 30 as it is from 50 to 60:

See also
VolumeScale, QAudioSink::setVolume(), QAudioSource::setVolume(), QSoundEffect::setVolume()

Definition at line 98 of file qtaudio.cpp.

Variable Documentation

◆ ActiveState

auto QtAudio::ActiveState = QAudio::ActiveState
inlineconstexpr

Definition at line 66 of file qaudio.h.

◆ CubicVolumeScale

auto QtAudio::CubicVolumeScale = QAudio::CubicVolumeScale
inlineconstexpr

Definition at line 71 of file qaudio.h.

◆ DecibelVolumeScale

auto QtAudio::DecibelVolumeScale = QAudio::DecibelVolumeScale
inlineconstexpr

Definition at line 73 of file qaudio.h.

◆ FatalError

QT_WARNING_POP constexpr auto QtAudio::FatalError = QAudio::FatalError
inlineconstexpr

Definition at line 65 of file qaudio.h.

◆ IdleState

auto QtAudio::IdleState = QAudio::IdleState
inlineconstexpr

Definition at line 69 of file qaudio.h.

◆ IOError

auto QtAudio::IOError = QAudio::IOError
inlineconstexpr

Definition at line 59 of file qaudio.h.

◆ isAudioSinkCallback

template<typename F>
bool QtAudio::isAudioSinkCallback
inlineconstexpr
Initial value:

Definition at line 114 of file qtaudio.h.

◆ isAudioSourceCallback

template<typename F>
bool QtAudio::isAudioSourceCallback
inlineconstexpr
Initial value:
=
QtAudioPrivate::isInvokableWithSpan<F, const float, const uint8_t, const int16_t,
const int32_t>
#define F(x, y, z)

Definition at line 109 of file qtaudio.h.

◆ LinearVolumeScale

auto QtAudio::LinearVolumeScale = QAudio::LinearVolumeScale
inlineconstexpr

Definition at line 70 of file qaudio.h.

◆ LogarithmicVolumeScale

auto QtAudio::LogarithmicVolumeScale = QAudio::LogarithmicVolumeScale
inlineconstexpr

Definition at line 72 of file qaudio.h.

◆ NoError

auto QtAudio::NoError = QAudio::NoError
inlineconstexpr

Definition at line 57 of file qaudio.h.

◆ OpenError

auto QtAudio::OpenError = QAudio::OpenError
inlineconstexpr

Definition at line 58 of file qaudio.h.

◆ StoppedState

auto QtAudio::StoppedState = QAudio::StoppedState
inlineconstexpr

Definition at line 68 of file qaudio.h.

◆ SuspendedState

auto QtAudio::SuspendedState = QAudio::SuspendedState
inlineconstexpr

Definition at line 67 of file qaudio.h.

◆ UnderrunError

QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED constexpr auto QtAudio::UnderrunError = QAudio::UnderrunError
inlineconstexpr

Definition at line 63 of file qaudio.h.