diff options
author | Ken Moore <ken@ixsystems.com> | 2017-04-19 09:17:20 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-04-19 09:17:20 -0400 |
commit | 3c077da3151397ea371cdf9e26a5826c7824366e (patch) | |
tree | 1e47cf7c1aecec279b54682f7b0e8fca02160926 /src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp | |
parent | Fix up the icons used for the battery notifications. (diff) | |
download | lumina-3c077da3151397ea371cdf9e26a5826c7824366e.tar.gz lumina-3c077da3151397ea371cdf9e26a5826c7824366e.tar.bz2 lumina-3c077da3151397ea371cdf9e26a5826c7824366e.zip |
Add the ability to change the libao audio driver as needed.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp')
-rw-r--r-- | src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp b/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp index 6799f25b..63d2987b 100644 --- a/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp +++ b/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp @@ -116,6 +116,38 @@ void PianoBarProcess::setControlProxy(QString url){ setSettingValue("control_proxy", url); } +QString PianoBarProcess::currentAudioDriver(){ + QString driver = "auto"; + QStringList info = LUtils::readFile(QDir::homePath()+"/.libao").filter("default_driver"); + if(!info.isEmpty()){ + driver = info.last().section("=",-1).simplified(); + } + return driver; +} + +QStringList PianoBarProcess::availableAudioDrivers(){ + QStringList known; + known << "pulse" << "alsa" << "sndio" << "oss" << "sun" << "roar" << "esd" << "nas"; + known.sort(); + known.prepend("auto"); //make sure this is always first + return known; +} + +void PianoBarProcess::setAudioDriver(QString driver){ + QStringList info = LUtils::readFile(QDir::homePath()+"/.libao"); + bool found = false; + QString line = "default_driver="+driver; + if(driver=="auto"){ line.clear(); } //special bypass - nothing set + for(int i=0; i<info.length() && !found; i++){ + if(info[i].section("=",0,0).simplified() == "default_driver"){ + info[i] = line; + found = true; + } + } + if(!found && !line.isEmpty()){ info << line; } + //Now save the file + LUtils::writeFile(QDir::homePath()+"/.libao", info, true); +} // ====== PUBLIC SLOTS ====== void PianoBarProcess::play(){ if(PROC->state() == QProcess::NotRunning){ |