aboutsummaryrefslogtreecommitdiff
path: root/base/commandLine.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2011-11-23 17:01:04 +0100
committerJohannes Schickel2011-11-23 17:01:04 +0100
commitdebd94fbaa69121e4bf9720dfe354eff2bbf7081 (patch)
tree21308e7586da7defb2509f2ef18c1d922a4ba888 /base/commandLine.cpp
parent658fe0aa106603a662cbb6ccd382e5a89ecf1142 (diff)
downloadscummvm-rg350-debd94fbaa69121e4bf9720dfe354eff2bbf7081.tar.gz
scummvm-rg350-debd94fbaa69121e4bf9720dfe354eff2bbf7081.tar.bz2
scummvm-rg350-debd94fbaa69121e4bf9720dfe354eff2bbf7081.zip
BASE: Implement a command to list all available audio devices on the shell.
Diffstat (limited to 'base/commandLine.cpp')
-rw-r--r--base/commandLine.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 6550f60670..c3059ced2f 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -39,6 +39,8 @@
#include "gui/ThemeEngine.h"
+#include "audio/musicplugin.h"
+
#define DETECTOR_TESTING_HACK
#define UPGRADE_ALL_TARGETS_HACK
@@ -81,6 +83,7 @@ static const char HELP_STRING[] =
" --themepath=PATH Path to where GUI themes are stored\n"
" --list-themes Display list of all usable GUI themes\n"
" -e, --music-driver=MODE Select music driver (see README for details)\n"
+ " --list-audio-devices List all available audio devices\n"
" -q, --language=LANG Select language (en,de,fr,it,pt,es,jp,zh,kr,se,gb,\n"
" hb,ru,cz)\n"
" -m, --music-volume=NUM Set the music volume, 0-255 (default: 192)\n"
@@ -381,6 +384,9 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
DO_OPTION('e', "music-driver")
END_OPTION
+ DO_LONG_COMMAND("list-audio-devices")
+ END_OPTION
+
DO_LONG_OPTION_INT("output-rate")
END_OPTION
@@ -689,6 +695,21 @@ static void listThemes() {
printf("%-14s %s\n", i->id.c_str(), i->name.c_str());
}
+/** Lists all output devices */
+static void listAudioDevices() {
+ MusicPlugin::List pluginList = MusicMan.getPlugins();
+
+ printf("ID Description\n");
+ printf("------------------------------ ------------------------------------------------\n");
+
+ for (MusicPlugin::List::const_iterator i = pluginList.begin(), iend = pluginList.end(); i != iend; ++i) {
+ MusicDevices deviceList = (**i)->getDevices();
+ for (MusicDevices::iterator j = deviceList.begin(), jend = deviceList.end(); j != jend; ++j) {
+ printf("%-30s %s\n", Common::String::format("\"%s\"", j->getCompleteId().c_str()).c_str(), j->getCompleteName().c_str());
+ }
+ }
+}
+
#ifdef DETECTOR_TESTING_HACK
static void runDetectorTest() {
@@ -906,6 +927,9 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
} else if (command == "list-themes") {
listThemes();
return true;
+ } else if (command == "list-audio-devices") {
+ listAudioDevices();
+ return true;
} else if (command == "version") {
printf("%s\n", gScummVMFullVersion);
printf("Features compiled in: %s\n", gScummVMFeatures);