diff options
Diffstat (limited to 'src/uscxml')
-rw-r--r-- | src/uscxml/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/uscxml/Interpreter.cpp | 4 | ||||
-rw-r--r-- | src/uscxml/plugins/datamodel/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/uscxml/plugins/element/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/CMakeLists.txt | 23 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp | 54 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/audio/OpenALInvoker.h | 7 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp | 25 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/CMakeLists.txt | 6 |
9 files changed, 98 insertions, 41 deletions
diff --git a/src/uscxml/CMakeLists.txt b/src/uscxml/CMakeLists.txt index 391b498..cf52a77 100644 --- a/src/uscxml/CMakeLists.txt +++ b/src/uscxml/CMakeLists.txt @@ -64,6 +64,12 @@ add_subdirectory(plugins/element) add_subdirectory(plugins/ioprocessor) add_subdirectory(plugins/invoker) +SET(USCXML_INVOKERS ${USCXML_INVOKERS} PARENT_SCOPE) +SET(USCXML_IOPROCESSORS ${USCXML_IOPROCESSORS} PARENT_SCOPE) +SET(USCXML_ELEMENTS ${USCXML_ELEMENTS} PARENT_SCOPE) +SET(USCXML_DATAMODELS ${USCXML_DATAMODELS} PARENT_SCOPE) +SET(USCXML_LANGUAGE_BINDINGS ${USCXML_LANGUAGE_BINDINGS} PARENT_SCOPE) + set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE) set(USCXML_OPT_LIBS ${USCXML_OPT_LIBS} PARENT_SCOPE) set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE) diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index 4015026..4e9dff0 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -400,13 +400,13 @@ void InterpreterImpl::normalize(Arabica::DOM::Element<std::string>& scxml) { } void InterpreterImpl::receiveInternal(const Event& event) { - std::cout << _name << " receiveInternal: " << event.name << std::endl; +// std::cout << _name << " receiveInternal: " << event.name << std::endl; _internalQueue.push_back(event); // _condVar.notify_all(); } void InterpreterImpl::receive(const Event& event, bool toFront) { - std::cout << _name << " receive: " << event.name << std::endl; +// std::cout << _name << " receive: " << event.name << std::endl; if (toFront) { _externalQueue.push_front(event); } else { diff --git a/src/uscxml/plugins/datamodel/CMakeLists.txt b/src/uscxml/plugins/datamodel/CMakeLists.txt index ce13cdb..5fe82b7 100644 --- a/src/uscxml/plugins/datamodel/CMakeLists.txt +++ b/src/uscxml/plugins/datamodel/CMakeLists.txt @@ -1,4 +1,5 @@ if (JSC_FOUND AND BUILD_DM_ECMA) + set(USCXML_DATAMODELS "ecmascript(JSC) ${USCXML_DATAMODELS}") # JavaScriptCore ecmascript datamodel file(GLOB JSC_DATAMODEL ecmascript/JavaScriptCore/*.cpp @@ -29,6 +30,7 @@ if (JSC_FOUND AND BUILD_DM_ECMA) else() # GOOGLE V8 ecmascript datamodel + set(USCXML_DATAMODELS "ecmascript(V8) ${USCXML_DATAMODELS}") # set(ENV{V8_SRC} ${CMAKE_SOURCE_DIR}/../v8) if (V8_FOUND AND BUILD_DM_ECMA) file(GLOB V8_DATAMODEL @@ -63,6 +65,7 @@ endif() # NULL datamodel +set(USCXML_DATAMODELS "null ${USCXML_DATAMODELS}") file(GLOB NULL_DATAMODEL null/*.cpp null/*.h @@ -80,6 +83,7 @@ endif() # XPath datamodel if (BUILD_DM_XPATH) + set(USCXML_DATAMODELS "xpath ${USCXML_DATAMODELS}") file(GLOB XPATH_DATAMODEL xpath/*.cpp xpath/*.h @@ -97,6 +101,7 @@ endif() # SWI PROLOG datamodel if (SWI_FOUND AND BUILD_DM_PROLOG) + set(USCXML_DATAMODELS "prolog ${USCXML_DATAMODELS}") # message(FATAL_ERROR "SWI_INCLUDE_DIR: ${SWI_INCLUDE_DIR}") # if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") @@ -126,4 +131,5 @@ if (SWI_FOUND AND BUILD_DM_PROLOG) endif() set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE) -set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE)
\ No newline at end of file +set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE) +set(USCXML_DATAMODELS ${USCXML_DATAMODELS} PARENT_SCOPE) diff --git a/src/uscxml/plugins/element/CMakeLists.txt b/src/uscxml/plugins/element/CMakeLists.txt index 6697962..f24a609 100644 --- a/src/uscxml/plugins/element/CMakeLists.txt +++ b/src/uscxml/plugins/element/CMakeLists.txt @@ -1,5 +1,6 @@ # Fetch element +set(USCXML_ELEMENTS "fetch ${USCXML_ELEMENTS}") file(GLOB_RECURSE FETCH_ELEMENT fetch/*.cpp fetch/*.h @@ -35,6 +36,7 @@ endif() # Postpone element +set(USCXML_ELEMENTS "postpone ${USCXML_ELEMENTS}") file(GLOB_RECURSE POSTPONE_ELEMENT postpone/*.cpp postpone/*.h @@ -53,6 +55,7 @@ endif() # Respond element +set(USCXML_ELEMENTS "respond ${USCXML_ELEMENTS}") file(GLOB_RECURSE RESPOND_ELEMENT respond/*.cpp respond/*.h @@ -69,4 +72,5 @@ else() endif() set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE) -set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE)
\ No newline at end of file +set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE) +set(USCXML_ELEMENTS ${USCXML_ELEMENTS} PARENT_SCOPE) diff --git a/src/uscxml/plugins/invoker/CMakeLists.txt b/src/uscxml/plugins/invoker/CMakeLists.txt index 5f1f6a0..def840a 100644 --- a/src/uscxml/plugins/invoker/CMakeLists.txt +++ b/src/uscxml/plugins/invoker/CMakeLists.txt @@ -1,4 +1,5 @@ # sample invoker - include to make sure it compiles +set(USCXML_INVOKERS "sample ${USCXML_INVOKERS}") file(GLOB_RECURSE SAMPLE_INVOKER sample/*.cpp sample/*.h @@ -17,6 +18,7 @@ endif() # DirMon invoker to watch for filesystem changes +set(USCXML_INVOKERS "dirmon ${USCXML_INVOKERS}") file(GLOB_RECURSE DIRMON_INVOKER filesystem/dirmon/*.cpp filesystem/dirmon/*.h @@ -51,8 +53,9 @@ else() endif() -# System invoker to open a native command +# XHTML invoker +set(USCXML_INVOKERS "xhtml ${USCXML_INVOKERS}") file(GLOB_RECURSE XHTML_INVOKER xhtml/*.cpp xhtml/*.h @@ -130,6 +133,7 @@ endif() # calendar invoker if (LIBICAL_FOUND) + set(USCXML_INVOKERS "calendar ${USCXML_INVOKERS}") file(GLOB_RECURSE CALENDAR_INVOKER calendar/*.cpp calendar/*.h @@ -150,6 +154,7 @@ endif() # location invoker if (CORELOCATION_LIBRARY AND OFF) + set(USCXML_INVOKERS "location ${USCXML_INVOKERS}") file(GLOB_RECURSE LOCATION_INVOKER location/CoreLocation/*.cpp location/CoreLocation/*.mm @@ -171,6 +176,7 @@ endif() # UMUNDO invoker if (UMUNDO_FOUND) + set(USCXML_INVOKERS "umundo ${USCXML_INVOKERS}") file(GLOB_RECURSE UMUNDO_INVOKER umundo/*.cpp umundo/*.cc @@ -192,6 +198,7 @@ endif() # USCXML invoker +set(USCXML_INVOKERS "scxml ${USCXML_INVOKERS}") file(GLOB_RECURSE USCXML_INVOKER scxml/*.cpp scxml/*.h) @@ -210,6 +217,7 @@ endif() # HTTP server invoker +set(USCXML_INVOKERS "httpservlet ${USCXML_INVOKERS}") file(GLOB_RECURSE HTTPSERVLET_INVOKER http/*.cpp http/*.h) @@ -228,6 +236,7 @@ endif() # Heartbeat invoker +set(USCXML_INVOKERS "heartbeat ${USCXML_INVOKERS}") file(GLOB_RECURSE HEARTBEAT_INVOKER heartbeat/*.cpp heartbeat/*.h @@ -245,7 +254,8 @@ endif() # OpenSceneGraph invoker -if (OPENSCENEGRAPH_FOUND AND OPENGL_FOUND) +if (OPENSCENEGRAPH_FOUND AND OPENGL_FOUND) + set(USCXML_INVOKERS "scenegraph ${USCXML_INVOKERS}") file(GLOB OPENSCENEGRAPH_INVOKER graphics/openscenegraph/*.cpp graphics/openscenegraph/*.h) @@ -264,6 +274,7 @@ if (OPENSCENEGRAPH_FOUND AND OPENGL_FOUND) list (APPEND USCXML_FILES ${OPENSCENEGRAPH_INVOKER}) endif() + set(USCXML_INVOKERS "osgvonvert ${USCXML_INVOKERS}") file(GLOB OPENSCENEGRAPH_CONVERTER_INVOKER graphics/openscenegraph/converter/*.cpp graphics/openscenegraph/converter/*.h) @@ -287,7 +298,8 @@ endif() # OpenAL modality components if (OPENAL_FOUND AND (LIBSNDFILE_FOUND OR AUDIOTOOLBOX_FOUND)) - file(GLOB_RECURSE OPENAL_INVOKER + set(USCXML_INVOKERS "openal ${USCXML_INVOKERS}") + file(GLOB_RECURSE OPENAL_INVOKER audio/OpenAL*.cpp audio/OpenAL*.h) if (LIBSNDFILE_FOUND) @@ -321,6 +333,7 @@ endif() # MILES modality components if (MILES_FOUND) + set(USCXML_INVOKERS "miles ${USCXML_INVOKERS}") file(GLOB_RECURSE MILES_INVOKER miles/*.cpp miles/*.h) @@ -345,6 +358,7 @@ endif() # VoiceXML modality components if (UMUNDO_FOUND) + set(USCXML_INVOKERS "vxml ${USCXML_INVOKERS}") file(GLOB_RECURSE VXML_INVOKER vxml/*.cpp vxml/*.h @@ -362,4 +376,5 @@ if (UMUNDO_FOUND) endif() set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE) -set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE)
\ No newline at end of file +set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE) +set(USCXML_INVOKERS ${USCXML_INVOKERS} PARENT_SCOPE) diff --git a/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp b/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp index 477a788..d038573 100644 --- a/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp +++ b/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp @@ -29,7 +29,12 @@ OpenALInvoker::OpenALInvoker() { _alContext = NULL; _alDevice = NULL; _thread = NULL; - _listenerPos[0] = _listenerPos[1] = _listenerPos[2] = 0; + _listenerPos[0] = _listenerPos[1] = _listenerPos[2] = 0; + _listenerVel[0] = _listenerVel[1] = _listenerVel[2] = 0; + _maxPos[0] = _maxPos[1] = _maxPos[2] = 1; + + _listenerOrient[0] = _listenerOrient[1] = _listenerOrient[3] = _listenerOrient[5] = 0; + _listenerOrient[2] = _listenerOrient[4] = 1.0; } OpenALInvoker::~OpenALInvoker() { @@ -103,8 +108,12 @@ void OpenALInvoker::send(const SendRequest& req) { getPosFromParams(req.params, _sources[req.sendid]->pos); + _sources[req.sendid]->pos[0] -= _listenerPos[0]; + _sources[req.sendid]->pos[1] -= _listenerPos[1]; + _sources[req.sendid]->pos[2] -= _listenerPos[2]; try { _sources[req.sendid]->player->setPosition(_sources[req.sendid]->pos); + } catch (std::exception ex) { returnErrorExecution(ex.what()); } @@ -135,6 +144,7 @@ void OpenALInvoker::send(const SendRequest& req) { if (boost::iequals(req.name, "move.listener")) { getPosFromParams(req.params, _listenerPos); + try { alcMakeContextCurrent(_alContext); alListenerfv(AL_POSITION, _listenerPos); @@ -251,6 +261,17 @@ void OpenALInvoker::invoke(const InvokeRequest& req) { throw std::string("__FILE__ __LINE__ openal error opening device"); } + std::multimap<std::string, std::string>::const_iterator paramIter = req.params.begin(); + while(paramIter != req.params.end()) { + if (boost::iequals(paramIter->first, "maxX")) + _maxPos[0] = strTo<float>(paramIter->second); + if (boost::iequals(paramIter->first, "maxY")) + _maxPos[1] = strTo<float>(paramIter->second); + if (boost::iequals(paramIter->first, "maxZ")) + _maxPos[2] = strTo<float>(paramIter->second); + paramIter++; + } + // create new context with device _alContext = alcCreateContext (_alDevice, NULL); if (_alContext == NULL) { @@ -261,19 +282,16 @@ void OpenALInvoker::invoke(const InvokeRequest& req) { // std::cout << boost::lexical_cast<std::string>(_alContext); // std::cout << boost::lexical_cast<std::string>(_alDevice); -// alcMakeContextCurrent(_alContext); + alcMakeContextCurrent(_alContext); // float listener[3] = {0,0,0}; // alListenerfv(AL_POSITION, listener); -// -// float orientation[6] = { -// 0.0, 0.0, -1.0, // direction -// 0.0, 1.0, 0.0 }; //up -// alListenerfv(AL_ORIENTATION, orientation); -// -// float velocity[3] = { 0.0, 0.0, 0.0}; //up -// alListenerfv(AL_VELOCITY, velocity); -// -// alListenerf(AL_GAIN, 0.5); + + alcMakeContextCurrent(_alContext); + alListenerfv(AL_POSITION, _listenerPos); + alListenerfv(AL_VELOCITY, _listenerVel); + alListenerfv(AL_ORIENTATION, _listenerOrient); + + alListenerf(AL_GAIN, 0.5); start(); } @@ -325,18 +343,18 @@ void OpenALInvoker::getPosFromParams(const std::multimap<std::string, std::strin float rad = posToRadian(params.find("circle")->second); position[0] = cosf(rad); position[2] = -1 * sinf(rad); // z axis increases to front - position[0] *= 150; - position[2] *= 150; +// position[0] *= 150; +// position[2] *= 150; } } catch (boost::bad_lexical_cast& e) { LOG(ERROR) << "Cannot interpret circle as float value in params: " << e.what(); } -// position[0] = position[0] / _maxPos[0]; -// position[1] = position[1] / _maxPos[1]; -// position[2] = position[2] / _maxPos[2]; - // std::cout << _pos[0] << ":" << _pos[1] << ":" << _pos[2] << std::endl; + position[0] = position[0] / _maxPos[0]; + position[1] = position[1] / _maxPos[1]; + position[2] = position[2] / _maxPos[2]; +// std::cout << position[0] << ":" << position[1] << ":" << position[2] << std::endl; } diff --git a/src/uscxml/plugins/invoker/audio/OpenALInvoker.h b/src/uscxml/plugins/invoker/audio/OpenALInvoker.h index 2ef567b..9b71d95 100644 --- a/src/uscxml/plugins/invoker/audio/OpenALInvoker.h +++ b/src/uscxml/plugins/invoker/audio/OpenALInvoker.h @@ -31,7 +31,7 @@ public: bool finished; int read; int written; - float pos[3]; + ALfloat pos[3]; URL file; PCMConverter* transform; }; @@ -66,7 +66,10 @@ protected: bool _isStarted; bool _isRunning; - float _listenerPos[3]; + ALfloat _listenerPos[3]; + ALfloat _listenerVel[3]; + ALfloat _listenerOrient[6]; + float _maxPos[3]; static void fillBuffers(void* userdata); void start(); diff --git a/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp b/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp index a5f90b8..64fa70a 100644 --- a/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp +++ b/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp @@ -83,7 +83,7 @@ OpenALPlayer::~OpenALPlayer() { } alDeleteBuffers(_nrBuffers, _bufferIds); for (int i = 0; i < _nrBuffers; i++) { - assert(!alIsBuffer(_bufferIds[i])); +// assert(!alIsBuffer(_bufferIds[i])); } free(_buffers); free(_bufferIds); @@ -160,28 +160,27 @@ void OpenALPlayer::init() { } // set our position and various flags to meaningful defaults + alSourcei (_alId, AL_SOURCE_RELATIVE, AL_TRUE); + checkOpenALError(__LINE__); alSourcei(_alId, AL_LOOPING, AL_FALSE); checkOpenALError(__LINE__); alSourcefv(_alId, AL_POSITION, _position); checkOpenALError(__LINE__); - alSourcef(_alId,AL_REFERENCE_DISTANCE, 5.0f); - checkOpenALError(__LINE__); -// alDistanceModel(AL_LINEAR_DISTANCE); -// checkOpenALError(__LINE__); -// alSourcefv(_alId, AL_VELOCITY, _velocity); -// checkOpenALError(__LINE__); -// alSourcefv(_alId, AL_DIRECTION, _direction); +// alSourcef(_alId,AL_REFERENCE_DISTANCE, 5.0f); // checkOpenALError(__LINE__); + alDistanceModel(AL_LINEAR_DISTANCE); + checkOpenALError(__LINE__); + alSourcefv(_alId, AL_VELOCITY, _velocity); + checkOpenALError(__LINE__); + alSourcefv(_alId, AL_DIRECTION, _direction); + checkOpenALError(__LINE__); // alSourcef (_alId, AL_ROLLOFF_FACTOR, 1.0); // checkOpenALError(__LINE__); - alSourcef(_alId,AL_REFERENCE_DISTANCE, 5.0f); - checkOpenALError(__LINE__); +// alSourcef(_alId,AL_REFERENCE_DISTANCE, 5.0f); +// checkOpenALError(__LINE__); // float listener[] = { 0.0, 0.0, 0.0 }; // alListenerfv(AL_POSITION, listener); // checkOpenALError(__LINE__); - - alSourcei (_alId, AL_SOURCE_RELATIVE, AL_TRUE); - checkOpenALError(__LINE__); } /** diff --git a/src/uscxml/plugins/ioprocessor/CMakeLists.txt b/src/uscxml/plugins/ioprocessor/CMakeLists.txt index 9fda5f8..8f124ed 100644 --- a/src/uscxml/plugins/ioprocessor/CMakeLists.txt +++ b/src/uscxml/plugins/ioprocessor/CMakeLists.txt @@ -1,3 +1,4 @@ +set(USCXML_IOPROCESSORS "sample ${USCXML_IOPROCESSORS}") file(GLOB_RECURSE SAMPLE_IOPROCESSOR sample/*.cpp sample/*.h @@ -13,6 +14,7 @@ else() list (APPEND USCXML_FILES ${SAMPLE_IOPROCESSOR}) endif() +set(USCXML_IOPROCESSORS "comet ${USCXML_IOPROCESSORS}") file(GLOB_RECURSE COMET_IOPROCESSOR comet/*.cpp comet/*.h @@ -31,6 +33,7 @@ endif() # LIBEVENT basichttp ioprocessor - this one is already required above +set(USCXML_IOPROCESSORS "basichttp ${USCXML_IOPROCESSORS}") file(GLOB_RECURSE BASICHTTP_IOPROCESSOR basichttp/*.cpp basichttp/*.h @@ -49,6 +52,7 @@ endif() # scxml ioprocessor - this one is already required above +set(USCXML_IOPROCESSORS "scxml ${USCXML_IOPROCESSORS}") file(GLOB_RECURSE SCXML_IOPROCESSOR scxml/*.cpp scxml/*.h @@ -73,6 +77,7 @@ if (PROTOBUF_FOUND) message(FATAL_ERROR "protoc binary required for serialization") endif() + set(USCXML_IOPROCESSORS "mmi ${USCXML_IOPROCESSORS}") file(GLOB_RECURSE MMI_IOPROCESSOR modality/*.cpp modality/*.h @@ -105,3 +110,4 @@ endif() set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE) set(USCXML_OPT_LIBS ${USCXML_OPT_LIBS} PARENT_SCOPE) set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE) +set(USCXML_IOPROCESSORS ${USCXML_IOPROCESSORS} PARENT_SCOPE) |