[2122] | 1 | //driver.c: |
---|
| 2 | |
---|
| 3 | /* |
---|
[3811] | 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009-2010 |
---|
[2122] | 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 |
---|
[3517] | 21 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
---|
| 22 | * Boston, MA 02110-1301, USA. |
---|
[2122] | 23 | * |
---|
| 24 | */ |
---|
| 25 | |
---|
| 26 | #include <roaraudio.h> |
---|
| 27 | #include "driver.h" |
---|
[2348] | 28 | #include "autodetected.h" |
---|
| 29 | |
---|
| 30 | #ifdef ROAR_HAVE_AD_ESDFW |
---|
| 31 | #include "driver_esdfw.h" |
---|
| 32 | #endif |
---|
[2122] | 33 | |
---|
[2130] | 34 | int roar_cdriver_null(struct roar_vio_calls * calls, char * name, char * dev, struct roar_audio_info * info, int dir) { |
---|
| 35 | ROAR_DBG("roar_cdriver_null(calls=%p, name='%s', dev='%s', info=%p{...}, dir=%i(?)) = ?", calls, name, dev, info, dir); |
---|
| 36 | |
---|
| 37 | memset(calls, 0, sizeof(struct roar_vio_calls)); |
---|
| 38 | calls->read = roar_vio_null_rw; |
---|
| 39 | calls->write = roar_vio_null_rw; |
---|
| 40 | |
---|
| 41 | ROAR_DBG("roar_cdriver_null(calls=%p, name='%s', dev='%s', info=%p{...}, dir=%i(?)) = 0", calls, name, dev, info, dir); |
---|
| 42 | return 0; |
---|
| 43 | } |
---|
| 44 | |
---|
[2123] | 45 | struct roar_cdriver _g_roar_cdriver[] = { |
---|
[2130] | 46 | {"null", roar_cdriver_null}, |
---|
[3851] | 47 | {"roar", roar_cdriver_roar}, |
---|
[2219] | 48 | #if defined(ROAR_HAVE_OSS_BSD) || defined(ROAR_HAVE_OSS) |
---|
[2133] | 49 | {"oss", roar_cdriver_oss}, |
---|
[2219] | 50 | #endif |
---|
[2348] | 51 | #ifdef ROAR_HAVE_AD_ESDFW |
---|
| 52 | #include "driver_esdfw.c" |
---|
| 53 | #endif |
---|
[2123] | 54 | {NULL, NULL} |
---|
| 55 | }; |
---|
| 56 | |
---|
| 57 | int roar_cdriver_open(struct roar_vio_calls * calls, char * name, char * dev, struct roar_audio_info * info, int dir) { |
---|
| 58 | int i; |
---|
[2349] | 59 | char *delm; |
---|
[2123] | 60 | |
---|
| 61 | for (i = 0; _g_roar_cdriver[i].name != NULL; i++) { |
---|
[2348] | 62 | ROAR_DBG("roar_cdriver_open(*): _g_roar_cdriver[i].name='%s' <cmp> name='%s'", _g_roar_cdriver[i].name, name); |
---|
[2349] | 63 | |
---|
[2133] | 64 | if ( !strcmp(_g_roar_cdriver[i].name, name) ) |
---|
| 65 | return _g_roar_cdriver[i].open(calls, name, dev, info, dir); |
---|
[2349] | 66 | |
---|
| 67 | if ( (delm = strstr(_g_roar_cdriver[i].name, ":")) != NULL ) { |
---|
| 68 | ROAR_DBG("roar_cdriver_open(*): delm+1='%s' <cmp> name='%s'", delm+1, name); |
---|
| 69 | if ( !strcmp(delm+1, name) ) |
---|
| 70 | return _g_roar_cdriver[i].open(calls, name, dev, info, dir); |
---|
| 71 | } |
---|
| 72 | |
---|
[2123] | 73 | } |
---|
| 74 | |
---|
| 75 | return -1; |
---|
| 76 | } |
---|
| 77 | |
---|
[2122] | 78 | //ll |
---|