summaryrefslogtreecommitdiff
path: root/src/multimedia/audio/qsoundeffect_pulse_p.h
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@jollamobile.com>2014-07-22 18:24:33 +0200
committerRobin Burchell <robin+qt@viroteck.net>2014-08-04 20:38:40 +0200
commite316aa649174d0b9717ebde2ccde2b04c009cae1 (patch)
treebee05c319a1c3b74922badb3afd0995719b80b8c /src/multimedia/audio/qsoundeffect_pulse_p.h
parent5f33d7bea3fd3dd441aff499576826a02e8e5be2 (diff)
downloadqtmultimedia-e316aa649174d0b9717ebde2ccde2b04c009cae1.tar.gz
Resource policy support for QSoundEffect.
Since sound effects are something short and mixed with other audio, do not acquire resources explicitly. Follow the resources availability information to determine when it is ok to play the sound effects. When client has registered itself to resource manager, client's streams are classified properly. If no higher priority client has acquired the resources, isAvailable() is true, and sound effects can be played. We do not explicitly acquire the resources, since then other clients with the same resource class would lose the resources, thus not possible to have second client play music with QMediaPlayer class while our client would just want to play simple sound effects. Change-Id: Ib5589349dca6900a8bee616b8ad77e7cb5ec9533 Done-with: Juho Hämäläinen <juho.hamalainen@tieto.com> Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
Diffstat (limited to 'src/multimedia/audio/qsoundeffect_pulse_p.h')
-rw-r--r--src/multimedia/audio/qsoundeffect_pulse_p.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.h b/src/multimedia/audio/qsoundeffect_pulse_p.h
index 042679180..a20f95693 100644
--- a/src/multimedia/audio/qsoundeffect_pulse_p.h
+++ b/src/multimedia/audio/qsoundeffect_pulse_p.h
@@ -62,6 +62,9 @@
#include <pulse/pulseaudio.h>
#include "qsamplecache_p.h"
+#include <private/qmediaresourcepolicy_p.h>
+#include <private/qmediaresourceset_p.h>
+
QT_BEGIN_NAMESPACE
class QSoundEffectRef;
@@ -119,7 +122,10 @@ private Q_SLOTS:
void updateVolume();
void updateMuted();
+ void handleAvailabilityChanged(bool available);
+
private:
+ void playAvailable();
void playSample();
void emptyStream();
@@ -164,6 +170,17 @@ private:
QSample *m_sample;
int m_position;
QSoundEffectRef *m_ref;
+
+ enum ResourceStatus {
+ NoResources,
+ WaitingResources,
+ GrantedResources,
+ DeniedResources
+ };
+ ResourceStatus m_resourceStatus;
+ bool m_resourcesAvailable;
+
+ QMediaPlayerResourceSetInterface *m_resources;
};
QT_END_NAMESPACE