pick up CXXFLAGS passed on commandline
[rofl0r-df-libgraphics.git] / g_src / music_and_sound_fmodex.h
blob444d555421822b4e51b28ad969d14d4866acecb9
1 //copyright (c) 2006 by tarn adams
3 #define SOUND_CHANNELNUM 16
5 #include <string>
6 #include <map>
8 #ifndef NO_FMOD
10 #include <fmod.hpp>
11 #include <fmod_errors.h>
13 /* The maximums can be no larger than the largest value
14 * of a signed integer.
16 #define MAXSONGNUM 1000
17 #define MAXSOUNDNUM 1000
18 #define FSOUND_STEREOPAN 0
20 struct fmodSound {
21 FMOD::Sound *sound;
22 FMOD::Channel *channel;
27 class musicsoundst
29 public:
30 enum linux_sound_system {
31 ALSA,
32 OSS,
33 ESD,
36 int SoftChannelNumber;
38 musicsoundst() : song(-1), system(NULL), masterchannelgroup(NULL), sound_system(ALSA)
40 int s;
41 for (s = 0; s < MAXSONGNUM; s++) {
42 mod[s].sound = NULL;
43 mod[s].channel = NULL;
46 for (s = 0; s < MAXSOUNDNUM; s++) {
47 samp[s].sound = NULL;
48 samp[s].channel = NULL;
51 ~musicsoundst()
53 deinitsound();
56 void startbackgroundmusic(int new_song);
57 void stopbackgroundmusic();
58 void playsound(int s,int channel=-1);
59 void playsound(int s,int min_channel,int max_channel,int force_channel);
60 void initsound();
61 void deinitsound();
62 void set_song(string &filename,int slot);
63 void set_sound(string &filename,int slot,int pan=-1,int priority=0);
64 void set_sound_params(int slot,int p1,int vol,int pan,int priority);
65 void stop_sound(int channel);
66 void stop_sound() {
67 masterchannelgroup->stop();
69 void set_master_volume(long newvol);
70 void update() {
71 if (!on) {
72 return;
75 system->update();
78 void set_sound_system(musicsoundst::linux_sound_system system) {
79 sound_system = system;
82 private:
83 float oldval_to_volumefloat(int val);
84 float oldval_to_panfloat(int val);
85 int oldval_to_priority(int val);
87 int song;
88 char musicactive;
89 char soundpriority;
90 int soundplaying;
92 char on;
94 FMOD::System *system;
95 FMOD::ChannelGroup *masterchannelgroup;
96 fmodSound mod[MAXSONGNUM];
97 fmodSound samp[MAXSOUNDNUM];
99 musicsoundst::linux_sound_system sound_system;
101 #endif