zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit b278c204dcad03138c8cc1415b66f096ab419611
parent 8a900ef2a4e804d7df3e220113bbb3ff2582c206
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Tue,  6 May 2014 18:44:19 -0400

OSS: Add Environmental Variable Selection of DEV

The DSP_DEVICE environmental variable now overloads the user
configured preference for the OSS output file.

Diffstat:
Msrc/Nio/OssEngine.cpp | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/Nio/OssEngine.cpp b/src/Nio/OssEngine.cpp @@ -67,10 +67,14 @@ bool OssEngine::openAudio() int snd_format = AFMT_S16_LE; int snd_samplerate = synth->samplerate; - audio.handle = open(config.cfg.LinuxOSSWaveOutDev, O_WRONLY, 0); + const char *device = config.cfg.LinuxOSSWaveOutDev; + if(getenv("DSP_DEVICE")) + device = getenv("DSP_DEVICE"); + + audio.handle = open(device, O_WRONLY, 0); if(audio.handle == -1) { cerr << "ERROR - I can't open the " - << config.cfg.LinuxOSSWaveOutDev << '.' << endl; + << device << '.' << endl; return false; } ioctl(audio.handle, SNDCTL_DSP_RESET, NULL);