source: abuse/trunk/src/sdlport/sound.hpp @ 479

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

sdlport: add music playback support through SDL_Mixer, courtesy of
Jochen Schleu.

File size: 1.2 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *
5 *  This software was released into the Public Domain. As with most public
6 *  domain software, no warranty is made or implied by Crack dot Com or
7 *  Jonathan Clark.
8 */
9
10#ifndef __SOUND_HPP_
11#define __SOUND_HPP_
12
13#ifdef USE_SDL_MIXER
14#include <SDL/SDL_mixer.h>
15#endif
16
17/* options are passed via command line */
18
19#define SFX_INITIALIZED    1
20#define MUSIC_INITIALIZED  2
21
22int sound_init(int argc, char **argv);
23void sound_uninit();
24void print_sound_options();                         // print the options avaible for sound
25
26class sound_effect
27{
28  long size;
29  void *data;
30#ifdef USE_SDL_MIXER
31  Mix_Chunk* chunk;
32#endif
33public :
34  sound_effect(char *filename);
35  void play(int volume=127, int pitch=128, int panpot=128);
36  ~sound_effect();
37} ;
38
39
40class song
41{
42  char *Name;
43  unsigned char *data;
44  unsigned long song_id;
45#ifdef USE_SDL_MIXER
46  Mix_Music* music;
47  SDL_RWops* rw;
48#endif
49public :
50  char const *name() { return Name; }
51  song(char const *filename);
52  void play(unsigned char volume=127);
53  void stop(long fadeout_time=0);                                        // time in ms
54  int playing();
55  void set_volume(int volume);
56  ~song();
57} ;
58#endif
59
60
61
62
63
64
65
66
67
68
69
Note: See TracBrowser for help on using the repository browser.