Mercurial > audlegacy
annotate src/audacious/auddrct.c @ 4621:fb56923e8206
Updated pkg.m4.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 05 Jun 2008 16:04:18 +0300 |
parents | 974b7a03152a |
children |
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 /* |
2892
2f5e02538dfa
Backed out changeset 06858ea4b9d01dab0ce54891221bd1534a9c5ade
William Pitcock <nenolod@atheme.org>
parents:
2863
diff
changeset
|
2 * Audacious: A cross-platform multimedia player |
2739
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 * |
2892
2f5e02538dfa
Backed out changeset 06858ea4b9d01dab0ce54891221bd1534a9c5ade
William Pitcock <nenolod@atheme.org>
parents:
2863
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
2f5e02538dfa
Backed out changeset 06858ea4b9d01dab0ce54891221bd1534a9c5ade
William Pitcock <nenolod@atheme.org>
parents:
2863
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2892
diff
changeset
|
7 * the Free Software Foundation; under version 3 of the License. |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
8 * |
2892
2f5e02538dfa
Backed out changeset 06858ea4b9d01dab0ce54891221bd1534a9c5ade
William Pitcock <nenolod@atheme.org>
parents:
2863
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
2f5e02538dfa
Backed out changeset 06858ea4b9d01dab0ce54891221bd1534a9c5ade
William Pitcock <nenolod@atheme.org>
parents:
2863
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2f5e02538dfa
Backed out changeset 06858ea4b9d01dab0ce54891221bd1534a9c5ade
William Pitcock <nenolod@atheme.org>
parents:
2863
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2f5e02538dfa
Backed out changeset 06858ea4b9d01dab0ce54891221bd1534a9c5ade
William Pitcock <nenolod@atheme.org>
parents:
2863
diff
changeset
|
12 * GNU General Public License for more details. |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
13 * |
2892
2f5e02538dfa
Backed out changeset 06858ea4b9d01dab0ce54891221bd1534a9c5ade
William Pitcock <nenolod@atheme.org>
parents:
2863
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2892
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
16 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
17 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
18 * Audacious or using our public API to be a derived work. |
2739
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 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
21 /* 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
|
22 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
|
23 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
24 |
2743 | 25 #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
|
26 #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
|
27 #include "playback.h" |
2760 | 28 #include "auddrct.h" |
2775 | 29 #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
|
30 |
2742 | 31 /* player */ |
32 | |
33 void | |
3753 | 34 drct_quit ( void ) |
2742 | 35 { |
4542 | 36 aud_quit(); |
2742 | 37 } |
38 | |
39 void | |
3753 | 40 drct_eject ( void ) |
2742 | 41 { |
4594
974b7a03152a
run open file dialogue on drct_eject() (Bugzilla #18)
Tomasz Mon <desowin@gmail.com>
parents:
4578
diff
changeset
|
42 gboolean play_button = TRUE; |
4544
084dbc8d23da
removed variable "has_x11_connection" from main.c, needed to hookify some functions therefore
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
43 hook_call("filebrowser show", &play_button); |
2742 | 44 } |
45 | |
2745 | 46 void |
3753 | 47 drct_jtf_show ( void ) |
2745 | 48 { |
4544
084dbc8d23da
removed variable "has_x11_connection" from main.c, needed to hookify some functions therefore
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
49 gboolean show = TRUE; |
084dbc8d23da
removed variable "has_x11_connection" from main.c, needed to hookify some functions therefore
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
50 hook_call("ui jump to track show", &show); |
2745 | 51 } |
52 | |
2742 | 53 gboolean |
3753 | 54 drct_main_win_is_visible ( void ) |
2742 | 55 { |
4542 | 56 return cfg.player_visible; |
2742 | 57 } |
58 | |
59 void | |
3753 | 60 drct_main_win_toggle ( gboolean show ) |
2742 | 61 { |
4544
084dbc8d23da
removed variable "has_x11_connection" from main.c, needed to hookify some functions therefore
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
62 hook_call("mainwin show", &show); |
2742 | 63 } |
64 | |
65 gboolean | |
3753 | 66 drct_eq_win_is_visible ( void ) |
2742 | 67 { |
4542 | 68 return cfg.equalizer_visible; |
2742 | 69 } |
70 | |
71 void | |
3753 | 72 drct_eq_win_toggle ( gboolean show ) |
2742 | 73 { |
4544
084dbc8d23da
removed variable "has_x11_connection" from main.c, needed to hookify some functions therefore
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
74 hook_call("equalizerwin show", &show); |
2742 | 75 } |
76 | |
77 gboolean | |
3753 | 78 drct_pl_win_is_visible ( void ) |
2742 | 79 { |
4542 | 80 return cfg.playlist_visible; |
2742 | 81 } |
82 | |
83 void | |
3753 | 84 drct_pl_win_toggle ( gboolean show ) |
2742 | 85 { |
4544
084dbc8d23da
removed variable "has_x11_connection" from main.c, needed to hookify some functions therefore
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
86 hook_call("playlistwin show", &show); |
2742 | 87 } |
88 | |
3753 | 89 void drct_activate(void) |
2785 | 90 { |
91 gtk_window_present(GTK_WINDOW(mainwin)); | |
92 } | |
2742 | 93 |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
94 /* playback */ |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
95 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
96 void |
4578
d27f00f6b568
add audacious_drct_initiate
Tomasz Mon <desowin@gmail.com>
parents:
4573
diff
changeset
|
97 drct_initiate ( void ) |
d27f00f6b568
add audacious_drct_initiate
Tomasz Mon <desowin@gmail.com>
parents:
4573
diff
changeset
|
98 { |
d27f00f6b568
add audacious_drct_initiate
Tomasz Mon <desowin@gmail.com>
parents:
4573
diff
changeset
|
99 playback_initiate(); |
d27f00f6b568
add audacious_drct_initiate
Tomasz Mon <desowin@gmail.com>
parents:
4573
diff
changeset
|
100 } |
d27f00f6b568
add audacious_drct_initiate
Tomasz Mon <desowin@gmail.com>
parents:
4573
diff
changeset
|
101 |
d27f00f6b568
add audacious_drct_initiate
Tomasz Mon <desowin@gmail.com>
parents:
4573
diff
changeset
|
102 void |
3753 | 103 drct_play ( void ) |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
104 { |
4542 | 105 if (playback_get_paused()) |
106 playback_pause(); | |
107 else if (playlist_get_length(playlist_get_active())) | |
108 event_queue("playback initiate", (gpointer)0xdeadbeef); // to avoid crash at startup. --yaz | |
109 else | |
110 mainwin_eject_pushed(); | |
111 return; | |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
112 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
113 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
114 void |
3753 | 115 drct_pause ( void ) |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
116 { |
4542 | 117 playback_pause(); |
118 return; | |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
119 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
120 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
121 void |
3753 | 122 drct_stop ( void ) |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
123 { |
4542 | 124 ip_data.stop = TRUE; |
125 playback_stop(); | |
126 ip_data.stop = FALSE; | |
127 mainwin_clear_song_info(); | |
128 return; | |
2739
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 gboolean |
3753 | 132 drct_get_playing ( void ) |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
133 { |
4542 | 134 return playback_get_playing(); |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
135 } |
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 gboolean |
3753 | 138 drct_get_paused ( void ) |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
139 { |
4542 | 140 return playback_get_paused(); |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
141 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
142 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
143 gboolean |
3753 | 144 drct_get_stopped ( void ) |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
145 { |
4542 | 146 return !playback_get_playing(); |
2739
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 |
2748 | 149 void |
3753 | 150 drct_get_info( gint *rate, gint *freq, gint *nch) |
2748 | 151 { |
152 playback_get_sample_params(rate, freq, nch); | |
153 } | |
154 | |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
155 gint |
3753 | 156 drct_get_time ( void ) |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
157 { |
4542 | 158 gint time; |
159 if (playback_get_playing()) | |
160 time = playback_get_time(); | |
161 else | |
162 time = 0; | |
163 return time; | |
2739
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 |
4573
11f7874f3a95
add audacious_drct_get_length
Tomasz Mon <desowin@gmail.com>
parents:
4544
diff
changeset
|
166 gint |
11f7874f3a95
add audacious_drct_get_length
Tomasz Mon <desowin@gmail.com>
parents:
4544
diff
changeset
|
167 drct_get_length ( void ) |
11f7874f3a95
add audacious_drct_get_length
Tomasz Mon <desowin@gmail.com>
parents:
4544
diff
changeset
|
168 { |
11f7874f3a95
add audacious_drct_get_length
Tomasz Mon <desowin@gmail.com>
parents:
4544
diff
changeset
|
169 if (playback_get_playing()) |
11f7874f3a95
add audacious_drct_get_length
Tomasz Mon <desowin@gmail.com>
parents:
4544
diff
changeset
|
170 return playback_get_length(); |
11f7874f3a95
add audacious_drct_get_length
Tomasz Mon <desowin@gmail.com>
parents:
4544
diff
changeset
|
171 else |
11f7874f3a95
add audacious_drct_get_length
Tomasz Mon <desowin@gmail.com>
parents:
4544
diff
changeset
|
172 return -1; |
11f7874f3a95
add audacious_drct_get_length
Tomasz Mon <desowin@gmail.com>
parents:
4544
diff
changeset
|
173 } |
11f7874f3a95
add audacious_drct_get_length
Tomasz Mon <desowin@gmail.com>
parents:
4544
diff
changeset
|
174 |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
175 void |
3753 | 176 drct_seek ( guint pos ) |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
177 { |
4542 | 178 if (playlist_get_current_length(playlist_get_active()) > 0 && |
179 pos < (guint)playlist_get_current_length(playlist_get_active())) | |
180 playback_seek(pos / 1000); | |
181 return; | |
2739
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 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
184 void |
3753 | 185 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
|
186 { |
4542 | 187 input_get_volume(vl, vr); |
188 return; | |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
189 } |
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 void |
3753 | 192 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
|
193 { |
4542 | 194 if (vl > 100) |
195 vl = 100; | |
196 if (vr > 100) | |
197 vr = 100; | |
198 input_set_volume(vl, vr); | |
199 return; | |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
200 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
201 |
2760 | 202 void |
3753 | 203 drct_get_volume_main( gint *v ) |
2760 | 204 { |
4542 | 205 gint vl, vr; |
206 drct_get_volume(&vl, &vr); | |
207 *v = (vl > vr) ? vl : vr; | |
208 return; | |
2760 | 209 } |
210 | |
211 void | |
3753 | 212 drct_set_volume_main ( gint v ) |
2760 | 213 { |
4542 | 214 gint b, vl, vr; |
215 drct_get_volume_balance(&b); | |
216 if (b < 0) { | |
217 vl = v; | |
218 vr = (v * (100 - abs(b))) / 100; | |
219 } | |
220 else if (b > 0) { | |
221 vl = (v * (100 - b)) / 100; | |
222 vr = v; | |
223 } | |
224 else | |
225 vl = vr = v; | |
226 drct_set_volume(vl, vr); | |
2760 | 227 } |
228 | |
229 void | |
3753 | 230 drct_get_volume_balance ( gint *b ) |
2760 | 231 { |
4542 | 232 gint vl, vr; |
233 input_get_volume(&vl, &vr); | |
234 if (vl < 0 || vr < 0) | |
235 *b = 0; | |
236 else if (vl > vr) | |
237 *b = -100 + ((vr * 100) / vl); | |
238 else if (vr > vl) | |
239 *b = 100 - ((vl * 100) / vr); | |
240 else | |
241 *b = 0; | |
242 return; | |
2760 | 243 } |
244 | |
245 void | |
3753 | 246 drct_set_volume_balance ( gint b ) |
2760 | 247 { |
4542 | 248 gint v, vl, vr; |
249 if (b < -100) | |
250 b = -100; | |
251 if (b > 100) | |
252 b = 100; | |
253 drct_get_volume_main(&v); | |
254 if (b < 0) { | |
255 vl = v; | |
256 vr = (v * (100 - abs(b))) / 100; | |
257 } | |
258 else if (b > 0) { | |
259 vl = (v * (100 - b)) / 100; | |
260 vr = v; | |
261 } | |
262 else | |
263 { | |
264 vl = v; | |
265 vr = v; | |
266 } | |
267 drct_set_volume(vl, vr); | |
268 return; | |
2760 | 269 } |
270 | |
2742 | 271 |
272 /* playlist */ | |
273 | |
274 void | |
3753 | 275 drct_pl_next ( void ) |
2742 | 276 { |
4542 | 277 playlist_next(playlist_get_active()); |
278 return; | |
2742 | 279 } |
280 | |
281 void | |
3753 | 282 drct_pl_prev ( void ) |
2742 | 283 { |
4542 | 284 playlist_prev(playlist_get_active()); |
285 return; | |
2742 | 286 } |
2745 | 287 |
288 gboolean | |
3753 | 289 drct_pl_repeat_is_enabled( void ) |
2745 | 290 { |
291 return cfg.repeat; | |
292 } | |
293 | |
294 void | |
3753 | 295 drct_pl_repeat_toggle( void ) |
2745 | 296 { |
4542 | 297 mainwin_repeat_pushed(!cfg.repeat); |
298 return; | |
2745 | 299 } |
300 | |
301 gboolean | |
3753 | 302 drct_pl_repeat_is_shuffled( void ) |
2745 | 303 { |
304 return cfg.shuffle; | |
305 } | |
306 | |
307 void | |
3753 | 308 drct_pl_shuffle_toggle( void ) |
2745 | 309 { |
4542 | 310 mainwin_shuffle_pushed(!cfg.shuffle); |
311 return; | |
2745 | 312 } |
2748 | 313 |
314 gchar * | |
3753 | 315 drct_pl_get_title( gint pos ) |
2748 | 316 { |
317 return playlist_get_songtitle(playlist_get_active(), pos); | |
318 } | |
319 | |
320 gint | |
3753 | 321 drct_pl_get_time( gint pos ) |
2748 | 322 { |
323 return playlist_get_songtime(playlist_get_active(), pos); | |
324 } | |
325 | |
326 gint | |
3753 | 327 drct_pl_get_pos( void ) |
2748 | 328 { |
329 return playlist_get_position_nolock(playlist_get_active()); | |
330 } | |
331 | |
332 gchar * | |
3753 | 333 drct_pl_get_file( gint pos ) |
2748 | 334 { |
335 return playlist_get_filename(playlist_get_active(), pos); | |
336 } | |
2760 | 337 |
338 void | |
3753 | 339 drct_pl_add ( GList * list ) |
2760 | 340 { |
4542 | 341 GList *node = list; |
342 while ( node != NULL ) | |
343 { | |
344 playlist_add_url(playlist_get_active(), (gchar*)node->data); | |
345 node = g_list_next(node); | |
346 } | |
347 return; | |
2760 | 348 } |
349 | |
350 void | |
3753 | 351 drct_pl_clear ( void ) |
2760 | 352 { |
4542 | 353 playlist_clear(playlist_get_active()); |
354 mainwin_clear_song_info(); | |
355 return; | |
2760 | 356 } |
2775 | 357 |
358 | |
359 /* following functions are not tested yet. be careful. --yaz */ | |
360 void | |
3753 | 361 drct_pl_delete ( gint pos ) |
2775 | 362 { |
363 GDK_THREADS_ENTER(); | |
364 playlist_delete_index(playlist_get_active(), pos); | |
365 GDK_THREADS_LEAVE(); | |
366 } | |
367 | |
368 void | |
3753 | 369 drct_pl_set_pos( gint pos ) |
2775 | 370 { |
371 Playlist *playlist = playlist_get_active(); | |
372 if (pos < (guint)playlist_get_length(playlist)) | |
373 playlist_set_position(playlist, pos); | |
374 } | |
375 | |
376 gint | |
3753 | 377 drct_pl_get_length( void ) |
2775 | 378 { |
379 return playlist_get_length(playlist_get_active()); | |
380 } | |
381 | |
382 void | |
3753 | 383 drct_pl_ins_url_string( gchar * string, gint pos ) |
2775 | 384 { |
385 playlist_ins_url(playlist_get_active(), string, pos); | |
386 } | |
387 | |
388 void | |
3753 | 389 drct_pl_add_url_string( gchar * string ) |
2775 | 390 { |
391 GDK_THREADS_ENTER(); | |
392 playlist_add_url(playlist_get_active(), string); | |
393 GDK_THREADS_LEAVE(); | |
394 } | |
395 | |
396 void | |
3753 | 397 drct_pl_enqueue_to_temp( gchar * string ) |
2775 | 398 { |
399 Playlist *new_pl = playlist_new(); | |
400 | |
401 GDK_THREADS_ENTER(); | |
402 playlist_select_playlist(new_pl); | |
403 playlist_add_url(new_pl, string); | |
404 GDK_THREADS_LEAVE(); | |
405 } | |
406 | |
407 | |
408 /* playqueue */ | |
409 gint | |
3753 | 410 drct_pq_get_length( void ) |
2775 | 411 { |
412 return playlist_queue_get_length(playlist_get_active()); | |
413 } | |
414 | |
415 void | |
3753 | 416 drct_pq_add( gint pos ) |
2775 | 417 { |
418 Playlist *playlist = playlist_get_active(); | |
419 if (pos < (guint)playlist_get_length(playlist)) | |
420 playlist_queue_position(playlist, pos); | |
421 } | |
422 | |
423 void | |
3753 | 424 drct_pq_remove( gint pos ) |
2775 | 425 { |
426 Playlist *playlist = playlist_get_active(); | |
427 if (pos < (guint)playlist_get_length(playlist)) | |
428 playlist_queue_remove(playlist_get_active(), pos); | |
429 } | |
430 | |
431 void | |
3753 | 432 drct_pq_clear( void ) |
2775 | 433 { |
434 playlist_clear_queue(playlist_get_active()); | |
435 } | |
436 | |
437 gboolean | |
3753 | 438 drct_pq_is_queued( gint pos ) |
2775 | 439 { |
440 return playlist_is_position_queued(playlist_get_active(), pos); | |
441 } | |
442 | |
443 gint | |
3753 | 444 drct_pq_get_position( gint pos ) |
2775 | 445 { |
446 return playlist_get_queue_position_number(playlist_get_active(), pos); | |
447 } | |
448 | |
449 gint | |
3753 | 450 drct_pq_get_queue_position( gint pos ) |
2775 | 451 { |
452 return playlist_get_queue_position_number(playlist_get_active(), pos); | |
453 } | |
2785 | 454 |