comparison src/audacious/auddrct.c @ 2739:953001c668ae trunk

[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
author giacomo
date Fri, 11 May 2007 16:27:54 -0700
parents
children 1333d28e2c50
comparison
equal deleted inserted replaced
2738:1eb06f902923 2739:953001c668ae
1 /*
2 * Audacious: A cross-platform multimedia player
3 * Copyright (c) 2007 Giacomo Lozito
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 /* audacious_drct_* provides a handy interface for player
21 plugins, originally intended for migration from xmms_remote_* calls */
22
23
24 #include "input.h"
25 #include "playback.h"
26 #include "ui_main.h"
27
28
29 /* playback */
30
31 void
32 audacious_drct_play ( void )
33 {
34 if (playback_get_paused())
35 playback_pause();
36 else if (playlist_get_length(playlist_get_active()))
37 playback_initiate();
38 else
39 mainwin_eject_pushed();
40 return;
41 }
42
43 void
44 audacious_drct_pause ( void )
45 {
46 playback_pause();
47 return;
48 }
49
50 void
51 audacious_drct_stop ( void )
52 {
53 ip_data.stop = TRUE;
54 playback_stop();
55 ip_data.stop = FALSE;
56 mainwin_clear_song_info();
57 return;
58 }
59
60 gboolean
61 audacious_drct_get_playing ( void )
62 {
63 return playback_get_playing();
64 }
65
66 gboolean
67 audacious_drct_get_paused ( void )
68 {
69 return playback_get_paused();
70 }
71
72 gboolean
73 audacious_drct_get_stopped ( void )
74 {
75 return !playback_get_playing();
76 }
77
78 gint
79 audacious_drct_get_time ( void )
80 {
81 gint time;
82 if (playback_get_playing())
83 time = playback_get_time();
84 else
85 time = 0;
86 return time;
87 }
88
89 void
90 audacious_drct_seek ( guint pos )
91 {
92 if (playlist_get_current_length(playlist_get_active()) > 0 &&
93 pos < (guint)playlist_get_current_length(playlist_get_active()))
94 playback_seek(pos / 1000);
95 return;
96 }
97
98 void
99 audacious_drct_get_volume( gint *vl, gint *vr )
100 {
101 input_get_volume(vl, vr);
102 return;
103 }
104
105 void
106 audacious_drct_set_volume( gint vl, gint vr )
107 {
108 if (vl > 100)
109 vl = 100;
110 if (vr > 100)
111 vr = 100;
112 input_set_volume(vl, vr);
113 return;
114 }
115