Last change
on this file since 551 was
551,
checked in by Sam Hocevar, 12 years ago
|
sdlport: make SDL_mixer mandatory. I'm not going to maintain legacy code
that cannot even play music.
|
-
Property svn:keywords set to
Id
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * Abuse - dark 2D side-scrolling platform game |
---|
3 | * Copyright (c) 1995 Crack dot Com |
---|
4 | * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> |
---|
5 | * |
---|
6 | * This software was released into the Public Domain. As with most public |
---|
7 | * domain software, no warranty is made or implied by Crack dot Com or |
---|
8 | * Jonathan Clark. |
---|
9 | */ |
---|
10 | |
---|
11 | #ifndef __SOUND_H__ |
---|
12 | #define __SOUND_H__ |
---|
13 | |
---|
14 | #include <SDL/SDL_mixer.h> |
---|
15 | |
---|
16 | /* options are passed via command line */ |
---|
17 | |
---|
18 | #define SFX_INITIALIZED 1 |
---|
19 | #define MUSIC_INITIALIZED 2 |
---|
20 | |
---|
21 | int sound_init(int argc, char **argv); |
---|
22 | void sound_uninit(); |
---|
23 | void print_sound_options(); // print the options avaible for sound |
---|
24 | |
---|
25 | class sound_effect |
---|
26 | { |
---|
27 | public: |
---|
28 | sound_effect(char *filename); |
---|
29 | void play(int volume = 127, int pitch = 128, int panpot = 128); |
---|
30 | ~sound_effect(); |
---|
31 | |
---|
32 | private: |
---|
33 | void *data; |
---|
34 | Mix_Chunk* chunk; |
---|
35 | int size; |
---|
36 | }; |
---|
37 | |
---|
38 | class song |
---|
39 | { |
---|
40 | public: |
---|
41 | char const *name() { return Name; } |
---|
42 | song(char const *filename); |
---|
43 | void play(unsigned char volume=127); |
---|
44 | void stop(long fadeout_time=0); // time in ms |
---|
45 | int playing(); |
---|
46 | void set_volume(int volume); |
---|
47 | ~song(); |
---|
48 | |
---|
49 | private: |
---|
50 | char *Name; |
---|
51 | unsigned char *data; |
---|
52 | unsigned long song_id; |
---|
53 | Mix_Music* music; |
---|
54 | SDL_RWops* rw; |
---|
55 | }; |
---|
56 | |
---|
57 | #endif |
---|
58 | |
---|
Note: See
TracBrowser
for help on using the repository browser.