gl: clear w, h on reinit
[libpicofe.git] / sndout.c
CommitLineData
26d3ca0d
GI
1/*
2 * (C) notaz, 2013
3 *
4 * This work is licensed under the terms of any of these licenses
5 * (at your option):
6 * - GNU GPL, version 2 or later.
7 * - GNU LGPL, version 2.1 or later.
8 * - MAME license.
9 * See the COPYING file in the top-level directory.
10 */
11
12#include <stdio.h>
13#include <string.h>
14
15#include "linux/sndout_oss.h"
32d23d03 16#include "linux/sndout_alsa.h"
26d3ca0d
GI
17#include "sndout_sdl.h"
18#include "sndout.h"
19
20static int sndout_null_init(void)
21{
22 return 0;
23}
24
25static void sndout_null_exit(void)
26{
27}
28
29static int sndout_null_start(int rate, int stereo)
30{
31 return 0;
32}
33
34static void sndout_null_stop(void)
35{
36}
37
38static void sndout_null_wait(void)
39{
40}
41
42static int sndout_null_write_nb(const void *data, int bytes)
43{
44 return bytes;
45}
46
47#define SNDOUT_DRIVER(name) { \
48 #name, \
49 sndout_##name##_init, \
50 sndout_##name##_exit, \
51 sndout_##name##_start, \
52 sndout_##name##_stop, \
53 sndout_##name##_wait, \
54 sndout_##name##_write_nb, \
55}
56
57static struct sndout_driver sndout_avail[] =
58{
59#ifdef HAVE_SDL
60 SNDOUT_DRIVER(sdl),
61#endif
32d23d03
GI
62#ifdef HAVE_ALSA
63 SNDOUT_DRIVER(alsa),
64#endif
26d3ca0d
GI
65#ifdef HAVE_OSS
66 SNDOUT_DRIVER(oss),
67#endif
68 SNDOUT_DRIVER(null)
69};
70
71struct sndout_driver sndout_current;
72
73void sndout_init(void)
74{
75 int i;
76
77 for (i = 0; i < sizeof(sndout_avail) / sizeof(sndout_avail[0]); i++) {
78 if (sndout_avail[i].init() == 0)
79 break;
80 }
81
82 memcpy(&sndout_current, &sndout_avail[i], sizeof(sndout_current));
83 printf("using %s audio output driver\n", sndout_current.name);
84}