diff --git a/audio/river/io/Manager.cpp b/audio/river/io/Manager.cpp index d0fb543..b2b9092 100644 --- a/audio/river/io/Manager.cpp +++ b/audio/river/io/Manager.cpp @@ -55,6 +55,7 @@ static std::string basicAutoConfig = "}\n"; +static std::string pathToTheRiverConfigInHome("HOME:.local/share/audio-river/config.json"); audio::river::io::Manager::Manager() { #ifdef AUDIO_RIVER_BUILD_PORTAUDIO @@ -66,10 +67,15 @@ audio::river::io::Manager::Manager() { } void audio::river::io::Manager::init(const std::string& _filename) { + RIVER_ERROR("kjqsdhfkjqshdfkjqhsdskjdfhfkqjshqhskdjfhqsdfqsdqsdfqsdqsdfqsdfqsdfqsdfqsdfqsd"); std::unique_lock lock(m_mutex); if (_filename == "") { - RIVER_INFO("Load default config"); - m_config.parse(basicAutoConfig); + if (m_config.load(pathToTheRiverConfigInHome) == false) { + RIVER_INFO("Load default config"); + m_config.parse(basicAutoConfig); + } else { + RIVER_INFO("Load default user configuration: " << pathToTheRiverConfigInHome); + } } else if (m_config.load(_filename) == false) { RIVER_ERROR("you must set a basic configuration file for harware configuration: '" << _filename << "'"); } diff --git a/doc/configFile.md b/doc/configFile.md index 1b97bf1..d80df87 100644 --- a/doc/configFile.md +++ b/doc/configFile.md @@ -74,4 +74,46 @@ In every interface we need to define some Element: - "nb-chunk": Number of chunk to open the stream. +Generic configuration file use +============================== + +You can specify a generic configuration file foir a user in the path ```~/.local/share/audio-river/config.json``` + +The default config file is: + +```{.json} +{ + microphone:{ + io:"input", + map-on:{ + interface:"auto", + name:"default", + }, + frequency:0, + channel-map:[ + "front-left", "front-right" + ], + type:"auto", + nb-chunk:1024, + mux-demux-type:"float" + }, + speaker:{ + io:"output", + map-on:{ + interface:"alsa", + name:"default", + }, + frequency:0, + channel-map:[ + "front-left", "front-right", + ], + type:"auto", + nb-chunk:1024, + volume-name:"MASTER", + mux-demux-type:"float" + } +} +``` + +If the pplication start with no name it try to load this file and if it fail it load the internalversion of a basic file diff --git a/sample/write/write.cpp b/sample/write/write.cpp index 0db983e..883c967 100644 --- a/sample/write/write.cpp +++ b/sample/write/write.cpp @@ -20,7 +20,7 @@ static const std::string configurationRiver = " io:'output',\n" " map-on:{\n" " interface:'alsa',\n" - " name:'hw:0,0',\n" + " name:'hw:0,3',\n" " },\n" " frequency:48000,\n" //" channel-map:['front-left', 'front-right', 'rear-left', 'rear-right'],\n"