added summerhack
[summerhack] / src / sdlvf / sdlvf.h
1 /*
2  * sdlvf - the SDL/vorbisfile sound system
3  * Copyright (C) 2004  Vasilis Vasaitis <vvas@hal.csd.auth.gr>
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,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU 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  USA
18  */
19
20 #ifndef _SDLVF_H
21 #define _SDLVF_H
22
23 /*
24  * All the possible return values of sdlvf_init() and sdlvf_check().
25  */
26 enum {
27         SDLVF_PLAYING,              /* no error, playing file */
28         SDLVF_STOPPED,              /* no error, playback has stopped */
29         SDLVF_BADFILE,              /* could not open file specified */
30         SDLVF_BADOGG,               /* file specified is not valid */
31         SDLVF_BADSTREAM,            /* could not query current stream */
32         SDLVF_NOAUDIO               /* could not open audio device */
33 };
34
35 /*
36  * Make sure that everything works under C++ as well.
37  */
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 /*
43  * Initialises the SDL/vorbisfile sound system. The audio subsystem of
44  * SDL must have been initialised before calling this function. On
45  * success, the Ogg Vorbis file specified is played, and zero
46  * (SDLVF_PLAYING) is returned. On error, the appropriate error code
47  * is returned.
48  */
49 int sdlvf_init(const char *);
50
51 /*
52  * This function should be called regularly, i.e. multiple times per
53  * second. It makes sure that everything is going as it should. It
54  * also checks whether playback has ended, returning the appropriate
55  * value if this is the case.
56  */
57 int sdlvf_check(void);
58
59 /*
60  * Seeks to the specified position in seconds.
61  */
62 int sdlvf_seek(double);
63
64 /*
65  * Stops playback and shuts down the sound system.
66  */
67 void sdlvf_done(void);
68
69 /*
70  * Returns the equivalent error string for the supplied error code.
71  */
72 char *sdlvf_strerror(int);
73
74 /*
75  * Close the C++-supporting block if needed.
76  */
77 #ifdef __cplusplus
78 }
79 #endif
80
81 #endif /* !defined(_SDLVF_H) */