forked from mmitch/gbsplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugout.c
85 lines (72 loc) · 1.69 KB
/
plugout.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
* gbsplay is a Gameboy sound player
*
* 2003-2005,2013 (C) by Tobias Diedrich <ranma+gbsplay@tdiedrich.de>
* Christian Garbs <mitch@cgarbs.de>
* Licensed under GNU GPL.
*/
#include "common.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "plugout.h"
#ifdef PLUGOUT_DEVDSP
extern const struct output_plugin plugout_devdsp;
#endif
#ifdef PLUGOUT_ALSA
extern const struct output_plugin plugout_alsa;
#endif
#ifdef PLUGOUT_NAS
extern const struct output_plugin plugout_nas;
#endif
#ifdef PLUGOUT_STDOUT
extern const struct output_plugin plugout_stdout;
#endif
#ifdef PLUGOUT_MIDI
extern const struct output_plugin plugout_midi;
#endif
#ifdef PLUGOUT_DSOUND
extern const struct output_plugin plugout_dsound;
#endif
typedef /*@null@*/ const struct output_plugin* output_plugin_const_t;
static output_plugin_const_t plugouts[] = {
#ifdef PLUGOUT_NAS
&plugout_nas,
#endif
#ifdef PLUGOUT_DEVDSP
&plugout_devdsp,
#endif
#ifdef PLUGOUT_ALSA
&plugout_alsa,
#endif
#ifdef PLUGOUT_STDOUT
&plugout_stdout,
#endif
#ifdef PLUGOUT_MIDI
&plugout_midi,
#endif
#ifdef PLUGOUT_DSOUND
&plugout_dsound,
#endif
NULL
};
regparm void plugout_list_plugins(void)
{
long idx;
printf("%s", _("Available output plugins:\n\n"));
if (plugouts[0] == NULL) {
printf("%s", _("No output plugins available.\n\n"));
return;
}
for (idx = 0; plugouts[idx] != NULL; idx++) {
printf("%s\t- %s\n", plugouts[idx]->name, plugouts[idx]->description);
}
(void)puts("");
}
regparm const struct output_plugin* plugout_select_by_name(const char *name)
{
long idx;
for (idx = 0; plugouts[idx] != NULL &&
strcmp(plugouts[idx]->name, name) != 0; idx++);
return plugouts[idx];
}