Skip to content

Commit de8f3b3

Browse files
committed
Isolate driver-specific messages and parsers by which drivers that are enabled.
1 parent 83c5b67 commit de8f3b3

File tree

1 file changed

+42
-9
lines changed

1 file changed

+42
-9
lines changed

src/adplay.cc

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,28 @@ static void usage()
138138
"Output selection:\n"
139139
" -e, --emulator=EMULATOR specify emulator to use\n"
140140
" -O, --output=OUTPUT specify output mechanism\n\n"
141+
#ifdef DRIVER_OSS
141142
"OSS driver (oss) specific:\n"
142143
" -d, --device=FILE set sound device file to FILE\n"
143144
" -b, --buffer=SIZE set output buffer size to SIZE\n\n"
145+
#endif
146+
#ifdef DRIVER_DISK
144147
"Disk writer (disk) specific:\n"
145148
" -d, --device=FILE output to FILE ('-' is stdout)\n\n"
149+
#endif
150+
#ifdef DRIVER_ESOUND
146151
"EsounD driver (esound) specific:\n"
147152
" -d, --device=URL URL to EsounD server host (hostname:port)\n\n"
153+
#endif
154+
#ifdef DRIVER_SDL
148155
"SDL driver (sdl) specific:\n"
149156
" -b, --buffer=SIZE set output buffer size to SIZE\n\n"
157+
#endif
158+
#ifdef DRIVER_ALSA
150159
"ALSA driver (alsa) specific:\n"
151160
" -d, --device=DEVICE set sound device to DEVICE\n"
152161
" -b, --buffer=SIZE set output buffer size to SIZE\n\n"
162+
#endif
153163
"Playback quality:\n"
154164
" -8, --8bit 8-bit sample quality\n"
155165
" --16bit 16-bit sample quality\n"
@@ -263,18 +273,42 @@ static int decode_switches(int argc, char **argv)
263273
message(MSG_WARN, "could not open database -- %s", optarg);
264274
break;
265275
case 'O':
276+
#ifdef DRIVER_OSS
266277
if(!strcmp(optarg,"oss")) cfg.output = oss;
267-
else if(!strcmp(optarg,"null")) cfg.output = null;
268-
else if(!strcmp(optarg,"disk")) {
278+
else
279+
#endif
280+
#ifdef DRIVER_NULL
281+
if(!strcmp(optarg,"null")) cfg.output = null;
282+
else
283+
#endif
284+
#ifdef DRIVER_DISK
285+
if(!strcmp(optarg,"disk")) {
269286
cfg.output = disk;
270287
cfg.endless = false; // endless output is almost never desired here
271288
}
272-
else if(!strcmp(optarg,"esound")) cfg.output = esound;
273-
else if(!strcmp(optarg,"qsa")) cfg.output = qsa;
274-
else if(!strcmp(optarg,"alsa")) cfg.output = alsa;
275-
else if(!strcmp(optarg,"sdl")) cfg.output = sdl;
276-
else if(!strcmp(optarg,"ao")) cfg.output = ao;
277-
else {
289+
else
290+
#endif
291+
#ifdef DRIVER_ESOUND
292+
if(!strcmp(optarg,"esound")) cfg.output = esound;
293+
else
294+
#endif
295+
#ifdef DRIVER_QSA
296+
if(!strcmp(optarg,"qsa")) cfg.output = qsa;
297+
else
298+
#endif
299+
#ifdef DRIVER_ALSA
300+
if(!strcmp(optarg,"alsa")) cfg.output = alsa;
301+
else
302+
#endif
303+
#ifdef DRIVER_SDL
304+
if(!strcmp(optarg,"sdl")) cfg.output = sdl;
305+
else
306+
#endif
307+
#ifdef DRIVER_AO
308+
if(!strcmp(optarg,"ao")) cfg.output = ao;
309+
else
310+
#endif
311+
{
278312
message(MSG_ERROR, "unknown output method -- %s", optarg);
279313
exit(EXIT_FAILURE);
280314
}
@@ -545,7 +579,6 @@ int main(int argc, char **argv)
545579
player = new AOPlayer(opl, cfg.device, cfg.bits, cfg.channels, cfg.freq, cfg.buf_size);
546580
break;
547581
#endif
548-
#
549582
#ifdef DRIVER_SDL
550583
case sdl:
551584
player = new SDLPlayer(opl, cfg.bits, cfg.channels, cfg.freq, cfg.buf_size);

0 commit comments

Comments
 (0)