Mercurial > audlegacy-plugins
comparison src/Output/alsa/init.c @ 0:13389e613d67 trunk
[svn] - initial import of audacious-plugins tree (lots to do)
| author | nenolod |
|---|---|
| date | Mon, 18 Sep 2006 01:11:49 -0700 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:13389e613d67 |
|---|---|
| 1 /* XMMS - ALSA output plugin | |
| 2 * Copyright (C) 2001-2003 Matthieu Sozeau <mattam@altern.org> | |
| 3 * Copyright (C) 2003-2005 Haavard Kvaalen | |
| 4 * | |
| 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 2 of the License, or | |
| 8 * (at your option) any later version. | |
| 9 * | |
| 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. | |
| 14 * | |
| 15 * You should have received a copy of the GNU General Public License | |
| 16 * along with this program; if not, write to the Free Software | |
| 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 18 */ | |
| 19 #include "audacious/main.h" | |
| 20 #include "alsa.h" | |
| 21 #include <dlfcn.h> | |
| 22 #include <ctype.h> | |
| 23 | |
| 24 struct alsa_config alsa_cfg; | |
| 25 | |
| 26 void alsa_init(void) | |
| 27 { | |
| 28 ConfigDb *cfgfile; | |
| 29 | |
| 30 memset(&alsa_cfg, 0, sizeof (alsa_cfg)); | |
| 31 alsa_cfg.buffer_time = 500; | |
| 32 alsa_cfg.period_time = 100; | |
| 33 alsa_cfg.debug = 0; | |
| 34 alsa_cfg.vol.left = 100; | |
| 35 alsa_cfg.vol.right = 100; | |
| 36 | |
| 37 cfgfile = bmp_cfg_db_open(); | |
| 38 if (!bmp_cfg_db_get_string(cfgfile, "ALSA", "pcm_device", | |
| 39 &alsa_cfg.pcm_device)) | |
| 40 alsa_cfg.pcm_device = g_strdup("default"); | |
| 41 g_message("device: %s", alsa_cfg.pcm_device); | |
| 42 if (!bmp_cfg_db_get_string(cfgfile, "ALSA", "mixer_device", | |
| 43 &alsa_cfg.mixer_device)) | |
| 44 alsa_cfg.mixer_device = g_strdup("PCM"); | |
| 45 bmp_cfg_db_get_int(cfgfile, "ALSA", "mixer_card", &alsa_cfg.mixer_card); | |
| 46 bmp_cfg_db_get_int(cfgfile, "ALSA", "buffer_time", &alsa_cfg.buffer_time); | |
| 47 bmp_cfg_db_get_int(cfgfile, "ALSA", "period_time", &alsa_cfg.period_time); | |
| 48 | |
| 49 bmp_cfg_db_get_bool(cfgfile, "ALSA", "soft_volume", | |
| 50 &alsa_cfg.soft_volume); | |
| 51 bmp_cfg_db_get_int(cfgfile, "ALSA", "volume_left", &alsa_cfg.vol.left); | |
| 52 bmp_cfg_db_get_int(cfgfile, "ALSA", "volume_right", &alsa_cfg.vol.right); | |
| 53 | |
| 54 bmp_cfg_db_get_bool(cfgfile, "ALSA", "debug", &alsa_cfg.debug); | |
| 55 bmp_cfg_db_close(cfgfile); | |
| 56 | |
| 57 if (dlopen("libasound.so.2", RTLD_NOW | RTLD_GLOBAL) == NULL) | |
| 58 { | |
| 59 g_message("Cannot load alsa library: %s", dlerror()); | |
| 60 /* FIXME, this plugin wont work... */ | |
| 61 } | |
| 62 | |
| 63 alsa_mutex = g_mutex_new(); | |
| 64 } |
