summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/invoker/audio
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-08-21 15:16:52 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-08-21 15:16:52 (GMT)
commitbd45c688b3d3aad5d62b85457ce943eaadf989ae (patch)
tree831d54da85c85f3e998be70241f8ffc3fed7f924 /src/uscxml/plugins/invoker/audio
parenta52fb3364968e31a1a15c85ac45b68d9f531687b (diff)
downloaduscxml-bd45c688b3d3aad5d62b85457ce943eaadf989ae.zip
uscxml-bd45c688b3d3aad5d62b85457ce943eaadf989ae.tar.gz
uscxml-bd45c688b3d3aad5d62b85457ce943eaadf989ae.tar.bz2
Added WebStorage object to document
Some refinements to DotWriter
Diffstat (limited to 'src/uscxml/plugins/invoker/audio')
-rw-r--r--src/uscxml/plugins/invoker/audio/AudioToolbox.mm18
-rw-r--r--src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp13
-rw-r--r--src/uscxml/plugins/invoker/audio/OpenALInvoker.h1
-rw-r--r--src/uscxml/plugins/invoker/audio/OpenALPlayer.h2
4 files changed, 31 insertions, 3 deletions
diff --git a/src/uscxml/plugins/invoker/audio/AudioToolbox.mm b/src/uscxml/plugins/invoker/audio/AudioToolbox.mm
index 44720b1..58e0224 100644
--- a/src/uscxml/plugins/invoker/audio/AudioToolbox.mm
+++ b/src/uscxml/plugins/invoker/audio/AudioToolbox.mm
@@ -4,10 +4,20 @@
#import <Foundation/Foundation.h>
#import <Foundation/NSURL.h>
+#ifdef __has_feature
+# if __has_feature(objc_arc)
+# define(HAS_AUTORELEASE_POOL)
+# endif
+#endif
+
namespace uscxml {
AudioToolbox::AudioToolbox(const std::string filename) {
- @autoreleasepool {
+#if HAS_AUTORELEASE_POOL
+ @autoreleasepool {
+#else
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+#endif
_afId = 0;
NSString* filePath = [NSString stringWithCString:filename.c_str() encoding:NSASCIIStringEncoding];
NSURL* afUrl = [NSURL fileURLWithPath:filePath];
@@ -44,7 +54,11 @@ AudioToolbox::AudioToolbox(const std::string filename) {
return;
}
- }
+#if HAS_AUTORELEASE_POOL
+ }
+#else
+ [pool drain];
+#endif
}
AudioToolbox::~AudioToolbox() {
diff --git a/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp b/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp
index 6b52c8c..6403a80 100644
--- a/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp
+++ b/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp
@@ -29,6 +29,7 @@ OpenALInvoker::OpenALInvoker() {
_alContext = NULL;
_alDevice = NULL;
_thread = NULL;
+ _listenerPos[0] = _listenerPos[1] = _listenerPos[2] = 0;
}
OpenALInvoker::~OpenALInvoker() {
@@ -131,6 +132,18 @@ void OpenALInvoker::send(const SendRequest& req) {
returnErrorExecution(ex.what());
}
}
+
+ if (boost::iequals(req.name, "move.listener")) {
+ getPosFromParams(req.params, _listenerPos);
+ try {
+ alcMakeContextCurrent(_alContext);
+ alListenerfv(AL_POSITION, _listenerPos);
+ OpenALPlayer::checkOpenALError(__LINE__);
+ } catch (std::exception ex) {
+ returnErrorExecution(ex.what());
+ }
+ }
+
}
void OpenALInvoker::start() {
diff --git a/src/uscxml/plugins/invoker/audio/OpenALInvoker.h b/src/uscxml/plugins/invoker/audio/OpenALInvoker.h
index 086bfe8..2ef567b 100644
--- a/src/uscxml/plugins/invoker/audio/OpenALInvoker.h
+++ b/src/uscxml/plugins/invoker/audio/OpenALInvoker.h
@@ -66,6 +66,7 @@ protected:
bool _isStarted;
bool _isRunning;
+ float _listenerPos[3];
static void fillBuffers(void* userdata);
void start();
diff --git a/src/uscxml/plugins/invoker/audio/OpenALPlayer.h b/src/uscxml/plugins/invoker/audio/OpenALPlayer.h
index 4d7d189..7ea069d 100644
--- a/src/uscxml/plugins/invoker/audio/OpenALPlayer.h
+++ b/src/uscxml/plugins/invoker/audio/OpenALPlayer.h
@@ -63,7 +63,6 @@ private:
void updateBuffers();
void init();
- void checkOpenALError(int line);
// static wrapper as an entry point for pthreads
static void updateBuffersWrapper(void *obj);
@@ -76,6 +75,7 @@ public:
virtual ~OpenALPlayer();
unsigned int isPlaying();
+ static void checkOpenALError(int line);
ALfloat* getPosition();
void setPosition(ALfloat[3]);