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

Last change on this file since 534 was 534, checked in by Sam Hocevar, 11 years ago

imlib: remove a lot of dead code, especially from the linked list and
the WAV reader.

  • Property svn:keywords set to Id
File size: 1.3 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#ifdef USE_SDL_MIXER
15#   include <SDL/SDL_mixer.h>
16#endif
17
18/* options are passed via command line */
19
20#define SFX_INITIALIZED    1
21#define MUSIC_INITIALIZED  2
22
23int sound_init(int argc, char **argv);
24void sound_uninit();
25void print_sound_options(); // print the options avaible for sound
26
27class sound_effect
28{
29public:
30    sound_effect(char *filename);
31    void play(int volume = 127, int pitch = 128, int panpot = 128);
32    ~sound_effect();
33
34private:
35    void *data;
36#ifdef USE_SDL_MIXER
37    Mix_Chunk* chunk;
38#endif
39    int size;
40};
41
42class song
43{
44public:
45    char const *name() { return Name; }
46    song(char const *filename);
47    void play(unsigned char volume=127);
48    void stop(long fadeout_time=0); // time in ms
49    int playing();
50    void set_volume(int volume);
51    ~song();
52
53private:
54    char *Name;
55    unsigned char *data;
56    unsigned long song_id;
57#ifdef USE_SDL_MIXER
58    Mix_Music* music;
59    SDL_RWops* rw;
60#endif
61};
62
63#endif
64
Note: See TracBrowser for help on using the repository browser.