source: abuse/trunk/src/sdlport/sound.h @ 551

Last change on this file since 551 was 551, checked in by Sam Hocevar, 10 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
21int sound_init(int argc, char **argv);
22void sound_uninit();
23void print_sound_options(); // print the options avaible for sound
24
25class sound_effect
26{
27public:
28    sound_effect(char *filename);
29    void play(int volume = 127, int pitch = 128, int panpot = 128);
30    ~sound_effect();
31
32private:
33    void *data;
34    Mix_Chunk* chunk;
35    int size;
36};
37
38class song
39{
40public:
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
49private:
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.