95 lines
2.4 KiB
C
Raw Normal View History

2015-01-25 22:17:06 +01:00
/** @file
* @author Edouard DUPIN
* @copyright 2015, Edouard DUPIN, all right reserved
* @license APACHE v2.0 (see license file)
*/
#ifndef __AIRTIO_IO_NODE_H__
#define __AIRTIO_IO_NODE_H__
#include <string>
#include <vector>
#include <list>
#include <stdint.h>
#include <chrono>
#include <functional>
#include <airtalgo/format.h>
#include <airtalgo/channel.h>
2015-01-26 22:04:29 +01:00
#include "Manager.h"
2015-01-25 22:17:06 +01:00
#include <memory>
#include <airtio/Interface.h>
2015-01-26 22:04:29 +01:00
#include <airtaudio/Interface.h>
2015-02-02 22:04:11 +01:00
#include <airtalgo/IOFormatInterface.h>
#include <airtalgo/Volume.h>
2015-01-25 22:17:06 +01:00
namespace airtio {
namespace io {
class Manager;
class Node {
private:
mutable std::mutex m_mutex;
std::shared_ptr<const ejson::Object> m_config;
std::shared_ptr<airtalgo::VolumeElement> m_volume; //!< if a volume is set it is set here ...
2015-01-25 22:17:06 +01:00
private:
/**
* @brief Constructor
*/
Node(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config);
2015-01-25 22:17:06 +01:00
public:
static std::shared_ptr<Node> create(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config);
2015-01-25 22:17:06 +01:00
/**
* @brief Destructor
*/
virtual ~Node();
private:
std::vector<std::shared_ptr<airtio::Interface> > m_list;
public:
void interfaceAdd(const std::shared_ptr<airtio::Interface>& _interface);
void interfaceRemove(const std::shared_ptr<airtio::Interface>& _interface);
private:
2015-01-26 22:04:29 +01:00
airtaudio::Interface m_adac; //!< Real audio interface
airtaudio::DeviceInfo m_info;
2015-01-25 22:17:06 +01:00
unsigned int m_rtaudioFrameSize;
public:
2015-01-27 21:01:52 +01:00
int32_t rtAudioCallback(void* _outputBuffer,
void * _inputBuffer,
unsigned int _nBufferFrames,
double _streamTime,
airtaudio::streamStatus _status);
2015-01-25 22:17:06 +01:00
private:
std::string m_name;
2015-01-25 22:17:06 +01:00
public:
const std::string& getName() {
return m_name;
2015-01-25 22:17:06 +01:00
}
private:
2015-02-02 22:04:11 +01:00
airtalgo::IOFormatInterface m_interfaceFormat;
2015-01-25 22:17:06 +01:00
public:
2015-02-02 22:04:11 +01:00
const airtalgo::IOFormatInterface& getInterfaceFormat() {
return m_interfaceFormat;
2015-01-25 22:17:06 +01:00
}
private:
2015-02-02 22:04:11 +01:00
airtalgo::IOFormatInterface m_hardwareFormat;
2015-01-25 22:17:06 +01:00
private:
bool m_isInput;
public:
bool isInput() {
return m_isInput;
}
bool isOutput() {
return !m_isInput;
}
private:
void start();
void stop();
public:
const std::shared_ptr<airtalgo::VolumeElement>& getVolume() {
return m_volume;
}
2015-01-25 22:17:06 +01:00
};
}
}
#endif