diff --git a/river/Manager.cpp b/river/Manager.cpp index d98d845..05f05fe 100644 --- a/river/Manager.cpp +++ b/river/Manager.cpp @@ -16,6 +16,23 @@ #undef __class__ #define __class__ "Manager" +static std::string basicAutoConfig = + "{\n" + " microphone:{\n" + " io:'input',\n" + " map-on:'microphone',\n" + " resampling-type:'speexdsp',\n" + " resampling-option:'quality=10'\n" + " },\n" + " speaker:{\n" + " io:'output',\n" + " map-on:'speaker',\n" + " resampling-type:'speexdsp',\n" + " resampling-option:'quality=10'\n" + " }\n" + "}\n"; + + std::shared_ptr river::Manager::create(const std::string& _applicationUniqueId) { return std::shared_ptr(new river::Manager(_applicationUniqueId)); } @@ -25,7 +42,8 @@ river::Manager::Manager(const std::string& _applicationUniqueId) : m_listOpenInterface() { // TODO : Maybe create a single interface property (and all get the same ...) if (m_config.load("DATA:virtual.json") == false) { - RIVER_ERROR("you must set a basic configuration file for virtual configuration: DATA:virtual.json"); + RIVER_WARNING("you must set a basic configuration file for virtual configuration: DATA:virtual.json (load default interface)"); + m_config.parse(basicAutoConfig); } } diff --git a/river/io/Manager.cpp b/river/io/Manager.cpp index ade73f7..1cea7e6 100644 --- a/river/io/Manager.cpp +++ b/river/io/Manager.cpp @@ -12,9 +12,44 @@ #undef __class__ #define __class__ "io::Manager" + +static std::string basicAutoConfig = + "{\n" + " microphone:{\n" + " io:'input',\n" + " map-on:{\n" + " interface:'auto',\n" + " name:'default',\n" + " },\n" + " frequency:0,\n" + " channel-map:[\n" + " 'front-left', 'front-right'\n" + " ],\n" + " type:'auto',\n" + " nb-chunk:1024\n" + " },\n" + " speaker:{\n" + " io:'output',\n" + " map-on:{\n" + " interface:'auto',\n" + " name:'default',\n" + " },\n" + " frequency:0,\n" + " channel-map:[\n" + " 'front-left', 'front-right',\n" + " ],\n" + " type:'auto',\n" + " nb-chunk:1024,\n" + " volume-name:'MASTER'\n" + " }\n" + "}\n"; + + + river::io::Manager::Manager() { if (m_config.load("DATA:hardware.json") == false) { - RIVER_ERROR("you must set a basic configuration file for harware configuration: DATA:hardware.json"); + RIVER_WARNING("you must set a basic configuration file for harware configuration: DATA:hardware.json (load default interface)"); + m_config.parse(basicAutoConfig); } // TODO : Load virtual.json and check if all is correct ... }; diff --git a/river/io/Node.cpp b/river/io/Node.cpp index 3a42e82..7d657d3 100644 --- a/river/io/Node.cpp +++ b/river/io/Node.cpp @@ -150,13 +150,13 @@ river::io::Node::Node(const std::string& _name, const std::shared_ptr tmpObject = m_config->getObject("map-on"); if (tmpObject == nullptr) { - RIVER_WARNING("missing node : 'map-on' ==> auto map : 'alsa:default'"); + RIVER_WARNING("missing node : 'map-on' ==> auto map : 'auto:default'"); } else { std::string value = tmpObject->getStringValue("interface", "default"); typeInterface = airtaudio::getTypeFromString(value); streamName = tmpObject->getStringValue("name", "default"); } - int32_t frequency = m_config->getNumberValue("frequency", 48000); + int32_t frequency = m_config->getNumberValue("frequency", 1); std::string type = m_config->getStringValue("type", "int16"); int32_t nbChunk = m_config->getNumberValue("nb-chunk", 1024); std::string volumeName = m_config->getStringValue("volume-name", ""); @@ -222,13 +222,57 @@ river::io::Node::Node(const std::string& _name, const std::shared_ptr