Work on music, midi, and seq interfaces.
[cantaveria.git] / music.h
blob3346e5a2862a9b660686c5b76914829755c36ff5
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_id;
30 int music_load(char* filename, mus_id id);
31 void music_unload(mus_id id);
32 mus_id music_current();
34 void music_play(mus_id id);
35 void music_stop(mus_id id);
36 void music_pause();
38 void music_volume(int precent);
39 void music_fadeout(int seconds);
41 void music_debug();
44 the music player
46 int music_load(filename, id)
47 Attempts to load song in filename into song slot id. Returns
48 0 if successful and -1 otherwise. If there is a song already
49 in slot id, it will fail.
51 void music_unload(id)
52 unloads the song in slot id. if no song is in that position
53 the call fails silently. after this operation you can
54 load a new song in that position.
56 id music_current()
57 return the id of the currently playing song.
59 void music_play(id)
60 play the song with id id. if there is no such song loaded, the
61 operation will fail silently. if there is such a song but another
62 is playing, that song will be paused immediately.
64 void music_stop(id)
65 stop and reset the song with id id. if there is no such song, the
66 operation will fail silently. if the song is currently playing, it
67 will be stopped immediately.
69 void music_pause()
70 pause the currently playing song. if no song is playing, fails
71 silently. after pausing, music_play on that song will resume at
72 the previous position.
74 void music_volume(percent)
75 additional volume adjustment for all songs.
77 void music_fadeout(seconds)
78 fade out the current song over seconds seconds. if the fade out
79 completes, the song is stopped and reset. fadeout can be cancelled
80 by music_play on any song, music_stop on the current song, another
81 calls to music_fadeout, or music_pause. in this case the fade is
82 cancelled and reset. basically any call to fadeout will cause a
83 new fadeout effect.