1 //copyright (c) 2006 by tarn adams
3 #define SOUND_CHANNELNUM 16
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
22 FMOD::Channel
*channel
;
30 enum linux_sound_system
{
36 int SoftChannelNumber
;
38 musicsoundst() : song(-1), system(NULL
), masterchannelgroup(NULL
), sound_system(ALSA
)
41 for (s
= 0; s
< MAXSONGNUM
; s
++) {
43 mod
[s
].channel
= NULL
;
46 for (s
= 0; s
< MAXSOUNDNUM
; s
++) {
48 samp
[s
].channel
= NULL
;
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
);
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
);
67 masterchannelgroup
->stop();
69 void set_master_volume(long newvol
);
78 void set_sound_system(musicsoundst::linux_sound_system system
) {
79 sound_system
= system
;
83 float oldval_to_volumefloat(int val
);
84 float oldval_to_panfloat(int val
);
85 int oldval_to_priority(int val
);
95 FMOD::ChannelGroup
*masterchannelgroup
;
96 fmodSound mod
[MAXSONGNUM
];
97 fmodSound samp
[MAXSOUNDNUM
];
99 musicsoundst::linux_sound_system sound_system
;