Mercurial > audlegacy
annotate src/audacious/auddrct.c @ 2785:182aa34ae6c4 trunk
[svn] - implement some audacious-remote functions.
- implement some audacious-drct functions.
- make some command line options work. (this may incur very slow startup.)
- suppress warnings.
author | yaz |
---|---|
date | Tue, 22 May 2007 15:17:15 -0700 |
parents | 7adb736cb824 |
children | 2d915b3e3e52 |
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_show_jtf_box(void) | |
113 { | |
114 if (!has_x11_connection) | |
115 return; | |
116 ui_jump_to_track(); | |
117 } | |
118 | |
119 void audacious_drct_activate(void) | |
120 { | |
121 gtk_window_present(GTK_WINDOW(mainwin)); | |
122 } | |
2742 | 123 |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
124 /* playback */ |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
125 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
126 void |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
127 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
|
128 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
129 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
|
130 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
|
131 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
|
132 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
|
133 else |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
134 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
|
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_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
|
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 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
|
142 return; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
143 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
144 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
145 void |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
146 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
|
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 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
|
149 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
|
150 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
|
151 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
|
152 return; |
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 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
155 gboolean |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
156 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
|
157 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
158 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
|
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 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
161 gboolean |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
162 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
|
163 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
164 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
|
165 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
166 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
167 gboolean |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
168 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
|
169 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
170 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
|
171 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
172 |
2748 | 173 void |
174 audacious_drct_get_info( gint *rate, gint *freq, gint *nch) | |
175 { | |
176 playback_get_sample_params(rate, freq, nch); | |
177 } | |
178 | |
2739
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
179 gint |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
180 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
|
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 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
|
183 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
|
184 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
|
185 else |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
186 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
|
187 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
|
188 } |
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 void |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
191 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
|
192 { |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
193 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
|
194 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
|
195 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
|
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_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
|
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 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
|
203 return; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
204 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
205 |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
206 void |
2760 | 207 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
|
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 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
|
210 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
|
211 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
|
212 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
|
213 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
|
214 return; |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
215 } |
953001c668ae
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff
changeset
|
216 |
2760 | 217 void |
218 audacious_drct_get_volume_main( gint *v ) | |
219 { | |
220 gint vl, vr; | |
221 audacious_drct_get_volume(&vl, &vr); | |
222 *v = (vl > vr) ? vl : vr; | |
223 return; | |
224 } | |
225 | |
226 void | |
227 audacious_drct_set_volume_main ( gint v ) | |
228 { | |
229 gint b, vl, vr; | |
230 audacious_drct_get_volume_balance(&b); | |
231 if (b < 0) { | |
232 vl = v; | |
233 vr = (v * (100 - abs(b))) / 100; | |
234 } | |
235 else if (b > 0) { | |
236 vl = (v * (100 - b)) / 100; | |
237 vr = v; | |
238 } | |
239 else | |
240 vl = vr = v; | |
241 audacious_drct_set_volume(vl, vr); | |
242 } | |
243 | |
244 void | |
245 audacious_drct_get_volume_balance ( gint *b ) | |
246 { | |
247 gint vl, vr; | |
248 input_get_volume(&vl, &vr); | |
249 if (vl < 0 || vr < 0) | |
250 *b = 0; | |
251 else if (vl > vr) | |
252 *b = -100 + ((vr * 100) / vl); | |
253 else if (vr > vl) | |
254 *b = 100 - ((vl * 100) / vr); | |
255 else | |
256 *b = 0; | |
257 return; | |
258 } | |
259 | |
260 void | |
261 audacious_drct_set_volume_balance ( gint b ) | |
262 { | |
263 gint v, vl, vr; | |
264 if (b < -100) | |
265 b = -100; | |
266 if (b > 100) | |
267 b = 100; | |
268 audacious_drct_get_volume_main(&v); | |
269 if (b < 0) { | |
270 vl = v; | |
271 vr = (v * (100 - abs(b))) / 100; | |
272 } | |
273 else if (b > 0) { | |
274 vl = (v * (100 - b)) / 100; | |
275 vr = v; | |
276 } | |
277 else | |
278 { | |
279 vl = v; | |
280 vr = v; | |
281 } | |
282 audacious_drct_set_volume(vl, vr); | |
283 return; | |
284 } | |
285 | |
2742 | 286 |
287 /* playlist */ | |
288 | |
289 void | |
290 audacious_drct_pl_next ( void ) | |
291 { | |
292 playlist_next(playlist_get_active()); | |
293 return; | |
294 } | |
295 | |
296 void | |
297 audacious_drct_pl_prev ( void ) | |
298 { | |
299 playlist_prev(playlist_get_active()); | |
300 return; | |
301 } | |
2745 | 302 |
303 gboolean | |
304 audacious_drct_pl_repeat_is_enabled( void ) | |
305 { | |
306 return cfg.repeat; | |
307 } | |
308 | |
309 void | |
310 audacious_drct_pl_repeat_toggle( void ) | |
311 { | |
312 mainwin_repeat_pushed(!cfg.repeat); | |
313 return; | |
314 } | |
315 | |
316 gboolean | |
317 audacious_drct_pl_repeat_is_shuffled( void ) | |
318 { | |
319 return cfg.shuffle; | |
320 } | |
321 | |
322 void | |
323 audacious_drct_pl_shuffle_toggle( void ) | |
324 { | |
325 mainwin_shuffle_pushed(!cfg.shuffle); | |
326 return; | |
327 } | |
2748 | 328 |
329 gchar * | |
330 audacious_drct_pl_get_title( gint pos ) | |
331 { | |
332 return playlist_get_songtitle(playlist_get_active(), pos); | |
333 } | |
334 | |
335 gint | |
336 audacious_drct_pl_get_time( gint pos ) | |
337 { | |
338 return playlist_get_songtime(playlist_get_active(), pos); | |
339 } | |
340 | |
341 gint | |
342 audacious_drct_pl_get_pos( void ) | |
343 { | |
344 return playlist_get_position_nolock(playlist_get_active()); | |
345 } | |
346 | |
347 gchar * | |
348 audacious_drct_pl_get_file( gint pos ) | |
349 { | |
350 return playlist_get_filename(playlist_get_active(), pos); | |
351 } | |
2760 | 352 |
353 void | |
354 audacious_drct_pl_add ( GList * list ) | |
355 { | |
356 GList *node = list; | |
357 while ( node != NULL ) | |
358 { | |
359 playlist_add_url(playlist_get_active(), (gchar*)node->data); | |
360 node = g_list_next(node); | |
361 } | |
362 return; | |
363 } | |
364 | |
365 void | |
366 audacious_drct_pl_clear ( void ) | |
367 { | |
368 playlist_clear(playlist_get_active()); | |
369 mainwin_clear_song_info(); | |
370 mainwin_set_info_text(); | |
371 return; | |
372 } | |
2775 | 373 |
374 | |
375 /* following functions are not tested yet. be careful. --yaz */ | |
376 void | |
377 audacious_drct_pl_delete ( gint pos ) | |
378 { | |
379 GDK_THREADS_ENTER(); | |
380 playlist_delete_index(playlist_get_active(), pos); | |
381 GDK_THREADS_LEAVE(); | |
382 } | |
383 | |
384 void | |
385 audacious_drct_pl_set_pos( gint pos ) | |
386 { | |
387 Playlist *playlist = playlist_get_active(); | |
388 if (pos < (guint)playlist_get_length(playlist)) | |
389 playlist_set_position(playlist, pos); | |
390 } | |
391 | |
392 gint | |
393 audacious_drct_pl_get_length( void ) | |
394 { | |
395 return playlist_get_length(playlist_get_active()); | |
396 } | |
397 | |
398 void | |
399 audacious_drct_pl_ins_url_string( gchar * string, gint pos ) | |
400 { | |
401 playlist_ins_url(playlist_get_active(), string, pos); | |
402 } | |
403 | |
404 void | |
405 audacious_drct_pl_add_url_string( gchar * string ) | |
406 { | |
407 GDK_THREADS_ENTER(); | |
408 playlist_add_url(playlist_get_active(), string); | |
409 GDK_THREADS_LEAVE(); | |
410 } | |
411 | |
412 void | |
413 audacious_drct_pl_enqueue_to_temp( gchar * string ) | |
414 { | |
415 Playlist *new_pl = playlist_new(); | |
416 | |
417 GDK_THREADS_ENTER(); | |
418 playlist_select_playlist(new_pl); | |
419 playlist_add_url(new_pl, string); | |
420 GDK_THREADS_LEAVE(); | |
421 } | |
422 | |
423 | |
424 /* playqueue */ | |
425 gint | |
426 audacious_drct_pq_get_length( void ) | |
427 { | |
428 return playlist_queue_get_length(playlist_get_active()); | |
429 } | |
430 | |
431 void | |
432 audacious_drct_pq_add( gint pos ) | |
433 { | |
434 Playlist *playlist = playlist_get_active(); | |
435 if (pos < (guint)playlist_get_length(playlist)) | |
436 playlist_queue_position(playlist, pos); | |
437 } | |
438 | |
439 void | |
440 audacious_drct_pq_remove( gint pos ) | |
441 { | |
442 Playlist *playlist = playlist_get_active(); | |
443 if (pos < (guint)playlist_get_length(playlist)) | |
444 playlist_queue_remove(playlist_get_active(), pos); | |
445 } | |
446 | |
447 void | |
448 audacious_drct_pq_clear( void ) | |
449 { | |
450 playlist_clear_queue(playlist_get_active()); | |
451 } | |
452 | |
453 gboolean | |
454 audacious_drct_pq_is_queued( gint pos ) | |
455 { | |
456 return playlist_is_position_queued(playlist_get_active(), pos); | |
457 } | |
458 | |
459 gint | |
460 audacious_drct_pq_get_position( gint pos ) | |
461 { | |
462 return playlist_get_queue_position_number(playlist_get_active(), pos); | |
463 } | |
464 | |
465 gint | |
466 audaciuos_drct_pq_get_queue_position( gint pos ) | |
467 { | |
468 return playlist_get_queue_position_number(playlist_get_active(), pos); | |
469 } | |
2785 | 470 |