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

Last change on this file since 552 was 552, checked in by Sam Hocevar, 10 years ago

sdlport: use SDL_Mixer to read samples, and get rid of imlib's readwav.

  • 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 const *filename);
29    ~sound_effect();
30
31    void play(int volume = 127, int pitch = 128, int panpot = 128);
32
33private:
34    Mix_Chunk* m_chunk;
35};
36
37class song
38{
39public:
40    char const *name() { return Name; }
41    song(char const *filename);
42    void play(unsigned char volume=127);
43    void stop(long fadeout_time=0); // time in ms
44    int playing();
45    void set_volume(int volume);
46    ~song();
47
48private:
49    char *Name;
50    unsigned char *data;
51    unsigned long song_id;
52    Mix_Music* music;
53    SDL_RWops* rw;
54};
55
56#endif
57
Note: See TracBrowser for help on using the repository browser.