Mercurial > audlegacy
annotate Plugins/Output/esd/init.c @ 488:cb0f36590d98 trunk
[svn] ESD output plugin enhancements by max_verem -at- yahoo.com.
author | nenolod |
---|---|
date | Tue, 24 Jan 2006 07:52:28 -0800 |
parents | fa848bd484d8 |
children |
rev | line source |
---|---|
61 | 1 /* xmms - esound output plugin |
2 * Copyright (C) 1999 Galex Yen | |
3 * | |
4 * this program is free software | |
5 * | |
6 * Description: | |
7 * This program is an output plugin for xmms v0.9 or greater. | |
8 * The program uses the esound daemon to output audio in order | |
9 * to allow more than one program to play audio on the same | |
10 * device at the same time. | |
11 * | |
12 * Contains code Copyright (C) 1998-1999 Mikael Alm, Olle Hallnas, | |
13 * Thomas Nillson and 4Front Technologies | |
14 * | |
15 */ | |
16 | |
17 #include <glib.h> | |
18 #include <stdlib.h> | |
19 #include <string.h> | |
20 #include <esd.h> | |
21 | |
22 #include <libaudacious/configdb.h> | |
23 | |
24 #include "esdout.h" | |
25 | |
26 | |
27 ESDConfig esd_cfg; | |
28 esd_info_t *all_info; | |
29 esd_player_info_t *player_info; | |
30 | |
31 | |
32 void | |
33 esdout_init(void) | |
34 { | |
35 ConfigDb *db; | |
36 char *env; | |
488
cb0f36590d98
[svn] ESD output plugin enhancements by max_verem -at- yahoo.com.
nenolod
parents:
61
diff
changeset
|
37 int lp = 80 , rp = 80; |
61 | 38 |
39 memset(&esd_cfg, 0, sizeof(ESDConfig)); | |
40 esd_cfg.port = ESD_DEFAULT_PORT; | |
41 esd_cfg.buffer_size = 3000; | |
42 esd_cfg.prebuffer = 25; | |
43 | |
44 db = bmp_cfg_db_open(); | |
45 | |
46 if ((env = getenv("ESPEAKER")) != NULL) { | |
47 char *temp; | |
48 esd_cfg.use_remote = TRUE; | |
49 esd_cfg.server = g_strdup(env); | |
50 temp = strchr(esd_cfg.server, ':'); | |
51 if (temp != NULL) { | |
52 *temp = '\0'; | |
53 esd_cfg.port = atoi(temp + 1); | |
54 if (esd_cfg.port == 0) | |
55 esd_cfg.port = ESD_DEFAULT_PORT; | |
56 } | |
57 } | |
58 else { | |
59 bmp_cfg_db_get_bool(db, "ESD", "use_remote", &esd_cfg.use_remote); | |
60 bmp_cfg_db_get_string(db, "ESD", "remote_host", &esd_cfg.server); | |
61 bmp_cfg_db_get_int(db, "ESD", "remote_port", &esd_cfg.port); | |
62 } | |
63 bmp_cfg_db_get_bool(db, "ESD", "use_oss_mixer", &esd_cfg.use_oss_mixer); | |
64 bmp_cfg_db_get_int(db, "ESD", "buffer_size", &esd_cfg.buffer_size); | |
65 bmp_cfg_db_get_int(db, "ESD", "prebuffer", &esd_cfg.prebuffer); | |
488
cb0f36590d98
[svn] ESD output plugin enhancements by max_verem -at- yahoo.com.
nenolod
parents:
61
diff
changeset
|
66 |
cb0f36590d98
[svn] ESD output plugin enhancements by max_verem -at- yahoo.com.
nenolod
parents:
61
diff
changeset
|
67 /* restore volume levels */ |
cb0f36590d98
[svn] ESD output plugin enhancements by max_verem -at- yahoo.com.
nenolod
parents:
61
diff
changeset
|
68 bmp_cfg_db_get_int(db, "ESD", "volume_left", &lp); |
cb0f36590d98
[svn] ESD output plugin enhancements by max_verem -at- yahoo.com.
nenolod
parents:
61
diff
changeset
|
69 bmp_cfg_db_get_int(db, "ESD", "volume_right", &rp); |
cb0f36590d98
[svn] ESD output plugin enhancements by max_verem -at- yahoo.com.
nenolod
parents:
61
diff
changeset
|
70 esdout_set_volume(lp, rp); |
cb0f36590d98
[svn] ESD output plugin enhancements by max_verem -at- yahoo.com.
nenolod
parents:
61
diff
changeset
|
71 |
61 | 72 bmp_cfg_db_close(db); |
73 | |
74 if (!esd_cfg.server) | |
75 esd_cfg.server = g_strdup("localhost"); | |
76 } |