[DEBUG] compilation OK

This commit is contained in:
Edouard DUPIN 2015-03-12 23:17:14 +01:00
parent f9ae8f23bd
commit 57c4795a1e
12 changed files with 76 additions and 12 deletions

View File

@ -4,13 +4,14 @@
* @license APACHE v2.0 (see license file)
*/
#include "Manager.h"
#include <river/io/Manager.h>
#include <river/debug.h>
#include "Node.h"
#include "NodeAEC.h"
#include "NodeMuxer.h"
#include "NodeAirTAudio.h"
#include "NodePortAudio.h"
#include <river/river.h>
#include <river/io/Node.h>
#include <river/io/NodeAEC.h>
#include <river/io/NodeMuxer.h>
#include <river/io/NodeAirTAudio.h>
#include <river/io/NodePortAudio.h>
#include <etk/os/FSNode.h>
#include <etk/memory.h>
#include <etk/types.h>
@ -65,7 +66,7 @@ river::io::Manager::Manager() {
#endif
}
void river::io::Manager::init(const std::string _filename) {
void river::io::Manager::init(const std::string& _filename) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
if (_filename == "") {
RIVER_INFO("Load default config");
@ -74,9 +75,15 @@ void river::io::Manager::init(const std::string _filename) {
RIVER_ERROR("you must set a basic configuration file for harware configuration: '" << _filename << "'");
}
}
void river::io::Manager::initString(const std::string& _data) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
m_config.parse(_data);
}
void river::io::Manager::unInit() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
// TODO : ...
}
river::io::Manager::~Manager() {

View File

@ -39,7 +39,8 @@ namespace river {
* @brief Destructor
*/
~Manager();
void init();
void init(const std::string& _filename);
void initString(const std::string& _data);
void unInit();
private:
ejson::Document m_config; // harware configuration

View File

@ -4,8 +4,8 @@
* @license APACHE v2.0 (see license file)
*/
#iclude <river/river.h>
#iclude <river/debug.h>
#include <river/river.h>
#include <river/debug.h>
#include <river/io/Manager.h>
static bool river_isInit = false;
@ -20,6 +20,20 @@ void river::init(const std::string& _filename) {
RIVER_INFO("init RIVER :" << river_configFile);
std11::shared_ptr<river::io::Manager> mng = river::io::Manager::getInstance();
mng->init(river_configFile);
} else {
RIVER_ERROR("River is already init not use : " << _filename);
}
}
void river::initString(const std::string& _config) {
if (river_isInit == false) {
river_isInit = true;
river_configFile = _config;
RIVER_INFO("init RIVER with config ...");
std11::shared_ptr<river::io::Manager> mng = river::io::Manager::getInstance();
mng->initString(river_configFile);
} else {
RIVER_ERROR("River is already init not use Data ...");
}
}

View File

@ -7,7 +7,7 @@
#ifndef __RIVER_H__
#define __RIVER_H__
#include <etk/type.h>
#include <etk/types.h>
namespace river {
/**
@ -15,6 +15,11 @@ namespace river {
* @param[in] _filename Name of the configuration file (if "" ==> default config file)
*/
void init(const std::string& _filename);
/**
* @brief Initialize the River Library with a json data string
* @param[in] _config json sting data
*/
void initString(const std::string& _config);
/**
* @brief Un-initialize the River Library
* @note this close all stream of all interfaces.

View File

@ -5,6 +5,7 @@
*/
#include "debug.h"
#include <river/river.h>
#include <river/Manager.h>
#include <river/Interface.h>
#include <gtest/gtest.h>

View File

@ -363,13 +363,17 @@ namespace river_test_echo_delay {
}
};
static const std::string configurationRiver = "";
TEST(TestTime, testDelay) {
river::initString(configurationRiver);
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
std11::shared_ptr<TestClass> process = std11::make_shared<TestClass>(manager);
process->run();
process.reset();
usleep(500000);
river::unInit();
}
};

View File

@ -128,15 +128,18 @@ namespace river_test_format {
}
};
static const std::string configurationRiver = "";
class testResampling : public ::testing::TestWithParam<float> {};
TEST_P(testResampling, base) {
river::initString(configurationRiver);
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
std11::shared_ptr<testOutCallbackType> process = std11::make_shared<testOutCallbackType>(manager, GetParam(), 2, audio::format_int16);
process->run();
process.reset();
usleep(500000);
river::unInit();
}
INSTANTIATE_TEST_CASE_P(InstantiationName,
@ -146,12 +149,14 @@ namespace river_test_format {
class testFormat : public ::testing::TestWithParam<audio::format> {};
TEST_P(testFormat, base) {
river::initString(configurationRiver);
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
std11::shared_ptr<testOutCallbackType> process = std11::make_shared<testOutCallbackType>(manager, 48000, 2, GetParam());
process->run();
process.reset();
usleep(500000);
river::unInit();
}
INSTANTIATE_TEST_CASE_P(InstantiationName,
testFormat,
@ -160,12 +165,14 @@ namespace river_test_format {
class testChannels : public ::testing::TestWithParam<int32_t> {};
TEST_P(testChannels, base) {
river::initString(configurationRiver);
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
std11::shared_ptr<testOutCallbackType> process = std11::make_shared<testOutCallbackType>(manager, 48000, GetParam(), audio::format_int16);
process->run();
process.reset();
usleep(500000);
river::unInit();
}
INSTANTIATE_TEST_CASE_P(InstantiationName,
testChannels,
@ -173,6 +180,7 @@ namespace river_test_format {
TEST(TestALL, testChannelsFormatResampling) {
river::initString(configurationRiver);
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
APPL_INFO("test convert flaot to output (callback mode)");
@ -209,6 +217,7 @@ namespace river_test_format {
}
}
}
river::unInit();
}

View File

@ -100,13 +100,17 @@ namespace river_test_muxer {
}
};
static const std::string configurationRiver = "";
TEST(TestMuxer, testMuxing) {
river::initString(configurationRiver);
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
std11::shared_ptr<TestClass> process = std11::make_shared<TestClass>(manager);
process->run();
process.reset();
usleep(500000);
river::unInit();
}
};

View File

@ -69,7 +69,10 @@ namespace river_test_playback_callback {
}
};
static const std::string configurationRiver = "";
TEST(TestALL, testOutputCallBack) {
river::initString(configurationRiver);
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
@ -78,9 +81,11 @@ namespace river_test_playback_callback {
process->run();
process.reset();
usleep(500000);
river::unInit();
}
TEST(TestALL, testOutputCallBackPulse) {
river::initString(configurationRiver);
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
@ -89,9 +94,11 @@ namespace river_test_playback_callback {
process->run();
process.reset();
usleep(500000);
river::unInit();
}
TEST(TestALL, testOutputCallBackJack) {
river::initString(configurationRiver);
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
@ -100,6 +107,7 @@ namespace river_test_playback_callback {
process->run();
process.reset();
usleep(500000);
river::unInit();
}

View File

@ -11,6 +11,8 @@
#define __class__ "test_playback_write"
namespace river_test_playback_write {
static const std::string configurationRiver = "";
class testOutWrite {
private:
std::vector<audio::channel> m_channelMap;
@ -67,6 +69,7 @@ namespace river_test_playback_write {
};
TEST(TestALL, testOutputWrite) {
river::initString(configurationRiver);
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
@ -75,6 +78,7 @@ namespace river_test_playback_write {
process->run();
process.reset();
usleep(500000);
river::unInit();
}
class testOutWriteCallback {

View File

@ -13,6 +13,8 @@
#define __class__ "test_record_callback"
namespace river_test_record_callback {
static const std::string configurationRiver = "";
class testInCallback {
private:
std11::shared_ptr<river::Manager> m_manager;
@ -64,6 +66,7 @@ namespace river_test_record_callback {
};
TEST(TestALL, testInputCallBack) {
river::initString(configurationRiver);
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
APPL_INFO("test input (callback mode)");
@ -71,6 +74,7 @@ namespace river_test_record_callback {
process->run();
process.reset();
usleep(500000);
river::unInit();
}
};

View File

@ -11,6 +11,7 @@
#define __class__ "test_volume"
namespace river_test_volume {
static const std::string configurationRiver = "";
class testCallbackVolume {
private:
@ -101,12 +102,14 @@ namespace river_test_volume {
};
TEST(TestALL, testVolume) {
river::initString(configurationRiver);
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
std11::shared_ptr<testCallbackVolume> process = std11::make_shared<testCallbackVolume>(manager);
process->run();
process.reset();
usleep(500000);
river::unInit();
}
};