2 * This file is part of DisOrder.
3 * Copyright (C) 2009 Richard Kettlewell
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 /** @file lib/uaudio.c
20 * @brief Uniform audio interface
28 /** @brief Options for chosen uaudio API */
29 static hash *uaudio_options;
31 /** @brief Set a uaudio option */
32 void uaudio_set(const char *name, const char *value) {
34 uaudio_options = hash_new(sizeof(char *));
35 value = xstrdup(value);
36 hash_add(uaudio_options, name, &value, HASH_INSERT_OR_REPLACE);
39 /** @brief Set a uaudio option */
40 const char *uaudio_get(const char *name) {
41 const char *value = (uaudio_options ?
42 *(char **)hash_find(uaudio_options, name)
44 return value ? xstrdup(value) : NULL;
47 /** @brief List of known APIs
49 * Terminated by a null pointer.
51 * The first one will be used as a default, so putting ALSA before OSS
52 * constitutes a policy decision.
54 const struct uaudio *uaudio_apis[] = {
55 #if HAVE_COREAUDIO_AUDIOHARDWARE_H
58 #if HAVE_ALSA_ASOUNDLIB_H
61 #if HAVE_SYS_SOUNDCARD_H || EMPEG_HOST