cleanup
[pcsx_rearmed.git] / plugins / dfsound / out.c
CommitLineData
07c13dfd 1#include <stdio.h>
2#include <stdlib.h>
3#include "out.h"
4
5#define MAX_OUT_DRIVERS 5
6
7static struct out_driver out_drivers[MAX_OUT_DRIVERS];
8struct out_driver *out_current;
9static int driver_count;
10
11#define REGISTER_DRIVER(d) { \
12 extern void out_register_##d(struct out_driver *drv); \
13 out_register_##d(&out_drivers[driver_count++]); \
14}
15
16void SetupSound(void)
17{
18 int i;
19
20 if (driver_count == 0) {
21#ifdef HAVE_OSS
22 REGISTER_DRIVER(oss);
23#endif
24#ifdef HAVE_ALSA
25 REGISTER_DRIVER(alsa);
26#endif
27#ifdef HAVE_SDL
28 REGISTER_DRIVER(sdl);
29#endif
30#ifdef HAVE_PULSE
31 REGISTER_DRIVER(pulse);
32#endif
33#ifdef HAVE_LIBRETRO
34 REGISTER_DRIVER(libretro);
d02d2725 35#else
07c13dfd 36 REGISTER_DRIVER(none);
d02d2725 37#endif
07c13dfd 38 }
39
40 for (i = 0; i < driver_count; i++)
41 if (out_drivers[i].init() == 0)
42 break;
43
44 if (i < 0 || i >= driver_count) {
45 printf("the impossible happened\n");
46 abort();
47 }
48
49 out_current = &out_drivers[i];
50 printf("selected sound output driver: %s\n", out_current->name);
51}
52