1 #ifndef MUSIC_AND_SOUND_OPENAL_H
2 #define MUSIC_AND_SOUND_OPENAL_H
8 // Fixes sndfile.h, until the bug is properly fixed
10 #include <sys/types.h>
12 typedef int64_t __int64
;
15 // END HACKY HACKY HACK
24 #define SOUND_CHANNELNUM 16
26 // Preferred mixer frequency. Should be the same as what the ogg files
27 // use, to avoid resampling.
28 #define SOUND_FREQUENCY 44100
30 // If the bool is false, a sound; otherwise a song
31 typedef std::pair
<bool,int> slot
;
36 bool initsound(); // Returns false if it failed
38 void set_master_volume(long newvol
);
40 void set_song(std::string
&filename
, slot slot
);
41 void set_song(std::string
&filename
, int slot
);
42 void playsound(slot slot
);
43 void playsound(int slot
); // Assumes sound
45 void startbackgroundmusic(slot slot
);
46 void startbackgroundmusic(int slot
); // Assumes song
47 void stopbackgroundmusic();
49 void stop_sound(slot slot
);
50 void playsound(int s
,int channel
);
51 void set_sound(std::string
&filename
,int slot
,int pan
=-1,int priority
=0);
55 void forcebackgroundmusic(int slot
, unsigned long time
);
56 void playsound(int s
,int min_channel
,int max_channel
,int force_channel
);
57 void set_sound_params(int slot
,int p1
,int vol
,int pan
,int priority
);
61 background_slot
= slot(false,-1);
73 std::map
<std::string
,ALuint
> buffers
; // OpenAL buffers
74 std::map
<std::string
,ALuint
> sources
; // And sources
75 std::map
<slot
, ALuint
> slot_buffer
; // Mappings from DF slots to openal
76 std::map
<slot
, ALuint
> slot_source
;
78 slot background_slot
; // Currently playing background music, or -1