Mercurial > audlegacy
comparison src/libaudclient/audctrl.c @ 2713:8f7da5257692 trunk
[svn] - rename to libaudclient
- enforce libaudclient.so.1
author | nenolod |
---|---|
date | Wed, 09 May 2007 14:40:01 -0700 |
parents | src/libaudaciousng/audctrl.c@c35913222440 |
children | f4a5f8fa3836 |
comparison
equal
deleted
inserted
replaced
2712:aeb4d8da1543 | 2713:8f7da5257692 |
---|---|
1 /* | |
2 * Audacious: A cross-platform multimedia player | |
3 * Copyright (c) 2007 Ben Tucker | |
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; under version 2 of the License. | |
8 * | |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with this program; if not, write to the Free Software | |
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | |
17 * 02110-1301, USA. | |
18 */ | |
19 | |
20 #ifdef HAVE_CONFIG_H | |
21 # include "config.h" | |
22 #endif | |
23 | |
24 #include <stdlib.h> | |
25 #include <glib.h> | |
26 #include <dbus/dbus-glib.h> | |
27 #include "audacious/dbus.h" | |
28 #include "audacious/dbus-client-bindings.h" | |
29 #include "audctrl.h" | |
30 | |
31 GError *error = NULL; | |
32 | |
33 void audacious_remote_playlist(DBusGProxy *proxy, gchar **list, gint num, | |
34 gboolean enqueue) { | |
35 } | |
36 | |
37 gint audacious_remote_get_version(DBusGProxy *proxy) { | |
38 return 0; | |
39 } | |
40 | |
41 void audacious_remote_playlist_add(DBusGProxy *proxy, GList *list) { | |
42 } | |
43 | |
44 void audacious_remote_playlist_delete(DBusGProxy *proxy, gint pos) { | |
45 } | |
46 | |
47 void audacious_remote_play(DBusGProxy *proxy) { | |
48 org_atheme_audacious_playback_play(proxy, &error); | |
49 g_error_free(error); | |
50 } | |
51 | |
52 void audacious_remote_pause(DBusGProxy *proxy) { | |
53 org_atheme_audacious_playback_pause(proxy, &error); | |
54 g_error_free(error); | |
55 } | |
56 | |
57 void audacious_remote_stop(DBusGProxy *proxy) { | |
58 org_atheme_audacious_playback_stop(proxy, &error); | |
59 g_error_free(error); | |
60 } | |
61 | |
62 gboolean audacious_remote_is_playing(DBusGProxy *proxy) { | |
63 gboolean is_playing; | |
64 org_atheme_audacious_playback_playing(proxy, &is_playing, &error); | |
65 g_error_free(error); | |
66 return is_playing; | |
67 } | |
68 | |
69 gboolean audacious_remote_is_paused(DBusGProxy *proxy) { | |
70 gboolean is_paused; | |
71 org_atheme_audacious_playback_paused(proxy, &is_paused, &error); | |
72 g_error_free(error); | |
73 return is_paused; | |
74 } | |
75 | |
76 gint audacious_remote_get_playlist_pos(DBusGProxy *proxy) { | |
77 gint pos; | |
78 org_atheme_audacious_playlist_position(proxy, &pos, &error); | |
79 g_error_free(error); | |
80 return pos; | |
81 } | |
82 | |
83 void audacious_remote_set_playlist_pos(DBusGProxy *proxy, gint pos) { | |
84 } | |
85 | |
86 gint audacious_remote_get_playlist_length(DBusGProxy *proxy) { | |
87 gint len; | |
88 org_atheme_audacious_playlist_length(proxy, &len, &error); | |
89 g_error_free(error); | |
90 return len; | |
91 } | |
92 | |
93 void audacious_remote_playlist_clear(DBusGProxy *proxy) { | |
94 org_atheme_audacious_playlist_clear(proxy, &error); | |
95 g_error_free(error); | |
96 } | |
97 | |
98 gint audacious_remote_get_output_time(DBusGProxy *proxy) { | |
99 gint time; | |
100 org_atheme_audacious_playback_time(proxy, &time, &error); | |
101 g_error_free(error); | |
102 return time; | |
103 } | |
104 | |
105 void audacious_remote_jump_to_time(DBusGProxy *proxy, gint pos) { | |
106 } | |
107 | |
108 /** | |
109 * audacious_remote_get_volume: | |
110 * @proxy: DBus proxy for audacious | |
111 * @vl: Pointer to integer containing the left channel's volume. | |
112 * @vr: Pointer to integer containing the right channel's volume. | |
113 * | |
114 * Queries audacious about the current volume. | |
115 **/ | |
116 void audacious_remote_get_volume(DBusGProxy *proxy, gint * vl, gint * vr) { | |
117 org_atheme_audacious_playback_volume(proxy, vl, vr, &error); | |
118 g_error_free(error); | |
119 } | |
120 | |
121 /** | |
122 * audacious_remote_get_main_volume: | |
123 * @proxy: DBus proxy for audacious | |
124 * | |
125 * Queries audacious about the current volume. | |
126 * | |
127 * Return value: The current volume. | |
128 **/ | |
129 gint audacious_remote_get_main_volume(DBusGProxy *proxy) { | |
130 gint vl, vr; | |
131 | |
132 audacious_remote_get_volume(proxy, &vl, &vr); | |
133 | |
134 return (vl > vr) ? vl : vr; | |
135 } | |
136 | |
137 /** | |
138 * audacious_remote_set_volume: | |
139 * @proxy: DBus proxy for audacious | |
140 * @vl: The volume for the left channel. | |
141 * @vr: The volume for the right channel. | |
142 * | |
143 * Sets the volume for the left and right channels in Audacious. | |
144 **/ | |
145 void audacious_remote_set_volume(DBusGProxy *proxy, gint vl, gint vr) { | |
146 org_atheme_audacious_playback_set_volume(proxy, vl, vr, &error); | |
147 g_error_free(error); | |
148 } | |
149 | |
150 | |
151 /** | |
152 * audacious_remote_set_main_volume: | |
153 * @proxy: DBus proxy for audacious | |
154 * @v: The volume to set. | |
155 * | |
156 * Sets the volume in Audacious. | |
157 **/ | |
158 void audacious_remote_set_main_volume(DBusGProxy *proxy, gint v) { | |
159 gint b, vl, vr; | |
160 | |
161 b = audacious_remote_get_balance(proxy); | |
162 | |
163 if (b < 0) { | |
164 vl = v; | |
165 vr = (v * (100 - abs(b))) / 100; | |
166 } else if (b > 0) { | |
167 vl = (v * (100 - b)) / 100; | |
168 vr = v; | |
169 } else | |
170 vl = vr = v; | |
171 audacious_remote_set_volume(proxy, vl, vr); | |
172 } | |
173 | |
174 /** | |
175 * audacious_remote_get_balance: | |
176 * @proxy: DBus proxy for audacious | |
177 * | |
178 * Queries audacious about the current balance. | |
179 * | |
180 * Return value: The current balance. | |
181 **/ | |
182 gint audacious_remote_get_balance(DBusGProxy *proxy) { | |
183 gint balance; | |
184 org_atheme_audacious_playback_balance(proxy, &balance, &error); | |
185 g_error_free(error); | |
186 return balance; | |
187 } | |
188 | |
189 void audacious_remote_playlist_add_url_string(DBusGProxy *proxy, | |
190 gchar *string) { | |
191 org_atheme_audacious_playlist_add_url(proxy, string, &error); | |
192 g_error_free(error); | |
193 } |