audio-river/audio/river/river.cpp

60 lines
1.5 KiB
C++
Raw Normal View History

2015-03-12 22:28:15 +01:00
/** @file
* @author Edouard DUPIN
* @copyright 2015, Edouard DUPIN, all right reserved
* @license APACHE v2.0 (see license file)
*/
2015-04-11 09:38:30 +02:00
#include <audio/river/river.h>
#include <audio/river/debug.h>
#include <audio/river/io/Manager.h>
2015-03-12 22:28:15 +01:00
static bool river_isInit = false;
static std::string river_configFile = "";
2015-04-11 09:38:30 +02:00
void audio::river::init(const std::string& _filename) {
2015-03-12 22:28:15 +01:00
if (river_isInit == false) {
river_isInit = true;
river_configFile = _filename;
2015-03-13 23:22:17 +01:00
RIVER_DEBUG("init RIVER :" << river_configFile);
2015-04-11 09:38:30 +02:00
std11::shared_ptr<audio::river::io::Manager> mng = audio::river::io::Manager::getInstance();
2015-03-20 21:45:30 +01:00
if (mng != nullptr) {
mng->init(river_configFile);
}
2015-03-12 23:17:14 +01:00
} else {
RIVER_ERROR("River is already init not use : " << _filename);
}
}
2015-04-11 09:38:30 +02:00
void audio::river::initString(const std::string& _config) {
2015-03-12 23:17:14 +01:00
if (river_isInit == false) {
river_isInit = true;
river_configFile = _config;
2015-03-13 23:22:17 +01:00
RIVER_DEBUG("init RIVER with config.");
2015-04-11 09:38:30 +02:00
std11::shared_ptr<audio::river::io::Manager> mng = audio::river::io::Manager::getInstance();
2015-03-20 21:45:30 +01:00
if (mng != nullptr) {
mng->initString(river_configFile);
}
2015-03-12 23:17:14 +01:00
} else {
RIVER_ERROR("River is already init not use Data ...");
2015-03-12 22:28:15 +01:00
}
}
2015-04-11 09:38:30 +02:00
void audio::river::unInit() {
2015-03-12 22:28:15 +01:00
if (river_isInit == true) {
river_isInit = false;
2015-03-13 23:22:17 +01:00
RIVER_DEBUG("un-init RIVER.");
2015-04-11 09:38:30 +02:00
std11::shared_ptr<audio::river::io::Manager> mng = audio::river::io::Manager::getInstance();
2015-03-20 21:45:30 +01:00
if (mng != nullptr) {
RIVER_ERROR("Can not get on the RIVER hardware manager !!!");
mng->unInit();
}
2015-03-12 22:28:15 +01:00
}
}
2015-04-11 09:38:30 +02:00
bool audio::river::isInit() {
2015-03-12 22:28:15 +01:00
return river_isInit;
}