Cleaned up listener code.
authorlpcamargo <lucaspcamargo@gmail.com>
Mon, 22 Jun 2015 17:03:51 +0000 (20:03 +0300)
committerlpcamargo <lucaspcamargo@gmail.com>
Mon, 22 Jun 2015 17:03:51 +0000 (20:03 +0300)
src/nSoundBag.cpp
src/nSoundBuffer.cpp
src/nSoundEffectParameters.cpp
src/nSoundListener.cpp
src/nSoundListener.h
src/nSoundSource.h
src/nSoundStreamer.cpp

index 3e56e33c3333ef68ee3bfd34ca6e4a833255d288..9f7dab92a94bcb1784e0848a4d6d54a8771b20b4 100644 (file)
@@ -24,8 +24,6 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "nSoundBag.h"
-#include <cstdio>
-#include <cstdlib>
 
 nSoundBag::nSoundBag(nSoundFormat format, quint64 frames, int freq, QObject * parent):
     QObject(parent)
index b0d85eb68ae29d5e516f4fe5e41396d6deae7414..60fb9dfaef482a402bffd94862e580b1bcb3b173 100644 (file)
@@ -27,7 +27,7 @@
 #include "nSoundSystem.h"
 #include "nSoundBag.h"
 #include "nSoundStream.h"
-#include "AL/al.h"
+#include "neiasound_al.h"
 
 nSoundBuffer::nSoundBuffer(QString name, nSoundSystem * parent) :
     QObject(parent)
index 1e88221f92ec98a443133705c122d32239cad3a6..04a39812d51282fbfa7c0d974da40acba009018b 100644 (file)
@@ -24,7 +24,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "nSoundEffectParameters.h"
-#include "AL/al.h"
+#include "neiasound_al.h"
 #include "util/nEfxHelper.h"
 
 
index a09223a99782c9da91f21a449c49fa805350ecff..10fed022119ea88a9d8c4d8f801b4fbf14a3b85d 100644 (file)
 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "nSoundListener.h"
 #include "nSoundSystem.h"
-#ifdef NEIA
-#include "../scene/nSceneCamera.h"
-#include "OgreCamera.h"
-#endif
 
-#include "AL/al.h"
+#include "neiasound_al.h"
 
 nSoundListener::nSoundListener(nSoundSystem * parent) :
     QObject(parent)
 {
-#ifdef NEIA
-    m_camera = 0;
-#endif
     m_updating = true;
 }
 
-#ifdef NEIA
-void nSoundListener::setSourceCamera(nSceneCamera * cam)
-{
-    if(m_camera)
-    {
-        disconnect(this, SLOT(cameraDestroyed()));
-    }
-    m_camera = cam;
-    if(m_camera) //camera can be set to null
-    {
-        m_camLastPos = m_camera->ogreCamera()->getPosition();
-        connect(m_camera, SIGNAL(destroyed()), SLOT(cameraDestroyed()));
-    }
-}
-void nSoundListener::cameraDestroyed()
-{
-    disconnect(this, SLOT(cameraDestroyed()));
-    m_camera = 0;
-}
-#endif
 
 void nSoundListener::update(qreal frameTime)
 {
     Q_UNUSED(frameTime)
 
-#ifdef NEIA
-    if(m_updating && m_camera)
-    {
-        nVec3 pos(m_camera->ogreCamera()->getRealPosition()),
-                dir(m_camera->ogreCamera()->getRealDirection()),
-                up(m_camera->ogreCamera()->getRealUp());
-        nVec3 vel = pos - m_camLastPos;
-        m_camLastPos = pos;
-        vel/=frameTime;
-
-
-        updateManual(QVector3D());
-    }
-#endif
-
 }
 
 void nSoundListener::updateManual(QVector3D pos, QVector3D dir, QVector3D up, QVector3D vel)
index 09bb5a66cae0791bab4d909641ca5ec93125f5bd..713bea2b24828127153e69d83d0df18af884868c 100644 (file)
@@ -36,35 +36,22 @@ class nSoundSystem;
 class NEIASOUNDSHARED_EXPORT nSoundListener : public QObject
 {
     Q_OBJECT
-#ifdef NEIA
-    Q_PROPERTY(nSceneCamera * sourceCamera READ sourceCamera WRITE setSourceCamera)
-#endif
+
     Q_PROPERTY(bool updating READ isUpdating WRITE setUpdating)
 public:
     explicit nSoundListener(nSoundSystem * parent);
 
-#ifdef NEIA
-    nSceneCamera * sourceCamera(){return m_camera;}
-    void setSourceCamera(nSceneCamera * cam);
-#endif
-
     bool isUpdating(){return m_updating;}
     void setUpdating(bool b){m_updating = b;}
 
 signals:
 
 public slots:
-#ifdef NEIA
-    void cameraDestroyed();
-#endif
+
     void update(qreal frameTime);
     void updateManual(QVector3D position, QVector3D direction, QVector3D up, QVector3D velocity);
 
 private:
-#ifdef NEIA
-    nSceneCamera * m_camera;
-    nVec3 m_camLastPos;
-#endif
     bool m_updating;
 };
 
index bb3979a0d23540212cfbd75c7b72ba133434ea53..d02bb88904bc6c251429036dffb3b3e87fc01f53 100644 (file)
@@ -33,7 +33,7 @@
 
 class nSoundSystem;
 class nSoundBuffer;
-
+class nSoundFilter;
 
 class NEIASOUNDSHARED_EXPORT nSoundSource : public QObject
 {
index 2c5d20418c003cc064715573a5b1f3edc65b690e..6b276435ad3497fe8b247a52c162330b68a89dfe 100644 (file)
 #include "nSoundBag.h"
 #include "nSoundStream.h"
 #include "nSoundStreamerPlaylist.h"
-#include "AL/al.h"
+#include "neiasound_al.h"
 
 
-const int nSS_BUFFER_SIZE = 4096;
+const int NSS_BUFFER_SIZE = 8192;
 
 nSoundStreamer::nSoundStreamer(QString name, nSoundSource * source, nSoundStreamerPlaylist * playlist, nSoundSystem * parent) :
     QObject(parent)
@@ -68,7 +68,7 @@ nSoundStreamer::nSoundStreamer(QString name, nSoundSource * source, nSoundStream
     m_currentStream = 0;
     nSoundStream * stream = m_playlist->m_items[m_currentStream].m_soundStream;
     m_bag = new nSoundBag(stream->format(),
-        (stream->frames() < nSS_BUFFER_SIZE? stream->frames() : nSS_BUFFER_SIZE),
+        (stream->frames() < NSS_BUFFER_SIZE? stream->frames() : NSS_BUFFER_SIZE),
         stream->frequency(), this);
 
     //fill in initial data and queue buffers
@@ -242,7 +242,7 @@ nSoundStreamerUpdater::nSoundStreamerUpdater(nSoundStreamer *parent) : QObject(0
     _streamer(parent),
     _keepGoing(true)
 {
-    startTimer(static_cast<int>(nSS_BUFFER_SIZE / 44100.0 * 1000));
+    startTimer(static_cast<int>(NSS_BUFFER_SIZE / 44100.0 * 1000));
 }
 
 nSoundStreamerUpdater::~nSoundStreamerUpdater()