[DEV] add dependency of audio base format

This commit is contained in:
2015-02-04 22:39:05 +01:00
parent fb500717f8
commit e0e9b1670d
9 changed files with 107 additions and 107 deletions

View File

@@ -20,7 +20,7 @@ airtio::Interface::Interface(void) :
m_node(nullptr),
m_freq(8000),
m_map(),
m_format(airtalgo::format_int16),
m_format(audio::format_int16),
m_name(""),
m_volume(0.0f) {
@@ -28,8 +28,8 @@ airtio::Interface::Interface(void) :
bool airtio::Interface::init(const std::string& _name,
float _freq,
const std::vector<airtalgo::channel>& _map,
airtalgo::format _format,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::shared_ptr<airtio::io::Node>& _node) {
m_name = _name;
m_node = _node;
@@ -71,8 +71,8 @@ bool airtio::Interface::init(const std::string& _name,
std::shared_ptr<airtio::Interface> airtio::Interface::create(const std::string& _name,
float _freq,
const std::vector<airtalgo::channel>& _map,
airtalgo::format _format,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::shared_ptr<airtio::io::Node>& _node) {
std::shared_ptr<airtio::Interface> out = std::shared_ptr<airtio::Interface>(new airtio::Interface());
out->init(_name, _freq, _map, _format, _node);

View File

@@ -13,8 +13,8 @@
#include <chrono>
#include <functional>
#include <mutex>
#include <airtalgo/format.h>
#include <airtalgo/channel.h>
#include <audio/format.h>
#include <audio/channel.h>
#include <airtalgo/Process.h>
#include <airtalgo/EndPointCallback.h>
#include <airtalgo/EndPointWrite.h>
@@ -32,8 +32,8 @@ namespace airtio {
protected:
std::shared_ptr<airtio::io::Node> m_node;
float m_freq;
std::vector<airtalgo::channel> m_map;
airtalgo::format m_format;
std::vector<audio::channel> m_map;
audio::format m_format;
std::shared_ptr<airtalgo::Process> m_process;
protected:
std::string m_name;
@@ -48,8 +48,8 @@ namespace airtio {
Interface();
bool init(const std::string& _name,
float _freq,
const std::vector<airtalgo::channel>& _map,
airtalgo::format _format,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::shared_ptr<airtio::io::Node>& _node);
public:
/**
@@ -58,8 +58,8 @@ namespace airtio {
virtual ~Interface();
static std::shared_ptr<Interface> create(const std::string& _name,
float _freq,
const std::vector<airtalgo::channel>& _map,
airtalgo::format _format,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::shared_ptr<airtio::io::Node>& _node);
/**
* @brief set the read/write mode enable.

View File

@@ -57,8 +57,8 @@ std::pair<float,float> airtio::Manager::getVolumeRange(const std::string& _volum
}
std::shared_ptr<airtio::Interface> airtio::Manager::createOutput(float _freq,
const std::vector<airtalgo::channel>& _map,
airtalgo::format _format,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::string& _streamName,
const std::string& _name) {
// get global hardware interface:
@@ -74,8 +74,8 @@ std::shared_ptr<airtio::Interface> airtio::Manager::createOutput(float _freq,
}
std::shared_ptr<airtio::Interface> airtio::Manager::createInput(float _freq,
const std::vector<airtalgo::channel>& _map,
airtalgo::format _format,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::string& _streamName,
const std::string& _name) {
// get global hardware interface:

View File

@@ -11,8 +11,8 @@
#include <stdint.h>
#include <memory>
#include <airtio/Interface.h>
#include <airtalgo/format.h>
#include <airtalgo/channel.h>
#include <audio/format.h>
#include <audio/channel.h>
namespace airtio {
/**
@@ -79,8 +79,8 @@ namespace airtio {
* @return a pointer on the interface
*/
virtual std::shared_ptr<Interface> createOutput(float _freq,
const std::vector<airtalgo::channel>& _map,
airtalgo::format _format,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::string& _streamName = "",
const std::string& _name = "");
/**
@@ -93,8 +93,8 @@ namespace airtio {
* @return a pointer on the interface
*/
virtual std::shared_ptr<Interface> createInput(float _freq,
const std::vector<airtalgo::channel>& _map,
airtalgo::format _format,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::string& _streamName = "",
const std::string& _name = "");
};

View File

@@ -65,10 +65,14 @@ std::shared_ptr<airtalgo::VolumeElement> airtio::io::Manager::getVolumeGroup(con
bool airtio::io::Manager::setVolume(const std::string& _volumeName, float _valuedB) {
std::shared_ptr<airtalgo::VolumeElement> volume = getVolumeGroup(_volumeName);
if (volume == nullptr) {
AIRTIO_ERROR("Can not get volume ... : '" << _volumeName << "'");
AIRTIO_ERROR("Can not set volume ... : '" << _volumeName << "'");
return false;
}
if ( _valuedB < -300
|| _valuedB > 300) {
AIRTIO_ERROR("Can not set volume ... : '" << _volumeName << "' out of range : [-300..300]");
return false;
}
// TODO : Check range ...
volume->setVolume(_valuedB);
for (auto &it2 : m_list) {
std::shared_ptr<airtio::io::Node> val = it2.lock();

View File

@@ -13,8 +13,8 @@
#include <stdint.h>
#include <chrono>
#include <functional>
#include <airtalgo/format.h>
#include <airtalgo/channel.h>
#include <audio/format.h>
#include <audio/channel.h>
#include <ejson/ejson.h>
#include <memory>
#include <airtalgo/Volume.h>

View File

@@ -150,9 +150,9 @@ airtio::io::Node::Node(const std::string& _name, const std::shared_ptr<const ejs
m_volume = airtio::io::Manager::getInstance()->getVolumeGroup(volumeName);
}
enum airtalgo::format formatType = airtalgo::format_int16;
enum audio::format formatType = audio::format_int16;
if (type == "int16") {
formatType = airtalgo::format_int16;
formatType = audio::format_int16;
} else {
AIRTIO_WARNING("not managed type : '" << type << "'");
}
@@ -165,19 +165,19 @@ airtio::io::Node::Node(const std::string& _name, const std::shared_ptr<const ejs
if (streamName == "") {
streamName = "default";
}
std::vector<airtalgo::channel> map;
std::vector<audio::channel> map;
// set default channel property :
map.push_back(airtalgo::channel_frontLeft);
map.push_back(airtalgo::channel_frontRight);
map.push_back(audio::channel_frontLeft);
map.push_back(audio::channel_frontRight);
m_hardwareFormat.set(map, formatType, frequency);
// TODO : Better view of interface type float -> float, int16 -> int16/int32, ...
if (m_isInput == true) {
// for input we just transfert audio with no transformation
m_interfaceFormat.set(map, airtalgo::format_int16, frequency);
m_interfaceFormat.set(map, audio::format_int16, frequency);
} else {
// for output we will do a mix ...
m_interfaceFormat.set(map, airtalgo::format_int16_on_int32, frequency);
m_interfaceFormat.set(map, audio::format_int16_on_int32, frequency);
}
// search device ID :

View File

@@ -13,8 +13,8 @@
#include <stdint.h>
#include <chrono>
#include <functional>
#include <airtalgo/format.h>
#include <airtalgo/channel.h>
#include <audio/format.h>
#include <audio/channel.h>
#include "Manager.h"
#include <memory>
#include <airtio/Interface.h>
@@ -59,7 +59,7 @@ namespace airtio {
double _streamTime,
airtaudio::streamStatus _status);
private:
std::string m_name;
std::string m_name; //!< Harware.json configuration name
public:
const std::string& getName() {
return m_name;