1 | //driver.c: |
---|
2 | |
---|
3 | /* |
---|
4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009 |
---|
5 | * |
---|
6 | * This file is part of roarclients a part of RoarAudio, |
---|
7 | * a cross-platform sound system for both, home and professional use. |
---|
8 | * See README for details. |
---|
9 | * |
---|
10 | * This file is free software; you can redistribute it and/or modify |
---|
11 | * it under the terms of the GNU General Public License version 3 |
---|
12 | * as published by the Free Software Foundation. |
---|
13 | * |
---|
14 | * RoarAudio is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with this software; see the file COPYING. If not, write to |
---|
21 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
22 | * |
---|
23 | */ |
---|
24 | |
---|
25 | #include <roaraudio.h> |
---|
26 | #include "driver.h" |
---|
27 | #include "autodetected.h" |
---|
28 | |
---|
29 | #ifdef ROAR_HAVE_AD_ESDFW |
---|
30 | #include "driver_esdfw.h" |
---|
31 | #endif |
---|
32 | |
---|
33 | int roar_cdriver_null(struct roar_vio_calls * calls, char * name, char * dev, struct roar_audio_info * info, int dir) { |
---|
34 | ROAR_DBG("roar_cdriver_null(calls=%p, name='%s', dev='%s', info=%p{...}, dir=%i(?)) = ?", calls, name, dev, info, dir); |
---|
35 | |
---|
36 | memset(calls, 0, sizeof(struct roar_vio_calls)); |
---|
37 | calls->read = roar_vio_null_rw; |
---|
38 | calls->write = roar_vio_null_rw; |
---|
39 | |
---|
40 | ROAR_DBG("roar_cdriver_null(calls=%p, name='%s', dev='%s', info=%p{...}, dir=%i(?)) = 0", calls, name, dev, info, dir); |
---|
41 | return 0; |
---|
42 | } |
---|
43 | |
---|
44 | struct roar_cdriver _g_roar_cdriver[] = { |
---|
45 | {"null", roar_cdriver_null}, |
---|
46 | #if defined(ROAR_HAVE_OSS_BSD) || defined(ROAR_HAVE_OSS) |
---|
47 | {"oss", roar_cdriver_oss}, |
---|
48 | #endif |
---|
49 | #ifdef ROAR_HAVE_AD_ESDFW |
---|
50 | #include "driver_esdfw.c" |
---|
51 | #endif |
---|
52 | {NULL, NULL} |
---|
53 | }; |
---|
54 | |
---|
55 | int roar_cdriver_open(struct roar_vio_calls * calls, char * name, char * dev, struct roar_audio_info * info, int dir) { |
---|
56 | int i; |
---|
57 | char *delm; |
---|
58 | |
---|
59 | for (i = 0; _g_roar_cdriver[i].name != NULL; i++) { |
---|
60 | ROAR_DBG("roar_cdriver_open(*): _g_roar_cdriver[i].name='%s' <cmp> name='%s'", _g_roar_cdriver[i].name, name); |
---|
61 | |
---|
62 | if ( !strcmp(_g_roar_cdriver[i].name, name) ) |
---|
63 | return _g_roar_cdriver[i].open(calls, name, dev, info, dir); |
---|
64 | |
---|
65 | if ( (delm = strstr(_g_roar_cdriver[i].name, ":")) != NULL ) { |
---|
66 | ROAR_DBG("roar_cdriver_open(*): delm+1='%s' <cmp> name='%s'", delm+1, name); |
---|
67 | if ( !strcmp(delm+1, name) ) |
---|
68 | return _g_roar_cdriver[i].open(calls, name, dev, info, dir); |
---|
69 | } |
---|
70 | |
---|
71 | } |
---|
72 | |
---|
73 | return -1; |
---|
74 | } |
---|
75 | |
---|
76 | //ll |
---|