Changed printf to error_msg.
[cantaveria.git] / music.h
blob813e9bf301014494909fafcb7a3432283cb697f9
1 /*
2 Cantaveria - action adventure platform game
3 Copyright (C) 2009 2010 Evan Rinehart
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
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.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to
18 The Free Software Foundation, Inc.
19 51 Franklin Street, Fifth Floor
20 Boston, MA 02110-1301, USA
22 evanrinehart@gmail.com
25 typedef enum {
26 MUS_NOTHING,
27 MUS_COOL,
28 MUS_TEST1
29 } mus_id;
31 int music_load(char* filename, mus_id id);
32 void music_unload(mus_id id);
33 mus_id music_current();
35 void music_play(mus_id id);
36 void music_stop(mus_id id);
37 void music_pause();
39 void music_volume(int precent);
40 void music_fadeout(int seconds);
42 void music_print(mus_id id);
43 void music_debug();
46 the music player
48 int music_load(filename, id)
49 Attempts to load song in filename into song slot id. Returns
50 0 if successful and -1 otherwise. If there is a song already
51 in slot id, it will fail.
53 void music_unload(id)
54 unloads the song in slot id. if no song is in that position
55 the call fails silently. after this operation you can
56 load a new song in that position.
58 id music_current()
59 return the id of the currently playing song.
61 void music_play(id)
62 play the song with id id. if there is no such song loaded, the
63 operation will fail silently. if there is such a song but another
64 is playing, that song will be paused immediately.
66 void music_stop(id)
67 stop and reset the song with id id. if there is no such song, the
68 operation will fail silently. if the song is currently playing, it
69 will be stopped immediately.
71 void music_pause()
72 pause the currently playing song. if no song is playing, fails
73 silently. after pausing, music_play on that song will resume at
74 the previous position.
76 void music_volume(percent)
77 additional volume adjustment for all songs.
79 void music_fadeout(seconds)
80 fade out the current song over seconds seconds. if the fade out
81 completes, the song is stopped and reset. fadeout can be cancelled
82 by music_play on any song, music_stop on the current song, another
83 calls to music_fadeout, or music_pause. in this case the fade is
84 cancelled and reset. basically any call to fadeout will cause a
85 new fadeout effect.