summaryrefslogtreecommitdiff
path: root/src/multimedia/audio/qsoundeffect_pulse_p.h
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2016-02-05 14:07:20 +0100
committerYoann Lopes <yoann.lopes@theqtcompany.com>2016-03-16 12:04:33 +0000
commitb17e0cd5dd28b93b1ea567c676f0e183acb6dd7c (patch)
tree4ad693212afdc479429eb5d609af9d078cc6baae /src/multimedia/audio/qsoundeffect_pulse_p.h
parent399ec97f101f8bc4917139bf658bb08fd5316811 (diff)
downloadqtmultimedia-b17e0cd5dd28b93b1ea567c676f0e183acb6dd7c.tar.gz
PulseAudio: change the way volume is applied.
We used to change the PulseAudio sink input volume. Doing so had some potential unwanted side effects depending on the PulseAudio server configuration. When flat volumes were enabled, it would affect the global system volume. It could also affect the volume of other streams having the same audio role. Volumes in Qt Multimedia are supposed to be relative to the application volume and should not affect anything else than the object on which it was changed. To guarantee that, PulseAudio volume APIs are not used anymore. Instead, software-based volume attenuation is applied on the audio samples before being passed to PulseAudio. Applies to QSoundEffect, QAudioOutput and QAudioInput. Task-number: QTBUG-40823 Task-number: QTBUG-49461 Change-Id: I690716976bda8fe666969ca2cbdf6d8d0b419733 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src/multimedia/audio/qsoundeffect_pulse_p.h')
-rw-r--r--src/multimedia/audio/qsoundeffect_pulse_p.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.h b/src/multimedia/audio/qsoundeffect_pulse_p.h
index 9b3564cc9..0f16b98a2 100644
--- a/src/multimedia/audio/qsoundeffect_pulse_p.h
+++ b/src/multimedia/audio/qsoundeffect_pulse_p.h
@@ -50,6 +50,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qdatetime.h>
+#include <QtCore/qreadwritelock.h>
#include <qmediaplayer.h>
#include <pulse/pulseaudio.h>
#include "qsamplecache_p.h"
@@ -111,8 +112,6 @@ private Q_SLOTS:
void prepare();
void streamReady();
void emptyComplete(void *stream);
- void updateVolume();
- void updateMuted();
void handleAvailabilityChanged(bool available);
@@ -124,6 +123,8 @@ private:
void createPulseStream();
void unloadPulseStream();
+ int writeToStream(const void *data, int size);
+
void setPlaying(bool playing);
void setStatus(QSoundEffect::Status status);
void setLoopsRemaining(int loopsRemaining);
@@ -136,8 +137,6 @@ private:
static void stream_write_done_callback(void *p);
static void stream_adjust_prebuffer_callback(pa_stream *s, int success, void *userdata);
static void stream_reset_buffer_callback(pa_stream *s, int success, void *userdata);
- static void setvolume_callback(pa_context *c, int success, void *userdata);
- static void setmuted_callback(pa_context *c, int success, void *userdata);
pa_stream *m_pulseStream;
int m_sinkInputId;
@@ -165,11 +164,9 @@ private:
bool m_resourcesAvailable;
- QMediaPlayerResourceSetInterface *m_resources;
+ mutable QReadWriteLock m_volumeLock;
-#if defined(Q_WS_MAEMO_6) || defined(NEMO_AUDIO)
- bool m_customVolume;
-#endif
+ QMediaPlayerResourceSetInterface *m_resources;
};
QT_END_NAMESPACE