Fix volume change error on mono stream for soundeffect(pulseaudio)
(Cherry-picked from 663df44fc8563c548c26a7ae21927b09664c28f2) Change-Id: I005071bc1a8b2eae4d0660042fc8986d61804c47 Reviewed-by: Michael Goddard Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
@@ -129,8 +129,9 @@ public:
|
|||||||
|
|
||||||
inline pa_cvolume * calcVolume(pa_cvolume *dest, int soundEffectVolume)
|
inline pa_cvolume * calcVolume(pa_cvolume *dest, int soundEffectVolume)
|
||||||
{
|
{
|
||||||
dest->channels = 2;
|
pa_volume_t v = m_vol * soundEffectVolume / 100;
|
||||||
dest->values[0] = dest->values[1] = m_vol * soundEffectVolume / 100;
|
for (int i = 0; i < dest->channels; ++i)
|
||||||
|
dest->values[i] = v;
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,6 +395,7 @@ void QSoundEffectPrivate::updateVolume()
|
|||||||
return;
|
return;
|
||||||
PulseDaemonLocker locker;
|
PulseDaemonLocker locker;
|
||||||
pa_cvolume volume;
|
pa_cvolume volume;
|
||||||
|
volume.channels = m_pulseSpec.channels;
|
||||||
pa_operation_unref(pa_context_set_sink_input_volume(daemon()->context(), m_sinkInputId, daemon()->calcVolume(&volume, m_volume), setvolume_callback, this));
|
pa_operation_unref(pa_context_set_sink_input_volume(daemon()->context(), m_sinkInputId, daemon()->calcVolume(&volume, m_volume), setvolume_callback, this));
|
||||||
Q_ASSERT(pa_cvolume_valid(&volume));
|
Q_ASSERT(pa_cvolume_valid(&volume));
|
||||||
#ifdef QT_PA_DEBUG
|
#ifdef QT_PA_DEBUG
|
||||||
|
|||||||
Reference in New Issue
Block a user