1 /**
2 * @file winwave.c Windows sound driver
3 *
4 * Copyright (C) 2010 Creytiv.com
5 */
6 #include <re.h>
7 #include <rem.h>
8 #include <windows.h>
9 #include <mmsystem.h>
10 #include <baresip.h>
11 #include "winwave.h"
12
13
14 /**
15 * @defgroup winwave winwave
16 *
17 * Windows audio driver module
18 *
19 */
20
21
22 static struct ausrc *ausrc;
23 static struct auplay *auplay;
24
25
ww_init(void)26 static int ww_init(void)
27 {
28 int play_dev_count, src_dev_count;
29 int err;
30
31 play_dev_count = waveOutGetNumDevs();
32 src_dev_count = waveInGetNumDevs();
33
34 info("winwave: output devices: %d, input devices: %d\n",
35 play_dev_count, src_dev_count);
36
37 err = ausrc_register(&ausrc, baresip_ausrcl(),
38 "winwave", winwave_src_alloc);
39 err |= auplay_register(&auplay, baresip_auplayl(),
40 "winwave", winwave_play_alloc);
41
42 return err;
43 }
44
45
ww_close(void)46 static int ww_close(void)
47 {
48 ausrc = mem_deref(ausrc);
49 auplay = mem_deref(auplay);
50
51 return 0;
52 }
53
54
55 EXPORT_SYM const struct mod_export DECL_EXPORTS(winwave) = {
56 "winwave",
57 "sound",
58 ww_init,
59 ww_close
60 };
61