summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaszlo Papp <lpapp@kde.org>2012-07-01 11:31:40 +0100
committerLaszlo Papp <lpapp@kde.org>2012-09-18 17:09:56 +0200
commit9cbfa691bf93624f8bfec5f65bfb64bf5b1ab052 (patch)
treef93e9f020839f5dde556f98f88239a57b7af14da /src
parent3a36ac4486aa1e2db6e4aceac2c5cfcfea871ed8 (diff)
Add a basic QALListener class with few mutators and one accessor method
Change-Id: Ib766196fdb53040ca697aab4a6a56311d04459c8 Reviewed-by: Laszlo Papp <lpapp@kde.org>
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/qallistener.cpp95
-rw-r--r--src/qallistener.h70
3 files changed, 167 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a7a597f..0983610 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -49,6 +49,7 @@ set(QtOpenAL_SRCS
qalbufferformat.cpp
qalbufferqueue.cpp
qalcontext.cpp
+ qallistener.cpp
qalsource.cpp
decoders/qalflacaudiodecoder.cpp
@@ -62,6 +63,7 @@ set(QtOpenAL_HEADERS
qalbufferformat.h
qalbufferqueue.h
qalcontext.h
+ qallistener.h
qalsource.h
${CMAKE_CURRENT_BINARY_DIR}/qtopenal_global.h
diff --git a/src/qallistener.cpp b/src/qallistener.cpp
new file mode 100644
index 0000000..1c696bf
--- /dev/null
+++ b/src/qallistener.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtAudio3D module 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$
+**
+****************************************************************************/
+
+#include "qallistener.h"
+
+QALListener::QALListener()
+{
+}
+
+QALListener::~QALListener()
+{
+}
+
+float QALListener::gain() const
+{
+ float gain;
+ alGetListenerf(AL_GAIN, &gain);
+
+ return gain;
+}
+
+void QALListener::setPosition(int px, int py, int pz)
+{
+ alListener3i(AL_POSITION, px, py, pz);
+}
+
+void QALListener::setPosition(float px, float py, float pz)
+{
+ alListener3f(AL_POSITION, px, py, pz);
+}
+
+void QALListener::setVelocity(int vx, int vy, int vz)
+{
+ alListener3i(AL_VELOCITY, vx, vy, vz);
+}
+
+void QALListener::setVelocity(float vx, float vy, float vz)
+{
+ alListener3f(AL_VELOCITY, vx, vy, vz);
+}
+
+void QALListener::setOrientation(int x1, int y1, int z1, int x2, int y2, int z2)
+{
+ ALint orientationVector[] = {x1, y1, z1, x2, y2, z2};
+ alListeneriv(AL_ORIENTATION, orientationVector);
+}
+
+void QALListener::setOrientation(float x1, float y1, float z1, float x2, float y2, float z2)
+{
+ ALfloat orientationVector[] = {x1, y1, z1, x2, y2, z2};
+ alListenerfv(AL_ORIENTATION, orientationVector);
+}
+
+void QALListener::setGain(float gain)
+{
+ alListenerf(AL_GAIN, gain);
+}
diff --git a/src/qallistener.h b/src/qallistener.h
new file mode 100644
index 0000000..6f229f5
--- /dev/null
+++ b/src/qallistener.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtAudio3D module 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 QALLISTENER_H
+#define QALLISTENER_H
+
+#include "q_openal_export.h"
+
+#include <QtGui/QVector3D>
+
+class Q_OPENAL_EXPORT QALListener
+{
+ //Q_DECLARE_PRIVATE(QALListener)
+public:
+ QALListener();
+ virtual ~QALListener();
+
+ float gain() const;
+
+ void setGain(float gain);
+
+ void setPosition(int px, int py, int pz);
+ void setPosition(float px, float py, float pz);
+
+ void setVelocity(int vx, int vy, int vz);
+ void setVelocity(float vx, float vy, float vz);
+
+ void setOrientation(int x1, int y1, int z1, int x2, int y2, int z2);
+ void setOrientation(float x1, float y1, float z1, float x2, float y2, float z2);
+};
+
+#endif