2
* kmixctrl - kmix volume save/restore utility
4
* Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de>
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Library General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Library General Public License for more details.
16
* You should have received a copy of the GNU Library General Public
17
* License along with this program; if not, write to the Free
18
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
#include <kcmdlineargs.h>
23
#include <kaboutdata.h>
34
static const char *description =
35
I18N_NOOP("kmixctrl - kmix volume save/restore utility");
37
static KCmdLineOptions options[] =
40
{ "save", I18N_NOOP("Save current volumes as default"), 0 },
42
{ "restore", I18N_NOOP("Restore default volumes"), 0 },
44
// INSERT YOUR COMMANDLINE OPTIONS HERE
47
int main(int argc, char *argv[])
49
KLocale::setMainCatalogue("kmix");
50
KAboutData aboutData( "kmixctrl", I18N_NOOP("KMixCtrl"),
51
APP_VERSION, description, KAboutData::License_GPL,
52
"(c) 2000 by Stefan Schimanski");
54
aboutData.addAuthor("Stefan Schimanski", 0, "1Stein@gmx.de");
56
KCmdLineArgs::init( argc, argv, &aboutData );
57
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
58
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
62
KConfig *config= new KConfig("kcmkmixrc", false);
63
config->setGroup("Misc");
64
int maxCards = config->readNumEntry( "maxCards", 2 );
65
int maxDevices = config->readNumEntry( "maxDevices", 2 );
70
int drvNum = Mixer::getDriverNum();
71
for( int drv=0; drv<drvNum && mixers.count()==0; drv++ )
72
for ( int dev=0; dev<maxDevices; dev++ )
73
for ( int card=0; card<maxCards; card++ ) {
75
Mixer *mixer = Mixer::getMixer( drv, dev, card );
76
int mixerError = mixer->grab();
80
mixers.append( mixer );
84
if ( args->isSet("restore") )
86
for (Mixer *mixer=mixers.first(); mixer!=0; mixer=mixers.next())
87
mixer->volumeLoad( KGlobal::config() );
91
if ( args->isSet("save") )
93
for (Mixer *mixer=mixers.first(); mixer!=0; mixer=mixers.next())
94
mixer->volumeSave( KGlobal::config() );