Mercurial > audlegacy
annotate src/audacious/auddrct.c @ 3097:bb1fa0aed8f4
add url unescape code to playlist_get_info_text().
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Thu, 19 Jul 2007 12:49:50 +0900 |
parents | 2d915b3e3e52 |
children | 06858ea4b9d0 |
rev | line source |
---|---|
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
1 /* |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
2 * Audacious: A cross-platform multimedia player |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
3 * Copyright (c) 2007 Giacomo Lozito |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
4 * |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
7 * the Free Software Foundation; under version 2 of the License. |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
8 * |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
12 * GNU General Public License for more details. |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
13 * |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
15 * along with this program; if not, write to the Free Software |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
17 * 02110-1301, USA. |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
18 */ |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
19 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
20 /* audacious_drct_* provides a handy interface for player |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
21 plugins, originally intended for migration from xmms_remote_* calls */ |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
22 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
23 |
2743 | 24 #include "main.h" |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
25 #include "input.h" |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
26 #include "playback.h" |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
27 #include "ui_main.h" |
2743 | 28 #include "ui_playlist.h" |
29 #include "ui_equalizer.h" | |
2745 | 30 #include "ui_jumptotrack.h" |
2760 | 31 #include "auddrct.h" |
2775 | 32 #include "playlist.h" |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
33 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
34 |
2742 | 35 /* player */ |
36 | |
37 void | |
38 audacious_drct_quit ( void ) | |
39 { | |
40 mainwin_quit_cb(); | |
41 return; | |
42 } | |
43 | |
44 void | |
45 audacious_drct_eject ( void ) | |
46 { | |
47 if (has_x11_connection) | |
48 mainwin_eject_pushed(); | |
49 return; | |
50 } | |
51 | |
2745 | 52 void |
53 audacious_drct_jtf_show ( void ) | |
54 { | |
55 if (has_x11_connection) | |
56 ui_jump_to_track(); | |
57 return; | |
58 } | |
59 | |
2742 | 60 gboolean |
61 audacious_drct_main_win_is_visible ( void ) | |
62 { | |
63 return cfg.player_visible; | |
64 } | |
65 | |
66 void | |
2744 | 67 audacious_drct_main_win_toggle ( gboolean show ) |
2742 | 68 { |
69 if (has_x11_connection) | |
70 mainwin_show(show); | |
71 return; | |
72 } | |
73 | |
74 gboolean | |
2744 | 75 audacious_drct_eq_win_is_visible ( void ) |
2742 | 76 { |
77 return cfg.equalizer_visible; | |
78 } | |
79 | |
80 void | |
2744 | 81 audacious_drct_eq_win_toggle ( gboolean show ) |
2742 | 82 { |
83 if (has_x11_connection) | |
84 equalizerwin_show(show); | |
85 return; | |
86 } | |
87 | |
88 gboolean | |
2744 | 89 audacious_drct_pl_win_is_visible ( void ) |
2742 | 90 { |
91 return cfg.playlist_visible; | |
92 } | |
93 | |
94 void | |
2744 | 95 audacious_drct_pl_win_toggle ( gboolean show ) |
2742 | 96 { |
97 if (has_x11_connection) { | |
98 if (show) | |
99 playlistwin_show(); | |
100 else | |
101 playlistwin_hide(); | |
102 } | |
103 return; | |
104 } | |
105 | |
2785 | 106 void audacious_drct_set_skin(gchar *skinfile) |
107 { | |
108 if (has_x11_connection) | |
109 bmp_active_skin_load(skinfile); | |
110 } | |
111 | |
112 void audacious_drct_activate(void) | |
113 { | |
114 gtk_window_present(GTK_WINDOW(mainwin)); | |
115 } | |
2742 | 116 |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
117 /* playback */ |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
118 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
119 void |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
120 audacious_drct_play ( void ) |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
121 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
122 if (playback_get_paused()) |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
123 playback_pause(); |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
124 else if (playlist_get_length(playlist_get_active())) |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
125 playback_initiate(); |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
126 else |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
127 mainwin_eject_pushed(); |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
128 return; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
129 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
130 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
131 void |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
132 audacious_drct_pause ( void ) |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
133 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
134 playback_pause(); |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
135 return; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
136 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
137 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
138 void |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
139 audacious_drct_stop ( void ) |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
140 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
141 ip_data.stop = TRUE; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
142 playback_stop(); |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
143 ip_data.stop = FALSE; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
144 mainwin_clear_song_info(); |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
145 return; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
146 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
147 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
148 gboolean |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
149 audacious_drct_get_playing ( void ) |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
150 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
151 return playback_get_playing(); |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
152 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
153 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
154 gboolean |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
155 audacious_drct_get_paused ( void ) |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
156 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
157 return playback_get_paused(); |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
158 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
159 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
160 gboolean |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
161 audacious_drct_get_stopped ( void ) |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
162 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
163 return !playback_get_playing(); |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
164 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
165 |
2748 | 166 void |
167 audacious_drct_get_info( gint *rate, gint *freq, gint *nch) | |
168 { | |
169 playback_get_sample_params(rate, freq, nch); | |
170 } | |
171 | |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
172 gint |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
173 audacious_drct_get_time ( void ) |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
174 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
175 gint time; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
176 if (playback_get_playing()) |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
177 time = playback_get_time(); |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
178 else |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
179 time = 0; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
180 return time; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
181 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
182 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
183 void |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
184 audacious_drct_seek ( guint pos ) |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
185 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
186 if (playlist_get_current_length(playlist_get_active()) > 0 && |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
187 pos < (guint)playlist_get_current_length(playlist_get_active())) |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
188 playback_seek(pos / 1000); |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
189 return; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
190 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
191 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
192 void |
2760 | 193 audacious_drct_get_volume ( gint *vl, gint *vr ) |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
194 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
195 input_get_volume(vl, vr); |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
196 return; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
197 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
198 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
199 void |
2760 | 200 audacious_drct_set_volume ( gint vl, gint vr ) |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
201 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
202 if (vl > 100) |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
203 vl = 100; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
204 if (vr > 100) |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
205 vr = 100; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
206 input_set_volume(vl, vr); |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
207 return; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
208 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
209 |
2760 | 210 void |
211 audacious_drct_get_volume_main( gint *v ) | |
212 { | |
213 gint vl, vr; | |
214 audacious_drct_get_volume(&vl, &vr); | |
215 *v = (vl > vr) ? vl : vr; | |
216 return; | |
217 } | |
218 | |
219 void | |
220 audacious_drct_set_volume_main ( gint v ) | |
221 { | |
222 gint b, vl, vr; | |
223 audacious_drct_get_volume_balance(&b); | |
224 if (b < 0) { | |
225 vl = v; | |
226 vr = (v * (100 - abs(b))) / 100; | |
227 } | |
228 else if (b > 0) { | |
229 vl = (v * (100 - b)) / 100; | |
230 vr = v; | |
231 } | |
232 else | |
233 vl = vr = v; | |
234 audacious_drct_set_volume(vl, vr); | |
235 } | |
236 | |
237 void | |
238 audacious_drct_get_volume_balance ( gint *b ) | |
239 { | |
240 gint vl, vr; | |
241 input_get_volume(&vl, &vr); | |
242 if (vl < 0 || vr < 0) | |
243 *b = 0; | |
244 else if (vl > vr) | |
245 *b = -100 + ((vr * 100) / vl); | |
246 else if (vr > vl) | |
247 *b = 100 - ((vl * 100) / vr); | |
248 else | |
249 *b = 0; | |
250 return; | |
251 } | |
252 | |
253 void | |
254 audacious_drct_set_volume_balance ( gint b ) | |
255 { | |
256 gint v, vl, vr; | |
257 if (b < -100) | |
258 b = -100; | |
259 if (b > 100) | |
260 b = 100; | |
261 audacious_drct_get_volume_main(&v); | |
262 if (b < 0) { | |
263 vl = v; | |
264 vr = (v * (100 - abs(b))) / 100; | |
265 } | |
266 else if (b > 0) { | |
267 vl = (v * (100 - b)) / 100; | |
268 vr = v; | |
269 } | |
270 else | |
271 { | |
272 vl = v; | |
273 vr = v; | |
274 } | |
275 audacious_drct_set_volume(vl, vr); | |
276 return; | |
277 } | |
278 | |
2742 | 279 |
280 /* playlist */ | |
281 | |
282 void | |
283 audacious_drct_pl_next ( void ) | |
284 { | |
285 playlist_next(playlist_get_active()); | |
286 return; | |
287 } | |
288 | |
289 void | |
290 audacious_drct_pl_prev ( void ) | |
291 { | |
292 playlist_prev(playlist_get_active()); | |
293 return; | |
294 } | |
2745 | 295 |
296 gboolean | |
297 audacious_drct_pl_repeat_is_enabled( void ) | |
298 { | |
299 return cfg.repeat; | |
300 } | |
301 | |
302 void | |
303 audacious_drct_pl_repeat_toggle( void ) | |
304 { | |
305 mainwin_repeat_pushed(!cfg.repeat); | |
306 return; | |
307 } | |
308 | |
309 gboolean | |
310 audacious_drct_pl_repeat_is_shuffled( void ) | |
311 { | |
312 return cfg.shuffle; | |
313 } | |
314 | |
315 void | |
316 audacious_drct_pl_shuffle_toggle( void ) | |
317 { | |
318 mainwin_shuffle_pushed(!cfg.shuffle); | |
319 return; | |
320 } | |
2748 | 321 |
322 gchar * | |
323 audacious_drct_pl_get_title( gint pos ) | |
324 { | |
325 return playlist_get_songtitle(playlist_get_active(), pos); | |
326 } | |
327 | |
328 gint | |
329 audacious_drct_pl_get_time( gint pos ) | |
330 { | |
331 return playlist_get_songtime(playlist_get_active(), pos); | |
332 } | |
333 | |
334 gint | |
335 audacious_drct_pl_get_pos( void ) | |
336 { | |
337 return playlist_get_position_nolock(playlist_get_active()); | |
338 } | |
339 | |
340 gchar * | |
341 audacious_drct_pl_get_file( gint pos ) | |
342 { | |
343 return playlist_get_filename(playlist_get_active(), pos); | |
344 } | |
2760 | 345 |
346 void | |
347 audacious_drct_pl_add ( GList * list ) | |
348 { | |
349 GList *node = list; | |
350 while ( node != NULL ) | |
351 { | |
352 playlist_add_url(playlist_get_active(), (gchar*)node->data); | |
353 node = g_list_next(node); | |
354 } | |
355 return; | |
356 } | |
357 | |
358 void | |
359 audacious_drct_pl_clear ( void ) | |
360 { | |
361 playlist_clear(playlist_get_active()); | |
362 mainwin_clear_song_info(); | |
363 mainwin_set_info_text(); | |
364 return; | |
365 } | |
2775 | 366 |
367 | |
368 /* following functions are not tested yet. be careful. --yaz */ | |
369 void | |
370 audacious_drct_pl_delete ( gint pos ) | |
371 { | |
372 GDK_THREADS_ENTER(); | |
373 playlist_delete_index(playlist_get_active(), pos); | |
374 GDK_THREADS_LEAVE(); | |
375 } | |
376 | |
377 void | |
378 audacious_drct_pl_set_pos( gint pos ) | |
379 { | |
380 Playlist *playlist = playlist_get_active(); | |
381 if (pos < (guint)playlist_get_length(playlist)) | |
382 playlist_set_position(playlist, pos); | |
383 } | |
384 | |
385 gint | |
386 audacious_drct_pl_get_length( void ) | |
387 { | |
388 return playlist_get_length(playlist_get_active()); | |
389 } | |
390 | |
391 void | |
392 audacious_drct_pl_ins_url_string( gchar * string, gint pos ) | |
393 { | |
394 playlist_ins_url(playlist_get_active(), string, pos); | |
395 } | |
396 | |
397 void | |
398 audacious_drct_pl_add_url_string( gchar * string ) | |
399 { | |
400 GDK_THREADS_ENTER(); | |
401 playlist_add_url(playlist_get_active(), string); | |
402 GDK_THREADS_LEAVE(); | |
403 } | |
404 | |
405 void | |
406 audacious_drct_pl_enqueue_to_temp( gchar * string ) | |
407 { | |
408 Playlist *new_pl = playlist_new(); | |
409 | |
410 GDK_THREADS_ENTER(); | |
411 playlist_select_playlist(new_pl); | |
412 playlist_add_url(new_pl, string); | |
413 GDK_THREADS_LEAVE(); | |
414 } | |
415 | |
416 | |
417 /* playqueue */ | |
418 gint | |
419 audacious_drct_pq_get_length( void ) | |
420 { | |
421 return playlist_queue_get_length(playlist_get_active()); | |
422 } | |
423 | |
424 void | |
425 audacious_drct_pq_add( gint pos ) | |
426 { | |
427 Playlist *playlist = playlist_get_active(); | |
428 if (pos < (guint)playlist_get_length(playlist)) | |
429 playlist_queue_position(playlist, pos); | |
430 } | |
431 | |
432 void | |
433 audacious_drct_pq_remove( gint pos ) | |
434 { | |
435 Playlist *playlist = playlist_get_active(); | |
436 if (pos < (guint)playlist_get_length(playlist)) | |
437 playlist_queue_remove(playlist_get_active(), pos); | |
438 } | |
439 | |
440 void | |
441 audacious_drct_pq_clear( void ) | |
442 { | |
443 playlist_clear_queue(playlist_get_active()); | |
444 } | |
445 | |
446 gboolean | |
447 audacious_drct_pq_is_queued( gint pos ) | |
448 { | |
449 return playlist_is_position_queued(playlist_get_active(), pos); | |
450 } | |
451 | |
452 gint | |
453 audacious_drct_pq_get_position( gint pos ) | |
454 { | |
455 return playlist_get_queue_position_number(playlist_get_active(), pos); | |
456 } | |
457 | |
458 gint | |
459 audaciuos_drct_pq_get_queue_position( gint pos ) | |
460 { | |
461 return playlist_get_queue_position_number(playlist_get_active(), pos); | |
462 } | |
2785 | 463 |