15typedef struct _Mix_Music Mix_Music;
66 int playsound(
int n,
const vec *loc =
nullptr,
extentity *ent =
nullptr,
int flags = 0,
int loops = 0,
int fade = 0,
int chanid = -1,
int radius = 0,
int expire = -1);
105 int playsoundname(
const char *s,
const vec *loc,
int vol,
int flags,
int loops,
int fade,
int chanid,
int radius,
int expire);
300 int maxsoundradius = 340;
303 void reclaimchannels();
305 bool minimizedsounds =
false;
306 int getminimizedsounds();
307 void setminimizedsounds(
int minimize);
309 void stopmapsounds();
311 void checkmapsounds();
315 int maxsoundsatonce = 7;
316 int getmaxsoundsatonce();
317 void setmaxsoundsatonce(
const int *num);
324 SoundEngine *
const parent;
328 SoundSample(SoundEngine& p);
333 bool load(
const char *dir);
347 bool hasslot(
const soundslot *p,
const std::vector<soundslot> &v)
const;
349 int chooseslot(
int flags)
const;
359 const soundslot *slot;
363 SoundChannel(
int id, SoundEngine& p);
365 bool updatechannel();
367 void setupchannel(
int n,
const soundslot *slot,
const vec *loc, extentity *ent,
int flags,
int radius);
369 void setloc(
const vec& newloc);
376 SoundEngine *
const parent;
378 int radius, pan, flags;
383 std::vector<SoundChannel> channels;
390 bool shouldinitaudio =
true;
393 #define AUDIODRIVER "directsound winmm"
395 #define AUDIODRIVER "pulseaudio alsa arts esd jack pipewire dsp"
398 std::string audiodriver = AUDIODRIVER;
404 int soundfreq = 44100;
406 int soundbufferlen = 1024;
412 SoundEngine *
const parent;
413 std::map<std::string, SoundSample> samples;
414 std::vector<soundslot> slots;
415 std::vector<SoundConfig> configs;
417 SoundType(
const char *dir, SoundEngine& p);
418 int findsound(
const char *name,
int vol);
419 int addslot(
const char *name,
int vol);
420 int addsound(
const char *name,
int vol,
int maxuses = 0);
421 void addalt(
const char *name,
int vol);
424 void cleanupsamples();
426 void preloadsound(
int n);
427 bool playing(
const SoundChannel &chan,
const SoundConfig &config)
const;
429 SoundType gamesounds;
433 void resetchannels();
436 Mix_Music *loadmusic(
const char *name);
437 Mix_Chunk *loadwav(
const char *name);
440 SoundChannel &newchannel(
int n,
const soundslot *slot,
const vec *loc =
nullptr, extentity *ent =
nullptr,
int flags = 0,
int radius = 0);
443 void freechannel(
int n);
449 char *musicfile =
nullptr,
450 *musicdonecmd =
nullptr;
452 Mix_Music *music =
nullptr;
453 SDL_RWops *musicrw =
nullptr;
454 stream *musicstream =
nullptr;
void altmapsound(char *name, int *vol)
Adds an alternative map sound.
void setmusicvol(const int *musicvol)
Sets the music sound volume.
void setsoundvol(const int *vol)
Sets the map sound volume.
void clear_sound()
Shuts down sound system.
void mapsound(char *name, int *vol, int *maxuses)
Adds a sound to the list of map sounds.
void setmaxradius(const int *const dist)
Sets the maximum radius to play sounds from.
void preloadsound(int n)
Loads the approriate sound file at the given index.
void soundreset()
Resets the loaded game sounds.
int playsound(int n, const vec *loc=nullptr, extentity *ent=nullptr, int flags=0, int loops=0, int fade=0, int chanid=-1, int radius=0, int expire=-1)
Plays a sound with the given attributes.
void preloadmapsounds()
Loads the sounds for every element in the map sounds vector.
int getsoundchans()
Returns the number of sound channels in use.
void nummapsounds()
Returns to the console the number of map sounds loaded.
void setaudiodriver(char *f)
Sends a list of audio subsystems for SDL to bind to.
int getsoundvol()
Returns the current sound volume.
void numsounds()
Returns to the console the number of game sounds loaded.
void startmusic(char *name, char *cmd)
Starts a nonpositional music track.
int getmusicvol()
Returns the current music volume.
int getsound()
Returns whether sound is on.
int playsoundname(const char *s, const vec *loc, int vol, int flags, int loops, int fade, int chanid, int radius, int expire)
Plays a sound with the given attributes.
void setsoundchans(const int *const val)
Sets the number of sound channels to use.
void stopsounds()
Immediately kills all active sounds.
void initsound()
Starts SDL_Mixer and initializes startup sound channels.
void setstereo(const int *const on)
Sets whether stereo audio is enabled.
void setsound(const int *on)
Sets whether the sound engine is enabled.
void mapsoundreset()
Resets the loaded map sounds.
void updatesounds()
Restarts and updates all sound indices.
int getstereo()
Returns whether stereo or mono is enabled.
void altsound(char *name, int *vol)
Adds an alternative game sound.
void registersound(char *name, int *vol)
Adds a sound to the sound list at a given volume.
bool stopsound(int n, int chanid, int fade)
Stops playing a sound of index n in the specificied channel.
void resetsound()
Resets the sound subsystem.
int getmaxradius()
Returns the maximum sound play radius.
Extended entity data not of the subset which is saved to disk.
Definition ents.h:93
three dimensional Cartesian vector object
Definition geom.h:207