Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable to cleanly quit from the program when audio is enabled #61

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/event/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ void AudioEventRegister::unregisterCallback()

void AudioEventRegister::processRemote(int nbOfChannels, int samplesByChannel, qi::AnyValue altimestamp, qi::AnyValue buffer)
{
boost::mutex::scoped_lock callback_lock(mutex_);
naoqi_bridge_msgs::AudioBuffer msg = naoqi_bridge_msgs::AudioBuffer();
msg.header.stamp = ros::Time::now();
msg.frequency = 48000;
Expand All @@ -174,7 +175,6 @@ void AudioEventRegister::processRemote(int nbOfChannels, int samplesByChannel, q
msg.data = std::vector<int16_t>(remoteBuffer, remoteBuffer+bufferSize);

std::vector<message_actions::MessageAction> actions;
boost::mutex::scoped_lock callback_lock(mutex_);
if (isStarted_) {
// CHECK FOR PUBLISH
if ( isPublishing_ && publisher_->isSubscribed() )
Expand Down
4 changes: 3 additions & 1 deletion src/event/touch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ void TouchEventRegister<T>::stopProcess()
//std::string serviceName = std::string("ROS-Driver-") + typeid(T).name();
std::string serviceName = std::string("ROS-Driver-") + keys_[0];
if(serviceId){
p_memory_.call<void>("unsubscribeToEvent", serviceName, "touchCallback");
for(std::vector<std::string>::const_iterator it = keys_.begin(); it != keys_.end(); ++it) {
p_memory_.call<void>("unsubscribeToEvent",it->c_str(), serviceName);
}
session_->unregisterService(serviceId);
serviceId = 0;
}
Expand Down