Browse Source

调试播放提示音ok

corvin 5 years ago
parent
commit
d4ad7aad63

+ 2 - 0
.gitignore

@@ -6,3 +6,5 @@ AIVoiceSystem
 tts_offline_sample
 /example/xf_awaken/bin/msc/*/
 awaken_offline_sample
+build/
+devel/

+ 1 - 1
catkin_ws/src/snowboy_wakeup/CMakeLists.txt

@@ -7,7 +7,7 @@ find_package(catkin REQUIRED COMPONENTS
     dynamic_reconfigure
 )
 
-set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
+set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules)
 
 find_package(BLAS)

+ 7 - 4
catkin_ws/src/snowboy_wakeup/src/hotword_detector_node.cpp

@@ -8,6 +8,9 @@
 
 namespace snowboy_wakeup
 {
+    std::string beep_filename;
+    std::string pre_param = "play -q --multi-threaded ";
+    std::string all_param;
     //!
     //! \brief The HotwordDetectorNode class Wraps the C++ 11 Snowboy detector in a ROS node
     //!
@@ -32,12 +35,12 @@ namespace snowboy_wakeup
                     ROS_ERROR("Mandatory parameter 'model_filename' not present on the parameter server");
                     return false;
                 }
-                
-                std::string beep_filename;
+
                 if (!nh_p_.getParam("beep_filename", beep_filename))
                 {
                     ROS_WARN("Mandatory parameter 'beep_filename' not present on the parameter server");
                 }
+                all_param = pre_param + beep_filename;
 
                 std::string asr_topic;
                 if (!nh_p_.getParam("asr_topic", asr_topic))
@@ -113,13 +116,13 @@ namespace snowboy_wakeup
                     }
 
                     std_msgs::Int32 hotword_msg;
-                    int result = detector_.runDetection( &sample_array[0], msg->data.size()/2);                    
+                    int result = detector_.runDetection( &sample_array[0], msg->data.size()/2);
                     if (result == 1)
                     {
                         ROS_DEBUG("wakeUp detected!");
                         hotword_msg.data = result;
                         hotword_pub_.publish(hotword_msg);
-                        system("play -q --multi-threaded " + beep_filename);
+                        system(all_param.data());
                     }
                     else if (result == -3)
                     {