23#include "pulsestream_p.h"
27#include "pulsesupport.h"
34 , mStreamUuid(streamUuid)
35 , mIndex(PA_INVALID_INDEX)
41 pa_cvolume_init(&mVolume);
44PulseStream::~PulseStream()
48QString PulseStream::uuid()
const
53uint32_t PulseStream::index()
const
58void PulseStream::setIndex(uint32_t index)
63uint8_t PulseStream::channels()
const
65 return mVolume.channels;
68void PulseStream::setDevice(
int device)
70 if (mDevice != device) {
72 emit usingDevice(device);
77static const qreal LOUDNESS_TO_VOLTAGE_EXPONENT = qreal(0.67);
78static const qreal VOLTAGE_TO_LOUDNESS_EXPONENT = qreal(1.0/LOUDNESS_TO_VOLTAGE_EXPONENT);
80void PulseStream::setVolume(
const pa_cvolume *volume)
82 if (mCachedVolume != -1)
84 if (pa_cvolume_equal(&mVolume, volume) == 0) {
85 memcpy(&mVolume, volume,
sizeof(mVolume));
86 qreal vol = (qreal)pa_cvolume_avg(volume) / PA_VOLUME_NORM;
90 emit volumeChanged(qPow(vol, VOLTAGE_TO_LOUDNESS_EXPONENT));
94void PulseStream::setMute(
bool mute)
98 emit muteChanged(mMute);
102qreal PulseStream::cachedVolume()
const
104 return mCachedVolume;
107void PulseStream::setCachedVolume(qreal volume)
112QString PulseStream::role()
const
117void PulseStream::applyCachedVolume()
119 if (mCachedVolume == -1)
121 PulseSupport::getInstance()->setOutputVolume(mStreamUuid, mCachedVolume);
127#include "moc_pulsestream_p.cpp"
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:58:26 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.