diff --git a/sound_play/CMakeLists.txt b/sound_play/CMakeLists.txt
index 23be34e7..1353c758 100644
--- a/sound_play/CMakeLists.txt
+++ b/sound_play/CMakeLists.txt
@@ -13,8 +13,18 @@ find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(audio_common_msgs REQUIRED)
find_package(action_msgs REQUIRED)
+find_package(rclcpp REQUIRED)
+find_package(rclcpp_action REQUIRED)
+find_package(diagnostic_msgs REQUIRED)
+find_package(ament_index_cpp REQUIRED)
-include_directories(rclcpp audio_common_msgs action_msgs builtin_interfaces)
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(GST REQUIRED gstreamer-1.0)
+
+include_directories(
+ include
+ ${GST_INCLUDE_DIRS}
+)
set(msg_files
"msg/SoundRequest.msg"
@@ -33,7 +43,29 @@ rosidl_generate_interfaces(${PROJECT_NAME}
builtin_interfaces
)
-ament_python_install_package(${PROJECT_NAME})
+# Build C++ soundplay node
+add_executable(soundplay_node_cpp src/soundplay_node.cpp)
+ament_target_dependencies(soundplay_node_cpp
+ rclcpp
+ rclcpp_action
+ diagnostic_msgs
+ ament_index_cpp
+)
+target_link_libraries(soundplay_node_cpp ${GST_LIBRARIES})
+
+# Need to link against the generated interfaces
+rosidl_get_typesupport_target(cpp_typesupport_target ${PROJECT_NAME} "rosidl_typesupport_cpp")
+target_link_libraries(soundplay_node_cpp "${cpp_typesupport_target}")
+
+install(TARGETS soundplay_node_cpp
+ DESTINATION lib/${PROJECT_NAME}
+)
+
+# Install Python package manually to avoid conflicts with rosidl_generate_interfaces
+install(DIRECTORY ${PROJECT_NAME}/
+ DESTINATION lib/python3.12/site-packages/${PROJECT_NAME}
+ FILES_MATCHING PATTERN "*.py"
+)
install(PROGRAMS
scripts/is_speaking.py
diff --git a/sound_play/launch/soundplay_node.launch.xml b/sound_play/launch/soundplay_node.launch.xml
index 54b4634c..98c17ff5 100644
--- a/sound_play/launch/soundplay_node.launch.xml
+++ b/sound_play/launch/soundplay_node.launch.xml
@@ -1,5 +1,5 @@
@@ -8,7 +8,7 @@ sounds based on messages on the robotsound topic.
-
+
diff --git a/sound_play/package.xml b/sound_play/package.xml
index 5bd98e9c..6ddbd6c4 100644
--- a/sound_play/package.xml
+++ b/sound_play/package.xml
@@ -26,10 +26,19 @@
audio_common_msgs
boost
builtin_interfaces
+ rclcpp
+ rclcpp_action
+ diagnostic_msgs
+ ament_index_cpp
+ libgstreamer1.0-dev
action_msgs
audio_common_msgs
builtin_interfaces
+ rclcpp
+ rclcpp_action
+ diagnostic_msgs
+ ament_index_cpp
festival
launch_xml
rclpy
diff --git a/sound_play/src/soundplay_node.cpp b/sound_play/src/soundplay_node.cpp
new file mode 100644
index 00000000..0662059a
--- /dev/null
+++ b/sound_play/src/soundplay_node.cpp
@@ -0,0 +1,662 @@
+// **********************************************************
+// Software License Agreement (BSD License)
+//
+// Copyright (c) 2009, Willow Garage, Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of the Willow Garage nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// **********************************************************
+
+#include
+#include
+#include
+#include
+#include