summaryrefslogtreecommitdiffstats
path: root/src/imports/audioengine/qdeclarative_sound_p.h
diff options
context:
space:
mode:
authorSiteshwar Vashisht <siteshwar@gmail.com>2015-03-25 19:43:19 +0530
committerKonstantin Ritt <ritt.ks@gmail.com>2015-04-23 11:56:18 +0000
commit176d52bb28b425f697ad8df001ba2c7c52fda766 (patch)
treeffc4740404f9537bcef939acddb25c2cce4f7203 /src/imports/audioengine/qdeclarative_sound_p.h
parent227c8aa723d9e82c2826a1d2823cd73236f18bbb (diff)
Refactored code for audio engine to allow dynamic object creation
QDeclarativeSound, QDeclarativeAudioSample, QDeclarativeAudioCategory and QDeclarativeAttenuationModel can now be dynamically added to AudioEngine instance or declared inside AudioEngine object definition. QDeclarativePlayVariation can now be dynamically added to Sound instance or declared inside Sound object definition. Change-Id: If4c2e16895a71eb71ded1998c107360698f8ac7f Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Diffstat (limited to 'src/imports/audioengine/qdeclarative_sound_p.h')
-rw-r--r--src/imports/audioengine/qdeclarative_sound_p.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/imports/audioengine/qdeclarative_sound_p.h b/src/imports/audioengine/qdeclarative_sound_p.h
index 14ebd1039..83b1eb2af 100644
--- a/src/imports/audioengine/qdeclarative_sound_p.h
+++ b/src/imports/audioengine/qdeclarative_sound_p.h
@@ -35,7 +35,6 @@
#define QDECLARATIVESOUND_P_H
#include <QtQml/qqml.h>
-#include <QtQml/qqmlcomponent.h>
#include <QtCore/qlist.h>
#include "qdeclarative_playvariation_p.h"
@@ -44,6 +43,7 @@ QT_BEGIN_NAMESPACE
class QDeclarativeAudioCategory;
class QDeclarativeAttenuationModel;
class QDeclarativeSoundInstance;
+class QDeclarativeAudioEngine;
class QDeclarativeSoundCone : public QObject
{
@@ -65,21 +65,21 @@ public:
qreal outerGain() const;
void setOuterGain(qreal outerGain);
- void componentComplete();
+ void setEngine(QDeclarativeAudioEngine *engine);
private:
Q_DISABLE_COPY(QDeclarativeSoundCone)
qreal m_innerAngle;
qreal m_outerAngle;
qreal m_outerGain;
+ QDeclarativeAudioEngine *m_engine;
};
-class QDeclarativeSound : public QObject, public QQmlParserStatus
+class QDeclarativeSound : public QObject
{
friend class QDeclarativeSoundCone;
Q_OBJECT
- Q_INTERFACES(QQmlParserStatus)
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(PlayType playType READ playType WRITE setPlayType)
Q_PROPERTY(QString category READ category WRITE setCategory)
@@ -99,9 +99,6 @@ public:
QDeclarativeSound(QObject *parent = 0);
~QDeclarativeSound();
- void classBegin();
- void componentComplete();
-
PlayType playType() const;
void setPlayType(PlayType playType);
@@ -114,6 +111,9 @@ public:
QString attenuationModel() const;
void setAttenuationModel(const QString &attenuationModel);
+ QDeclarativeAudioEngine *engine() const;
+ void setEngine(QDeclarativeAudioEngine *);
+
QDeclarativeSoundCone* cone() const;
QDeclarativeAttenuationModel* attenuationModelObject() const;
@@ -128,6 +128,8 @@ public:
QQmlListProperty<QDeclarativePlayVariation> playVariationlist();
QList<QDeclarativePlayVariation*>& playlist();
+ Q_INVOKABLE Q_REVISION(1) void addPlayVariation(QDeclarativePlayVariation*);
+
public Q_SLOTS:
void play();
void play(qreal gain);
@@ -147,7 +149,6 @@ private:
Q_DISABLE_COPY(QDeclarativeSound)
QDeclarativeSoundInstance* newInstance(bool managed);
static void appendFunction(QQmlListProperty<QDeclarativePlayVariation> *property, QDeclarativePlayVariation *value);
- bool m_complete;
PlayType m_playType;
QString m_name;
QString m_category;
@@ -157,6 +158,7 @@ private:
QDeclarativeAttenuationModel *m_attenuationModelObject;
QDeclarativeAudioCategory *m_categoryObject;
+ QDeclarativeAudioEngine *m_engine;
};
QT_END_NAMESPACE