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);
332 bool load(
const char *dir);
346 bool hasslot(
const soundslot *p,
const std::vector<soundslot> &v)
const;
348 int chooseslot(
int flags)
const;
358 const soundslot *slot;
362 SoundChannel(
int id, SoundEngine& p);
364 bool updatechannel();
366 void setupchannel(
const soundslot *slot,
const vec *loc, extentity *ent,
int radius);
368 void setloc(
const vec& newloc);
375 SoundEngine *
const parent;
377 int radius, pan, flags;
382 std::vector<SoundChannel> channels;
389 bool shouldinitaudio =
true;
392 #define AUDIODRIVER "directsound winmm"
394 #define AUDIODRIVER "pulseaudio alsa arts esd jack pipewire dsp"
397 std::string audiodriver = AUDIODRIVER;
403 int soundfreq = 44100;
405 int soundbufferlen = 1024;
411 SoundEngine *
const parent;
412 std::map<std::string, SoundSample> samples;
413 std::vector<soundslot> slots;
414 std::vector<SoundConfig> configs;
416 SoundType(
const char *dir, SoundEngine& p);
417 int findsound(
const char *name,
int vol);
418 int addslot(
const char *name,
int vol);
419 int addsound(
const char *name,
int vol,
int maxuses = 0);
420 void addalt(
const char *name,
int vol);
423 void cleanupsamples();
425 void preloadsound(
int n);
426 bool playing(
const SoundChannel &chan,
const SoundConfig &config)
const;
428 SoundType gamesounds;
432 void resetchannels();
435 Mix_Music *loadmusic(
const char *name);
436 Mix_Chunk *loadwav(
const char *name);
439 SoundChannel &newchannel(
int n,
const soundslot *slot,
const vec *loc =
nullptr, extentity *ent =
nullptr,
int radius = 0);
442 void freechannel(
int n);
448 char *musicfile =
nullptr,
449 *musicdonecmd =
nullptr;
451 Mix_Music *music =
nullptr;
452 SDL_RWops *musicrw =
nullptr;
453 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