21 #include <boost/make_shared.hpp>
25 #include <qi/anyobject.hpp>
37 p_audio_(
session->service(
"ALAudioDevice").value()),
38 p_robot_model_(
session->service(
"ALRobotModel").value()),
55 std::map<std::string, std::string> config_map =\
56 p_robot_model_.call<std::map<std::string, std::string> >(
"_getConfigMap");
58 micConfig = std::atoi(
59 config_map[
"RobotConfig/Head/Device/Micro/Version"].c_str());
74 publisher_ = boost::make_shared<publisher::BasicPublisher<naoqi_bridge_msgs::AudioBuffer> >(
name );
75 recorder_ = boost::make_shared<recorder::BasicEventRecorder<naoqi_bridge_msgs::AudioBuffer> >(
name );
106 serviceId =
session_->registerService(
"ROS-Driver-Audio", shared_from_this()).value();
108 "setClientPreferences",
114 p_audio_.call<
void>(
"subscribe",
"ROS-Driver-Audio");
115 std::cout <<
"Audio Extractor: Start" << std::endl;
127 p_audio_.call<
void>(
"unsubscribe",
"ROS-Driver-Audio");
131 std::cout <<
"Audio Extractor: Stop" << std::endl;
177 naoqi_bridge_msgs::AudioBuffer
msg = naoqi_bridge_msgs::AudioBuffer();
179 msg.frequency = 48000;
182 std::pair<char*, size_t> buffer_pointer = buffer.asRaw();
184 int16_t* remoteBuffer = (int16_t*)buffer_pointer.first;
185 int bufferSize = nbOfChannels * samplesByChannel;
186 msg.data = std::vector<int16_t>(remoteBuffer, remoteBuffer+bufferSize);
188 std::vector<message_actions::MessageAction> actions;
205 if (actions.size() >0)