summaryrefslogtreecommitdiff
path: root/src/multimedia/audio/qsoundeffect_qaudio_p.h
diff options
context:
space:
mode:
authorKurt Korbatits <kurt.korbatits@nokia.com>2012-07-18 15:39:20 +1000
committerQt by Nokia <qt-info@nokia.com>2012-07-26 23:10:46 +0200
commitb976589a66eafc7b69195a690210fe1d02bb141e (patch)
treeb2b1b9d049dd2806444e9cc3bfd1269675c8a0c1 /src/multimedia/audio/qsoundeffect_qaudio_p.h
parent6ebee9f57e0e4e189b667605bfe9436504bd7385 (diff)
downloadqtmultimedia-b976589a66eafc7b69195a690210fe1d02bb141e.tar.gz
Replace QSoundEffect backend using qmedia with qaudiooutput implementation
- Use backend built on QAudioOutput - Fixed unit test so backend will pass Change-Id: I2f2a7d8bf382127c5a5c333d6e36c79169754b4e Reviewed-by: Michael Goddard <michael.goddard@nokia.com> Reviewed-by: Kurt Korbatits <kurt.korbatits@nokia.com>
Diffstat (limited to 'src/multimedia/audio/qsoundeffect_qaudio_p.h')
-rw-r--r--src/multimedia/audio/qsoundeffect_qaudio_p.h158
1 files changed, 158 insertions, 0 deletions
diff --git a/src/multimedia/audio/qsoundeffect_qaudio_p.h b/src/multimedia/audio/qsoundeffect_qaudio_p.h
new file mode 100644
index 000000000..def1e72f1
--- /dev/null
+++ b/src/multimedia/audio/qsoundeffect_qaudio_p.h
@@ -0,0 +1,158 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSOUNDEFFECT_QAUDIO_H
+#define QSOUNDEFFECT_QAUDIO_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+#include <QtCore/qurl.h>
+#include "qaudiooutput.h"
+#include "qsamplecache_p.h"
+#include "qsoundeffect.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+class QSoundEffectPrivate;
+
+class PrivateSoundSource : public QIODevice
+{
+ friend class QSoundEffectPrivate;
+ Q_OBJECT
+public:
+ PrivateSoundSource(QSoundEffectPrivate* s);
+ ~PrivateSoundSource() {}
+
+ qint64 readData( char* data, qint64 len);
+ qint64 writeData(const char* data, qint64 len);
+
+private Q_SLOTS:
+ void sampleReady();
+ void decoderError();
+ void stateChanged(QAudio::State);
+
+private:
+ QUrl m_url;
+ int m_loopCount;
+ int m_runningCount;
+ bool m_playing;
+ QSoundEffect::Status m_status;
+ QAudioOutput *m_audioOutput;
+ QSample *m_sample;
+ bool m_muted;
+ int m_volume;
+ bool m_sampleReady;
+ qint64 m_offset;
+ QString m_category;
+
+ QSoundEffectPrivate *soundeffect;
+};
+
+
+class QSoundEffectPrivate : public QObject
+{
+ friend class PrivateSoundSource;
+ Q_OBJECT
+public:
+
+ explicit QSoundEffectPrivate(QObject* parent);
+ ~QSoundEffectPrivate();
+
+ static QStringList supportedMimeTypes();
+
+ QUrl source() const;
+ void setSource(const QUrl &url);
+ int loopCount() const;
+ int loopsRemaining() const;
+ void setLoopCount(int loopCount);
+ int volume() const;
+ void setVolume(int volume);
+ bool isMuted() const;
+ void setMuted(bool muted);
+ bool isLoaded() const;
+ bool isPlaying() const;
+ QSoundEffect::Status status() const;
+
+ void release();
+
+ QString category() const;
+ void setCategory(const QString &);
+
+public Q_SLOTS:
+ void play();
+ void stop();
+
+Q_SIGNALS:
+ void loopsRemainingChanged();
+ void volumeChanged();
+ void mutedChanged();
+ void loadedChanged();
+ void playingChanged();
+ void statusChanged();
+ void categoryChanged();
+
+private:
+ void setStatus(QSoundEffect::Status status);
+ void setPlaying(bool playing);
+ void setLoopsRemaining(int loopsRemaining);
+
+ PrivateSoundSource* d;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QSOUNDEFFECT_QAUDIO_H