diff options
20 files changed, 166 insertions, 85 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 861b5b4..82a8b4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -637,6 +637,12 @@ set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_STATIC}) # we use include instead of add_subdirectory because # source groups do not work otherwise. +SET(USCXML_INVOKERS) +SET(USCXML_IOPROCESSORS) +SET(USCXML_ELEMENTS) +SET(USCXML_DATAMODELS) +SET(USCXML_LANGUAGE_BINDINGS) + add_subdirectory(src/uscxml) include_directories(${USCXML_INCLUDE_DIRS}) @@ -773,26 +779,12 @@ foreach(LIBRARY ${USCXML_OPT_LIBS}) endif() endforeach() -set(AVAILABLE_DATAMODELS "") -set(ALL_FILES_STRING "${USCXML_FILES}") -if(ALL_FILES_STRING MATCHES ".*datamodel/ecmascript.*" OR TARGET datamodel_v8) - set(AVAILABLE_DATAMODELS "ecmascript ${AVAILABLE_DATAMODELS}") -endif() -if(ALL_FILES_STRING MATCHES ".*datamodel/prolog.*" OR TARGET datamodel_swi) - set(AVAILABLE_DATAMODELS "prolog ${AVAILABLE_DATAMODELS}") -endif() -if(ALL_FILES_STRING MATCHES ".*datamodel/xpath.*" OR TARGET datamodel_xpath) - set(AVAILABLE_DATAMODELS "xpath ${AVAILABLE_DATAMODELS}") -endif() - -set(AVAILABLE_LANGUAGE_BINDINGS "") -if (TARGET uscxmlNativePHP) - set(AVAILABLE_LANGUAGE_BINDINGS "php ${AVAILABLE_LANGUAGE_BINDINGS}") -endif() - message(STATUS "Targets:") -message(STATUS " Available datamodels ........... : null ${AVAILABLE_DATAMODELS}") -message(STATUS " Available language bindings .... : ${AVAILABLE_LANGUAGE_BINDINGS}") +message(STATUS " Available datamodels ........... : ${USCXML_DATAMODELS}") +message(STATUS " Available invokers ............. : ${USCXML_INVOKERS}") +message(STATUS " Available ioprocessors ......... : ${USCXML_IOPROCESSORS}") +message(STATUS " Available custom elements ...... : ${USCXML_ELEMENTS}") +message(STATUS " Available language bindings .... : ${USCXML_LANGUAGE_BINDINGS}") if (BUILD_SHARED_LIBS AND BUILD_BINDINGS) message(STATUS "") message(STATUS " Warning: Building language bindings BUILD_SHARED_LIBS=ON") diff --git a/contrib/prebuilt/README.md b/contrib/prebuilt/README.md new file mode 100644 index 0000000..81196cd --- /dev/null +++ b/contrib/prebuilt/README.md @@ -0,0 +1,3 @@ +# Prebuilt Libraries + +This directory will be populated by prebuilt libraries at configure time from CMake.
\ No newline at end of file diff --git a/src/bindings/CMakeLists.txt b/src/bindings/CMakeLists.txt index 97206b4..82ad509 100644 --- a/src/bindings/CMakeLists.txt +++ b/src/bindings/CMakeLists.txt @@ -11,3 +11,4 @@ if (SWIG_FOUND) else() message("SWIG not found - skipping wrapper generation") endif() +set(USCXML_LANGUAGE_BINDINGS ${USCXML_LANGUAGE_BINDINGS} PARENT_SCOPE) diff --git a/src/bindings/swig/java/CMakeLists.txt b/src/bindings/swig/java/CMakeLists.txt index b66e3f2..2b604f3 100644 --- a/src/bindings/swig/java/CMakeLists.txt +++ b/src/bindings/swig/java/CMakeLists.txt @@ -20,6 +20,8 @@ SET_SOURCE_FILES_PROPERTIES(uscxml.i PROPERTIES SWIG_FLAGS "-package;${SCXMLPL_J SET_SOURCE_FILES_PROPERTIES(uscxml.i PROPERTIES CPLUSPLUS ON) SET(CMAKE_SWIG_OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/${SCXMLPL_JAVA_DIR}") +set(USCXML_LANGUAGE_BINDINGS "java ${USCXML_LANGUAGE_BINDINGS}") + SWIG_ADD_MODULE(uscxmlNativeJava java uscxml.i) foreach(JNI_LIBRARY ${JNI_LIBRARIES}) if (NOT ${JNI_LIBRARY} MATCHES ".*jawt.*") @@ -30,3 +32,4 @@ set_target_properties(uscxmlNativeJava PROPERTIES FOLDER "Bindings") set_target_properties(uscxmlNativeJava PROPERTIES COMPILE_FLAGS "-DSWIG") swig_link_libraries(uscxmlNativeJava uscxml) +set(USCXML_LANGUAGE_BINDINGS ${USCXML_LANGUAGE_BINDINGS} PARENT_SCOPE) diff --git a/src/bindings/swig/php/CMakeLists.txt b/src/bindings/swig/php/CMakeLists.txt index efe6ef4..aa21910 100644 --- a/src/bindings/swig/php/CMakeLists.txt +++ b/src/bindings/swig/php/CMakeLists.txt @@ -84,6 +84,8 @@ if (PHP_DEBUG_ENABLED) set(PHP_COMPILE_FLAGS "${PHP_COMPILE_FLAGS} -DZEND_DEBUG") endif() +set(USCXML_LANGUAGE_BINDINGS "php ${USCXML_LANGUAGE_BINDINGS}") + ADD_CUSTOM_COMMAND( TARGET uscxmlNativePHP POST_BUILD @@ -94,4 +96,5 @@ ADD_CUSTOM_COMMAND( set_target_properties(uscxmlNativePHP PROPERTIES COMPILE_FLAGS ${PHP_COMPILE_FLAGS}) set_target_properties(uscxmlNativePHP PROPERTIES FOLDER "Bindings") +set(USCXML_LANGUAGE_BINDINGS ${USCXML_LANGUAGE_BINDINGS} PARENT_SCOPE) 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) diff --git a/test/samples/uscxml/applications/SpatialMapTicker.java b/test/samples/uscxml/applications/SpatialMapTicker.java index 5ccb0a2..8d2a5f1 100644 --- a/test/samples/uscxml/applications/SpatialMapTicker.java +++ b/test/samples/uscxml/applications/SpatialMapTicker.java @@ -109,10 +109,10 @@ public class SpatialMapTicker { private void run() { messages.add(new SensorMessage("Oil pressure threshold exceeded")); - messages.add(new SensorMessage("Error #245 in diagnostics unit")); + messages.add(new SensorMessage("Equipment is on fire")); messages.add(new SensorMessage("Error #32 in diagnostics unit")); - messages.add(new SensorMessage("Error #81 in diagnostics unit")); - messages.add(new SensorMessage("Error #15 in diagnostics unit")); + messages.add(new SensorMessage("Unauthorized startup")); + messages.add(new SensorMessage("Tire pressure too low")); messages.add(new SensorMessage("Error #145 in diagnostics unit")); messages.add(new SensorMessage("Unit was moved out of construction site area")); messages.add(new SensorMessage("Hydraulic pressure exceeding safety limits")); @@ -122,7 +122,7 @@ public class SpatialMapTicker { while (true) { try { - Thread.sleep((long) (Math.random() * 1000) + 200); + Thread.sleep((long) (Math.random() * 300) + 100); } catch (InterruptedException e) { e.printStackTrace(); } diff --git a/test/samples/uscxml/applications/click.wav b/test/samples/uscxml/applications/click.wav Binary files differnew file mode 100644 index 0000000..e11b0b7 --- /dev/null +++ b/test/samples/uscxml/applications/click.wav diff --git a/test/samples/uscxml/applications/spoken-map-ticker.scxml b/test/samples/uscxml/applications/spoken-map-ticker.scxml index 926cd6c..5a1c0b2 100644 --- a/test/samples/uscxml/applications/spoken-map-ticker.scxml +++ b/test/samples/uscxml/applications/spoken-map-ticker.scxml @@ -1,4 +1,4 @@ -<scxml datamodel="ecmascript" name="comet-test" +<scxml datamodel="ecmascript" name="mapticker" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:vxml="http://www.w3.org/2001/vxml" xmlns="http://www.w3.org/2005/07/scxml"> @@ -6,6 +6,9 @@ <script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js" /> <state id="start"> + <!-- + Invoke an external HTML browser + --> <invoke type="xhtml" id="xhtml1"> <content src="spoken-map-ticker.xhtml" /> <finalize> @@ -13,42 +16,52 @@ </finalize> </invoke> + <!-- + Invoke a VoiceXML browser + --> <invoke type="vxml" id="vxml" /> + <!-- + Invoke a uMundo component for pub/sub ticker subscription + --> <invoke type="umundo" id="umundo"> <param name="channel" expr="'map/tick'" /> <finalize> - <script>dump(_event);</script> + <!-- <script>dump(_event);</script> --> </finalize> </invoke> - <invoke type="openal" id="audio"> - <!-- <param name="maxX" expr="180" /> - <param name="maxY" expr="18" /> - <param name="maxZ" expr="85" /> --> - </invoke> + <invoke type="openal" id="audio"></invoke> <state id="idle"> - <transition target="idle" event="map.center"> + <!-- + Map in XHTML invoker was moved -> update OpenAL listener position + --> + <transition event="map.center" target="idle"> <send event="move.listener" target="#_audio"> <param name="x" expr="_event.data.lon" /> - <param name="y" expr="18 - _event.data.zoom" /> - <!-- <param name="y" expr="0" /> --> + <param name="y" expr="1" /> <param name="z" expr="_event.data.lat" /> - </send> </transition> + + <!-- + Ticker message was received + -> Send to XHTML invoker to display + -> Play clicking noise from respective direction + -> Speak content if severity exceeds a given threshold + --> <transition target="idle" event="umundo.rcvd"> <send target="#_xhtml1"> <content>${_event.data}</content> </send> <send target="#_audio" event="play" delay="0ms"> - <param name="src" expr="'../audio/click.wav'" /> + <param name="src" expr="'click.wav'" /> <param name="x" expr="_event.data.lon" /> <param name="y" expr="0" /> <param name="z" expr="_event.data.lat" /> </send> - + <if cond="_event.data.message && _event.data.severity > 8"> <send target="#_vxml"> <content> diff --git a/test/samples/uscxml/applications/spoken-map-ticker.xhtml b/test/samples/uscxml/applications/spoken-map-ticker.xhtml index 98df9ea..ace8724 100644 --- a/test/samples/uscxml/applications/spoken-map-ticker.xhtml +++ b/test/samples/uscxml/applications/spoken-map-ticker.xhtml @@ -68,7 +68,7 @@ markers[message.id].feature.popupContentHTML = "<h3>" + message.id + "</h3>" + message.html; } - if (message.lastMsg && message.lastMsg.length > 0) { + if (message.message && message.message.length > 0) { var messageDiv = $("#message")[0]; if (message.timeStamp > lastUpdateTime + 3000) { var timeRuler = document.createElement("div"); @@ -82,7 +82,11 @@ console.log(lastUpdateTime); var messagePara = document.createElement("p"); - messagePara.innerHTML += message.lastMsg; // + messageDiv.innerHTML; + if (message.severity > 7) { + messagePara.setAttribute("style", "color:red; font-weight:bold;"); + } + messagePara.innerHTML += message.message; // + messageDiv.innerHTML; + messageDiv.appendChild(messagePara); messagePara.addEventListener("mousedown", function() { var marker = markers[message.id].marker; diff --git a/test/samples/uscxml/test-performance.scxml b/test/samples/uscxml/test-performance.scxml index 4d2d4c4..a102a18 100644 --- a/test/samples/uscxml/test-performance.scxml +++ b/test/samples/uscxml/test-performance.scxml @@ -1,6 +1,6 @@ <scxml datamodel="ecmascript"> <datamodel> - <data id="iterations">10000</data> + <data id="iterations">1000</data> </datamodel> <state id="start"> <transition target="loop" /> diff --git a/test/samples/uscxml/test-spatial-audio.scxml b/test/samples/uscxml/test-spatial-audio.scxml index d960533..66d06f4 100644 --- a/test/samples/uscxml/test-spatial-audio.scxml +++ b/test/samples/uscxml/test-spatial-audio.scxml @@ -17,7 +17,7 @@ <initial> <transition target="ready" /> </initial> - <invoke type="http://www.smartvortex.eu/mmi/spatial-audio/" src="audio/click.wav" id="spatial-audio.id1"> + <invoke type="openal" id="spatial-audio.id1"> <!-- Explicitly set the start position of an audio source. Keep in mind that the coordinate system is the same as in OpenGL: @@ -31,7 +31,7 @@ <param name="y" expr="0" /> <param name="z" expr="0" /> </invoke> - <invoke type="http://www.smartvortex.eu/mmi/spatial-audio/" src="audio/click.wav" id="spatial-audio.id2"> + <invoke type="openal" id="spatial-audio.id2"> <!-- Set position on a circle. Unit for circle is "deg" in clockwise order with 0 being directly in front, @@ -44,7 +44,9 @@ <state id="ready"> <onentry> <!-- trigger transition in 1 second --> - <send event="spatial-audio.play" delay="1s" /> + <send event="spatial-audio.play" delay="1s"> + <param name="src" expr="'audio/click.wav'" /> + </send> <log expr="'Ready'" /> </onentry> <transition target="click" event="spatial-audio.play" /> @@ -52,15 +54,18 @@ </state> <state id="click"> <onentry> - <send target="#_spatial-audio.id1" event="play" delay="0ms" /> + <send target="#_spatial-audio.id1" event="play"> + <param name="src" expr="'audio/click.wav'" /> + </send> <!-- move position of audio 2 in a circle --> <send target="#_spatial-audio.id2" event="play" delay="200ms"> + <param name="src" expr="'audio/click.wav'" /> <param name="circle" expr="spatialAudio.id2.degree + 'deg'" /> </send> <log expr="'Clicking'" /> - <script>spatialAudio.id2.degree += 10;</script> + <script>spatialAudio.id2.degree += 90;</script> </onentry> <transition target="ready" /> </state> |