[DEV] Update new audio::Time

This commit is contained in:
Edouard DUPIN 2015-04-14 22:01:37 +02:00
parent 666fa1375f
commit 6f0c0f2088
10 changed files with 31 additions and 30 deletions

View File

@ -12,7 +12,7 @@ find_package(catkin REQUIRED COMPONENTS
std_msgs std_msgs
audio_msg audio_msg
message_generation message_generation
river audio_river
) )
################################################ ################################################

View File

@ -23,10 +23,10 @@
<build_depend>rospy</build_depend> <build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend> <build_depend>std_msgs</build_depend>
<build_depend>audio_msg</build_depend> <build_depend>audio_msg</build_depend>
<build_depend>river</build_depend> <build_depend>audio_river</build_depend>
<run_depend>roscpp</run_depend> <run_depend>roscpp</run_depend>
<run_depend>rospy</run_depend> <run_depend>rospy</run_depend>
<run_depend>std_msgs</run_depend> <run_depend>std_msgs</run_depend>
<run_depend>audio_msg</run_depend> <run_depend>audio_msg</run_depend>
<run_depend>river</run_depend> <run_depend>audio_river</run_depend>
</package> </package>

View File

@ -12,7 +12,7 @@
#include <audio_msg/AudioBuffer.h> #include <audio_msg/AudioBuffer.h>
#include <boost/thread.hpp> #include <boost/thread.hpp>
appl::InterfaceInput::InterfaceInput(std11::shared_ptr<river::Manager> _manager, appl::InterfaceInput::InterfaceInput(std11::shared_ptr<audio::river::Manager> _manager,
const std::string& _input, const std::string& _input,
const std::string& _publisher, const std::string& _publisher,
bool _feedback) : bool _feedback) :
@ -67,7 +67,7 @@ void appl::InterfaceInput::onDisConnect(const ros::SingleSubscriberPublisher& _p
APPL_ERROR("on dis-connect ... " << _pub.getSubscriberName()); APPL_ERROR("on dis-connect ... " << _pub.getSubscriberName());
} }
void appl::InterfaceInput::onDataReceived(const void* _data, void appl::InterfaceInput::onDataReceived(const void* _data,
const std11::chrono::system_clock::time_point& _time, const audio::Time& _time,
size_t _nbChunk, size_t _nbChunk,
enum audio::format _format, enum audio::format _format,
uint32_t _frequency, uint32_t _frequency,

View File

@ -9,17 +9,17 @@
#ifndef __AUDIO_CORE_INTERFACE_INPUT_H__ #ifndef __AUDIO_CORE_INTERFACE_INPUT_H__
#define __AUDIO_CORE_INTERFACE_INPUT_H__ #define __AUDIO_CORE_INTERFACE_INPUT_H__
#include <river/Manager.h> #include <audio/river/Manager.h>
namespace appl { namespace appl {
class InterfaceInput { class InterfaceInput {
public: public:
std11::shared_ptr<river::Manager> m_manager; std11::shared_ptr<audio::river::Manager> m_manager;
std11::shared_ptr<river::Interface> m_interface; std11::shared_ptr<audio::river::Interface> m_interface;
ros::Publisher m_stream; ros::Publisher m_stream;
std11::mutex mutex; std11::mutex mutex;
public: public:
InterfaceInput(std11::shared_ptr<river::Manager> _manager, InterfaceInput(std11::shared_ptr<audio::river::Manager> _manager,
const std::string& _input="microphone", const std::string& _input="microphone",
const std::string& _publisher="microphone", const std::string& _publisher="microphone",
bool _feedback=false); bool _feedback=false);
@ -28,7 +28,7 @@ namespace appl {
void onConnect(const ros::SingleSubscriberPublisher& _pub); void onConnect(const ros::SingleSubscriberPublisher& _pub);
void onDisConnect(const ros::SingleSubscriberPublisher& _pub); void onDisConnect(const ros::SingleSubscriberPublisher& _pub);
void onDataReceived(const void* _data, void onDataReceived(const void* _data,
const std11::chrono::system_clock::time_point& _time, const audio::Time& _time,
size_t _nbChunk, size_t _nbChunk,
enum audio::format _format, enum audio::format _format,
uint32_t _frequency, uint32_t _frequency,

View File

@ -9,7 +9,7 @@
#include "debug.h" #include "debug.h"
#include "InterfaceOutputElement.h" #include "InterfaceOutputElement.h"
appl::InterfaceOutputElement::InterfaceOutputElement(const std11::shared_ptr<river::Manager>& _manager, int32_t _id) : appl::InterfaceOutputElement::InterfaceOutputElement(const std11::shared_ptr<audio::river::Manager>& _manager, int32_t _id) :
m_id(_id), m_id(_id),
m_nbConsecutiveUnderflow(0), m_nbConsecutiveUnderflow(0),
m_manager(_manager) { m_manager(_manager) {

View File

@ -9,8 +9,8 @@
#ifndef __AUDIO_CORE_INTERFACE_OUTPUT_ELEMENT_H__ #ifndef __AUDIO_CORE_INTERFACE_OUTPUT_ELEMENT_H__
#define __AUDIO_CORE_INTERFACE_OUTPUT_ELEMENT_H__ #define __AUDIO_CORE_INTERFACE_OUTPUT_ELEMENT_H__
#include <river/Manager.h> #include <audio/river/Manager.h>
#include <river/Interface.h> #include <audio/river/Interface.h>
#include <ros/ros.h> #include <ros/ros.h>
#include <audio_msg/AudioBuffer.h> #include <audio_msg/AudioBuffer.h>
@ -29,11 +29,11 @@ namespace appl {
return m_nbConsecutiveUnderflow; return m_nbConsecutiveUnderflow;
} }
private: private:
std11::shared_ptr<river::Manager> m_manager; std11::shared_ptr<audio::river::Manager> m_manager;
std11::shared_ptr<river::Interface> m_interface; std11::shared_ptr<audio::river::Interface> m_interface;
std11::mutex m_mutex; std11::mutex m_mutex;
public: public:
InterfaceOutputElement(const std11::shared_ptr<river::Manager>& _manager, int32_t _id); InterfaceOutputElement(const std11::shared_ptr<audio::river::Manager>& _manager, int32_t _id);
~InterfaceOutputElement(); ~InterfaceOutputElement();
void onTopicMessage(const std::string& _streamName, const audio_msg::AudioBuffer::ConstPtr& _msg); void onTopicMessage(const std::string& _streamName, const audio_msg::AudioBuffer::ConstPtr& _msg);
void onStatus(const std::string& _origin, const std::string& _status, int32_t _iii); void onStatus(const std::string& _origin, const std::string& _status, int32_t _iii);

View File

@ -11,7 +11,7 @@
appl::InterfaceOutputManager::InterfaceOutputManager(const std::string& _name) : appl::InterfaceOutputManager::InterfaceOutputManager(const std::string& _name) :
m_name(_name) { m_name(_name) {
m_manager = river::Manager::create(m_name); m_manager = audio::river::Manager::create(m_name);
APPL_INFO("Create Manager : " << m_name); APPL_INFO("Create Manager : " << m_name);
} }

View File

@ -22,7 +22,7 @@ namespace appl {
return m_name; return m_name;
} }
private: private:
std11::shared_ptr<river::Manager> m_manager; std11::shared_ptr<audio::river::Manager> m_manager;
std::vector<std11::shared_ptr<appl::InterfaceOutputElement> > m_elementList; std::vector<std11::shared_ptr<appl::InterfaceOutputElement> > m_elementList;
std11::mutex m_mutex; std11::mutex m_mutex;
public: public:

View File

@ -5,9 +5,9 @@
#include "audio_core/create.h" #include "audio_core/create.h"
#include "audio_core/remove.h" #include "audio_core/remove.h"
#include "audio_core/getBufferTime.h" #include "audio_core/getBufferTime.h"
#include <river/river.h> #include <audio/river/river.h>
#include <river/Interface.h> #include <audio/river/Interface.h>
#include <river/Manager.h> #include <audio/river/Manager.h>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <sstream> #include <sstream>
#include "debug.h" #include "debug.h"
@ -21,7 +21,7 @@ static std11::mutex mutex;
#include "InterfaceOutput.h" #include "InterfaceOutput.h"
std11::shared_ptr<river::Manager> g_manager; std11::shared_ptr<audio::river::Manager> g_manager;
bool f_create(audio_core::create::Request& _req, bool f_create(audio_core::create::Request& _req,
audio_core::create::Response& _res) { audio_core::create::Response& _res) {
@ -155,7 +155,7 @@ int main(int _argc, char **_argv) {
APPL_INFO("Find hardware configuration ... : '" << hardwareInterface << "'"); APPL_INFO("Find hardware configuration ... : '" << hardwareInterface << "'");
} }
} }
river::init(hardwareInterface); audio::river::init(hardwareInterface);
ros::NodeHandle n; ros::NodeHandle n;
@ -163,7 +163,7 @@ int main(int _argc, char **_argv) {
ros::ServiceServer serviceRemove = n.advertiseService("remove", f_remove); ros::ServiceServer serviceRemove = n.advertiseService("remove", f_remove);
ros::ServiceServer serviceGetBufferTime = n.advertiseService("getBufferTime", f_getBufferTime); ros::ServiceServer serviceGetBufferTime = n.advertiseService("getBufferTime", f_getBufferTime);
g_manager = river::Manager::create(n.getNamespace()); g_manager = audio::river::Manager::create(n.getNamespace());
// start publishing of Microphone // start publishing of Microphone
std11::shared_ptr<appl::InterfaceInput> m_input = std11::make_shared<appl::InterfaceInput>(g_manager, "microphone", "microphone", false); std11::shared_ptr<appl::InterfaceInput> m_input = std11::make_shared<appl::InterfaceInput>(g_manager, "microphone", "microphone", false);
// start publishing of Speaker feedback // start publishing of Speaker feedback
@ -179,7 +179,7 @@ int main(int _argc, char **_argv) {
m_input.reset(); m_input.reset();
m_feedback.reset(); m_feedback.reset();
g_manager.reset(); g_manager.reset();
river::unInit(); audio::river::unInit();
return 0; return 0;
} }

View File

@ -22,11 +22,12 @@ uint8 FORMAT_INT8_ON_INT16=2
uint8 FORMAT_INT16=3 uint8 FORMAT_INT16=3
uint8 FORMAT_INT16_ON_INT32=4 uint8 FORMAT_INT16_ON_INT32=4
uint8 FORMAT_INT24=5 uint8 FORMAT_INT24=5
uint8 FORMAT_INT32=6 uint8 FORMAT_INT24_ON_INT32=6
uint8 FORMAT_INT32_ON_INT64=7 uint8 FORMAT_INT32=7
uint8 FORMAT_INT64=8 uint8 FORMAT_INT32_ON_INT64=8
uint8 FORMAT_FLOAT=9 uint8 FORMAT_INT64=9
uint8 FORMAT_DOUBLE=10 uint8 FORMAT_FLOAT=10
uint8 FORMAT_DOUBLE=11
########## ##########
# Message: # Message: