audio_common for ROS 2
Loading...
Searching...
No Matches
audio_common::MusicNode Class Reference

#include <music_node.hpp>

Inheritance diagram for audio_common::MusicNode:
Collaboration diagram for audio_common::MusicNode:

Public Member Functions

 MusicNode ()
 
 ~MusicNode () override
 

Private Member Functions

void publish_audio (const std::string &file_path)
 
void play_callback (const std::shared_ptr< audio_common_msgs::srv::MusicPlay::Request > request, std::shared_ptr< audio_common_msgs::srv::MusicPlay::Response > response)
 
void pause_callback (const std::shared_ptr< std_srvs::srv::Trigger::Request > request, std::shared_ptr< std_srvs::srv::Trigger::Response > response)
 
void resume_callback (const std::shared_ptr< std_srvs::srv::Trigger::Request > request, std::shared_ptr< std_srvs::srv::Trigger::Response > response)
 
void stop_callback (const std::shared_ptr< std_srvs::srv::Trigger::Request > request, std::shared_ptr< std_srvs::srv::Trigger::Response > response)
 

Private Attributes

int chunk_
 
std::string frame_id_
 
std::atomic< bool > pause_music_
 
std::atomic< bool > stop_music_
 
bool audio_loop_
 
std::atomic< bool > is_thread_alive_
 
std::thread publish_thread_
 
std::mutex pause_mutex_
 
std::condition_variable pause_cv_
 
rclcpp::Publisher< audio_common_msgs::msg::AudioStamped >::SharedPtr player_pub_
 
rclcpp::Service< audio_common_msgs::srv::MusicPlay >::SharedPtr play_service_
 
rclcpp::Service< std_srvs::srv::Trigger >::SharedPtr stop_service_
 
rclcpp::Service< std_srvs::srv::Trigger >::SharedPtr pause_service_
 
rclcpp::Service< std_srvs::srv::Trigger >::SharedPtr resume_service_
 

Constructor & Destructor Documentation

◆ MusicNode()

MusicNode::MusicNode ( )

◆ ~MusicNode()

MusicNode::~MusicNode ( )
override

Member Function Documentation

◆ pause_callback()

void MusicNode::pause_callback ( const std::shared_ptr< std_srvs::srv::Trigger::Request > request,
std::shared_ptr< std_srvs::srv::Trigger::Response > response )
private

◆ play_callback()

void MusicNode::play_callback ( const std::shared_ptr< audio_common_msgs::srv::MusicPlay::Request > request,
std::shared_ptr< audio_common_msgs::srv::MusicPlay::Response > response )
private

◆ publish_audio()

void MusicNode::publish_audio ( const std::string & file_path)
private

◆ resume_callback()

void MusicNode::resume_callback ( const std::shared_ptr< std_srvs::srv::Trigger::Request > request,
std::shared_ptr< std_srvs::srv::Trigger::Response > response )
private

◆ stop_callback()

void MusicNode::stop_callback ( const std::shared_ptr< std_srvs::srv::Trigger::Request > request,
std::shared_ptr< std_srvs::srv::Trigger::Response > response )
private

Member Data Documentation

◆ audio_loop_

bool audio_common::MusicNode::audio_loop_
private

◆ chunk_

int audio_common::MusicNode::chunk_
private

◆ frame_id_

std::string audio_common::MusicNode::frame_id_
private

◆ is_thread_alive_

std::atomic<bool> audio_common::MusicNode::is_thread_alive_
private

◆ pause_cv_

std::condition_variable audio_common::MusicNode::pause_cv_
private

◆ pause_music_

std::atomic<bool> audio_common::MusicNode::pause_music_
private

◆ pause_mutex_

std::mutex audio_common::MusicNode::pause_mutex_
private

◆ pause_service_

rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr audio_common::MusicNode::pause_service_
private

◆ play_service_

rclcpp::Service<audio_common_msgs::srv::MusicPlay>::SharedPtr audio_common::MusicNode::play_service_
private

◆ player_pub_

rclcpp::Publisher<audio_common_msgs::msg::AudioStamped>::SharedPtr audio_common::MusicNode::player_pub_
private

◆ publish_thread_

std::thread audio_common::MusicNode::publish_thread_
private

◆ resume_service_

rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr audio_common::MusicNode::resume_service_
private

◆ stop_music_

std::atomic<bool> audio_common::MusicNode::stop_music_
private

◆ stop_service_

rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr audio_common::MusicNode::stop_service_
private

The documentation for this class was generated from the following files: