[DEV] a a default user config file

This commit is contained in:
Edouard DUPIN 2017-04-26 22:09:23 +00:00
parent ddc9150179
commit c3b5ba2bdd
3 changed files with 51 additions and 3 deletions

View File

@ -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<std::recursive_mutex> 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 << "'");
}

View File

@ -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

View File

@ -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"