[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39120] branches/soc-2011-pepper/intern/ audaspace/intern: 3D Audio GSoC:
Joerg Mueller
nexyon at gmail.com
Sun Aug 7 08:22:50 CEST 2011
Revision: 39120
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39120
Author: nexyon
Date: 2011-08-07 06:22:50 +0000 (Sun, 07 Aug 2011)
Log Message:
-----------
3D Audio GSoC:
Added a NULLHandle to prevent a crash in Python API when the device is the NULLDevice.
Modified Paths:
--------------
branches/soc-2011-pepper/intern/audaspace/intern/AUD_NULLDevice.cpp
branches/soc-2011-pepper/intern/audaspace/intern/AUD_NULLDevice.h
Modified: branches/soc-2011-pepper/intern/audaspace/intern/AUD_NULLDevice.cpp
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/intern/AUD_NULLDevice.cpp 2011-08-07 05:24:58 UTC (rev 39119)
+++ branches/soc-2011-pepper/intern/audaspace/intern/AUD_NULLDevice.cpp 2011-08-07 06:22:50 UTC (rev 39120)
@@ -32,10 +32,86 @@
#include <limits>
#include "AUD_NULLDevice.h"
-#include "AUD_IReader.h"
-#include "AUD_IFactory.h"
-#include "AUD_IHandle.h"
+AUD_NULLDevice::AUD_NULLHandle::AUD_NULLHandle()
+{
+}
+
+bool AUD_NULLDevice::AUD_NULLHandle::pause()
+{
+ return false;
+}
+
+bool AUD_NULLDevice::AUD_NULLHandle::resume()
+{
+ return false;
+}
+
+bool AUD_NULLDevice::AUD_NULLHandle::stop()
+{
+ return false;
+}
+
+bool AUD_NULLDevice::AUD_NULLHandle::getKeep()
+{
+ return false;
+}
+
+bool AUD_NULLDevice::AUD_NULLHandle::setKeep(bool keep)
+{
+ return false;
+}
+
+bool AUD_NULLDevice::AUD_NULLHandle::seek(float position)
+{
+ return false;
+}
+
+float AUD_NULLDevice::AUD_NULLHandle::getPosition()
+{
+ return 0.0f;
+}
+
+AUD_Status AUD_NULLDevice::AUD_NULLHandle::getStatus()
+{
+ return AUD_STATUS_INVALID;
+}
+
+float AUD_NULLDevice::AUD_NULLHandle::getVolume()
+{
+ return 0.0f;
+}
+
+bool AUD_NULLDevice::AUD_NULLHandle::setVolume(float volume)
+{
+ return false;
+}
+
+float AUD_NULLDevice::AUD_NULLHandle::getPitch()
+{
+ return 0.0f;
+}
+
+bool AUD_NULLDevice::AUD_NULLHandle::setPitch(float pitch)
+{
+ return false;
+}
+
+int AUD_NULLDevice::AUD_NULLHandle::getLoopCount()
+{
+ return 0;
+}
+
+bool AUD_NULLDevice::AUD_NULLHandle::setLoopCount(int count)
+{
+ return false;
+}
+
+bool AUD_NULLDevice::AUD_NULLHandle::setStopCallback(stopCallback callback, void* data)
+{
+ return false;
+}
+
AUD_NULLDevice::AUD_NULLDevice()
{
}
@@ -55,12 +131,12 @@
AUD_Reference<AUD_IHandle> AUD_NULLDevice::play(AUD_Reference<AUD_IReader> reader, bool keep)
{
- return AUD_Reference<AUD_IHandle>();
+ return new AUD_NULLHandle();
}
AUD_Reference<AUD_IHandle> AUD_NULLDevice::play(AUD_Reference<AUD_IFactory> factory, bool keep)
{
- return AUD_Reference<AUD_IHandle>();
+ return new AUD_NULLHandle();
}
void AUD_NULLDevice::lock()
Modified: branches/soc-2011-pepper/intern/audaspace/intern/AUD_NULLDevice.h
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/intern/AUD_NULLDevice.h 2011-08-07 05:24:58 UTC (rev 39119)
+++ branches/soc-2011-pepper/intern/audaspace/intern/AUD_NULLDevice.h 2011-08-07 06:22:50 UTC (rev 39120)
@@ -34,12 +34,37 @@
#include "AUD_IReader.h"
#include "AUD_IDevice.h"
+#include "AUD_IHandle.h"
/**
* This device plays nothing.
*/
class AUD_NULLDevice : public AUD_IDevice
{
+private:
+ class AUD_NULLHandle : public AUD_IHandle
+ {
+ public:
+
+ AUD_NULLHandle();
+
+ virtual ~AUD_NULLHandle() {}
+ virtual bool pause();
+ virtual bool resume();
+ virtual bool stop();
+ virtual bool getKeep();
+ virtual bool setKeep(bool keep);
+ virtual bool seek(float position);
+ virtual float getPosition();
+ virtual AUD_Status getStatus();
+ virtual float getVolume();
+ virtual bool setVolume(float volume);
+ virtual float getPitch();
+ virtual bool setPitch(float pitch);
+ virtual int getLoopCount();
+ virtual bool setLoopCount(int count);
+ virtual bool setStopCallback(stopCallback callback = 0, void* data = 0);
+ };
public:
/**
* Creates a new NULL device.
More information about the Bf-blender-cvs
mailing list