chiark / gitweb /
Merge from 3.0 branch
[disorder] / server / play.h
1 /*
2  * This file is part of DisOrder.
3  * Copyright (C) 2004-2008 Richard Kettlewell
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; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA
19  */
20
21 #ifndef PLAY_H
22 #define PLAY_H
23
24 extern struct queue_entry *playing;     /* playing track or 0 */
25 extern int paused;                      /* non-0 if paused */
26
27 void play(ev_source *ev);
28 /* try to play something, if playing is enabled and nothing is playing
29  * already */
30
31 int playing_is_enabled(void);
32 /* return true iff playing is enabled */
33
34 void enable_playing(const char *who, ev_source *ev);
35 /* enable playing */
36
37 void disable_playing(const char *who);
38 /* disable playing. */
39
40 int random_is_enabled(void);
41 /* return true iff random play is enabled */
42
43 void enable_random(const char *who, ev_source *ev);
44 /* enable random play */
45
46 void disable_random(const char *who);
47 /* disable random play */
48
49 void scratch(const char *who, const char *id);
50 /* scratch the playing track.  @who@ identifies the scratcher. @id@ is
51  * the ID or a null pointer. */
52
53 void quitting(ev_source *ev);
54 /* called to terminate current track and shut down speaker process
55  * when quitting */
56
57 void speaker_setup(ev_source *ev);
58 /* set up the speaker subprocess */
59
60 void speaker_reload(void);
61 /* Tell the speaker process to reload its configuration. */
62
63 int pause_playing(const char *who);
64 /* Pause the current track.  Return 0 on success, -1 on error.  WHO
65  * can be 0. */
66
67 void resume_playing(const char *who);
68 /* Resume after a pause.  WHO can be 0. */
69
70 int prepare(ev_source *ev,
71             struct queue_entry *q);
72 /* Prepare to play Q */
73
74 void abandon(ev_source *ev,
75              struct queue_entry *q);
76 /* Abandon a possibly-prepared track. */
77
78 void add_random_track(ev_source *ev);
79 /* If random play is enabled then try to add a track to the queue. */
80
81 #endif /* PLAY_H */
82
83 /*
84 Local Variables:
85 c-basic-offset:2
86 comment-column:40
87 fill-column:79
88 End:
89 */