Skip to content
This repository has been archived by the owner on Dec 22, 2024. It is now read-only.

Add Environment Variable #45

Open
tomoyanonymous opened this issue Feb 11, 2021 · 0 comments
Open

Add Environment Variable #45

tomoyanonymous opened this issue Feb 11, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@tomoyanonymous
Copy link
Contributor

Add environment variable for getting execution-engine/audio-driver/commandline-option specific value, e.g. sample-rate.

For an example of sample-rate, the audio driver is launched after the global context is evaluated because if no dsp function and @ operator are used, no need to launch the audio driver. However, the sample-rate will be typically acquired in the global context. Thus the sample-rate should be treated as a runtime-defined value somehow.

The proposed solution is as follows.

  • Each runtime and the audio driver must implement an interface method to register environment variables, which is called before mimium's global context is evaluated.
  • runtime can take optional environment variables from the constructor's argument.
  • environment variables will be a pair of string and float to keep the simplicity of implementation for now.
  • To get a specific environment variable, use special function getEnv("hoge") is used.

More extended features will be...

  • Introduce a syntax sugar like #SAMPLERATE instead of getEnv("SAMPLERATE").
  • User can specify a requirement of the environment variables. If no sample rate is specified when a file backend is used, there will be no default value. This may cause unsafe behavior such as division by zero. Sometimes it is useful that backends can provide default values but sometimes it is useful that raising an error when specified values are not present in the environment-variables table.

For example, #SAMPLERATE or getEnv("SAMPLERATE") returns zero, on the other hand, !#SAMPLERATE or getEnvRequired("SAMPLERATE") raise error if no Environment Variable "SAMPLERATE" is provided.

@tomoyanonymous tomoyanonymous added the enhancement New feature or request label Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant