I would like to have the equivalent of
#if (expression with $EnvVar)
# Some cfg statements
#else
# some more cfg statement
#end
or something equivalent.
I would like to be able to make a single cfg file that would work for Alsa and Jack
In particular I want to be able to run the example codes on my Mac as well as on my BeagleBone Black Portable Hearing Laboratory and select the environment with environment variable and have a single source example file.
Is there already a method to do this?
Conditionals in Configuration
-
- Posts: 119
- Joined: Mon Jun 24, 2019 12:51 pm
Re: Conditionals in Configuration
The MHA configuration language does not support conditionals. I do not think it is possible to achieve what you want while restricting yourself to a single configuration file.
If you would allow splitting your configuration into multiple files, then it would be possible to have
If you would allow splitting your configuration into multiple files, then it would be possible to have
Code: Select all
# main.cfg: Main cfg file
# fragsize, srate and nchannels_in need to be set before loading IO library
fragsize = ...
srate = ...
nchannels_in = ...
# Load system-specific IO library, config file name is stored in environment variable
?read:${EnvVar}
# MHA configuration common to both systems
...
Code: Select all
# ioMac.cfg: configuration file loading IO library on Mac
iolib = MHAIOJackdb
io.con_in = ...
...
Code: Select all
# ioPHL.cfg: configuration file loading IO library on PHL
iolib = MHAIOalsa
io.in.device = ...
...
Re: Conditionals in Configuration
Yes!
I think that this would work.
I would like to update the examples to run on PHL as well as other devices.
I think this approach is workable.
Thanks.
I think that this would work.
I would like to update the examples to run on PHL as well as other devices.
I think this approach is workable.
Thanks.