Xonotic
sound.qh File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Sound
 

Macros

#define _sound(e, c, s, v, a)   sound7(e, c, s, v, a, 0, 0)
 
#define extensions(x)
 
#define sound(e, c, s, v, a)   _sound(e, c, Sound_fixpath(s), v, a)
 
#define sound8(e, o, chan, samp, vol, atten, speed, sf)
 because sound7 didn't have origin More...
 
#define Sound_fixpath(this)
 
#define tryext(ext)
 

Functions

string _Sound_fixpath (string base)
 

Variables

string _Sound_fixpath_cached
 
entity _Sound_fixpath_this
 
const float ATTEN_IDLE = 2
 
const float ATTEN_LARGE = 1
 
const float ATTEN_LOW = 0.2
 
const float ATTEN_MAX = 3.984375
 
const float ATTEN_MIN = 0.015625
 
const float ATTEN_NONE = 0
 
const float ATTEN_NORM = 0.5
 
const float ATTEN_STATIC = 3
 
const int CH_AMBIENT = -9
 
const int CH_AMBIENT_SINGLE = 9
 
const int CH_BGM_SINGLE = 8
 
const int CH_INFO = 0
 
const int CH_PAIN = -6
 
const int CH_PAIN_SINGLE = 6
 
const int CH_PLAYER = -7
 
const int CH_PLAYER_SINGLE = 7
 
const int CH_SHOTS = -4
 
const int CH_SHOTS_SINGLE = 4
 
const int CH_TRIGGER = -3
 
const int CH_TRIGGER_SINGLE = 3
 
const int CH_TUBA_SINGLE = 5
 
const int CH_VOICE = -2
 
const int CH_WEAPON_A = -1
 
const int CH_WEAPON_B = -1
 
const int CH_WEAPON_SINGLE = 1
 
const float VOL_BASE = 0.7
 
const float VOL_BASEVOICE = 1.0
 
const float VOL_MUFFLED = 0.35
 

Macro Definition Documentation

◆ _sound

◆ extensions

#define extensions (   x)
Value:
x(wav) \
x(ogg) \
x(flac) \

Referenced by _Sound_fixpath().

◆ sound

◆ sound8

#define sound8 (   e,
  o,
  chan,
  samp,
  vol,
  atten,
  speed,
  sf 
)
Value:
MACRO_BEGIN \
entity __e; \
int __chan = chan; \
string __samp = samp; \
bool auto = false; \
if (__chan > 0) __e = e; \
else \
{ \
auto = true; \
__chan = fabs(__chan); \
entity tmp = __e = new(csqc_autochannel); \
setthink(tmp, SUB_Remove); \
tmp.nextthink = time + soundlength(__samp); \
} \
vector old_origin = __e.origin; \
vector old_mins = __e.mins; \
vector old_maxs = __e.maxs; \
setorigin(__e, o); \
setsize(__e, '0 0 0', '0 0 0'); \
sound7(__e, __chan, __samp, vol, atten, speed, sf); \
if (!auto) \
{ \
setorigin(__e, old_origin); \
setsize(__e, old_mins, old_maxs); \
} \
MACRO_END
float speed
Definition: subs.qh:41
float atten
Definition: triggers.qh:47
float time
Definition: csprogsdefs.qc:16

because sound7 didn't have origin

Parameters
esound owner
osound origin
chansound channel
sampsound filename
volsound volume
attensound attenuation
speed
sf

Definition at line 66 of file sound.qh.

◆ Sound_fixpath

#define Sound_fixpath (   this)
Value:
( \
_Sound_fixpath_this = (this), \
)
string _Sound_fixpath_cached
Definition: sound.qh:140
string _Sound_fixpath(string base)
Definition: sound.qh:94
entity _Sound_fixpath_this
Definition: sound.qh:139

Definition at line 141 of file sound.qh.

Referenced by dom_spawnteam(), Item_Touch(), and W_Reload().

◆ tryext

#define tryext (   ext)
Value:
{ \
string s = strcat(base, "." #ext); \
if (fexists(strcat("sound/", s))) { \
return s; \
} \
}
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
ERASEABLE bool fexists(string f)
Definition: file.qh:4

Referenced by _Sound_fixpath().

Function Documentation

◆ _Sound_fixpath()

string _Sound_fixpath ( string  base)

Definition at line 94 of file sound.qh.

References extensions, LOG_WARNF, strcat(), string_null, and tryext.

Referenced by Sound::Sound ::sound_precache().

95 {
96  if (base == "") return string_null;
97 #ifdef SVQC
98  return strcat(base, ".wav"); // let the client engine decide
99 #else
100 #define extensions(x) \
101  x(wav) \
102  x(ogg) \
103  x(flac) \
104 
105 #define tryext(ext) { \
106  string s = strcat(base, "." #ext); \
107  if (fexists(strcat("sound/", s))) { \
108  return s; \
109  } \
110  }
112  LOG_WARNF("Missing sound: \"%s\"", strcat("sound/", base));
113 #undef tryext
114 #undef extensions
115  return string_null;
116 #endif
117 }
string string_null
Definition: nil.qh:9
#define LOG_WARNF(...)
Definition: log.qh:67
#define tryext(ext)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
#define extensions(x)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ _Sound_fixpath_cached

string _Sound_fixpath_cached

Definition at line 140 of file sound.qh.

◆ _Sound_fixpath_this

entity _Sound_fixpath_this

Definition at line 139 of file sound.qh.

◆ ATTEN_IDLE

const float ATTEN_IDLE = 2

Definition at line 32 of file sound.qh.

Referenced by FireRailgunBullet(), and train_next().

◆ ATTEN_LARGE

const float ATTEN_LARGE = 1

Definition at line 31 of file sound.qh.

◆ ATTEN_LOW

const float ATTEN_LOW = 0.2

Definition at line 29 of file sound.qh.

◆ ATTEN_MAX

const float ATTEN_MAX = 3.984375

Definition at line 34 of file sound.qh.

◆ ATTEN_MIN

const float ATTEN_MIN = 0.015625

Definition at line 28 of file sound.qh.

Referenced by bot_cmd_sound(), and UpdatePlayerSounds().

◆ ATTEN_NONE

◆ ATTEN_NORM

◆ ATTEN_STATIC

const float ATTEN_STATIC = 3

Definition at line 33 of file sound.qh.

◆ CH_AMBIENT

const int CH_AMBIENT = -9

Definition at line 24 of file sound.qh.

◆ CH_AMBIENT_SINGLE

const int CH_AMBIENT_SINGLE = 9

Definition at line 25 of file sound.qh.

◆ CH_BGM_SINGLE

const int CH_BGM_SINGLE = 8

Definition at line 23 of file sound.qh.

◆ CH_INFO

const int CH_INFO = 0

◆ CH_PAIN

const int CH_PAIN = -6

◆ CH_PAIN_SINGLE

const int CH_PAIN_SINGLE = 6

Definition at line 19 of file sound.qh.

Referenced by NET_HANDLE().

◆ CH_PLAYER

const int CH_PLAYER = -7

Definition at line 20 of file sound.qh.

Referenced by DrownPlayer(), PlayerJump(), PM_check_hitground(), PM_dodging(), and PM_Footsteps().

◆ CH_PLAYER_SINGLE

const int CH_PLAYER_SINGLE = 7

Definition at line 21 of file sound.qh.

Referenced by CreatureFrame_hotliquids(), and PutPlayerInServer().

◆ CH_SHOTS

◆ CH_SHOTS_SINGLE

const int CH_SHOTS_SINGLE = 4

Definition at line 15 of file sound.qh.

Referenced by NET_HANDLE().

◆ CH_TRIGGER

◆ CH_TRIGGER_SINGLE

◆ CH_TUBA_SINGLE

const int CH_TUBA_SINGLE = 5

Definition at line 17 of file sound.qh.

◆ CH_VOICE

const int CH_VOICE = -2

◆ CH_WEAPON_A

const int CH_WEAPON_A = -1

◆ CH_WEAPON_B

const int CH_WEAPON_B = -1

Definition at line 8 of file sound.qh.

Referenced by bot_cmd_sound(), and FireGrapplingHook().

◆ CH_WEAPON_SINGLE

const int CH_WEAPON_SINGLE = 1

Definition at line 9 of file sound.qh.

Referenced by W_Reload(), and W_WeaponFrame().

◆ VOL_BASE

const float VOL_BASE = 0.7

Definition at line 36 of file sound.qh.

Referenced by basketball_touch(), bot_cmd_sound(), buff_Inferno_CalculateTime(), buff_Respawn(), buff_Think(), buff_Touch(), CheatImpulse(), CreatureFrame_hotliquids(), CSQCModel_Effects_Apply(), CSQCModel_Hook_PreDraw(), ctf_CheckFlagReturn(), ctf_FlagThink(), ctf_Handle_Capture(), ctf_Handle_Drop(), ctf_Handle_Pickup(), ctf_Handle_Retrieve(), ctf_Handle_Return(), ctf_Handle_Throw(), dompoint_captured(), door_go_down(), door_go_up(), door_hit_bottom(), door_hit_top(), DrownPlayer(), Ent_Remove(), football_touch(), generator_draw(), GiveSound(), GoalTouch(), GrapplingHook_Stop(), HitSound(), InitBall(), Item_Respawn(), Item_RespawnCountdown(), Item_Touch(), jumppad_push(), ka_DropEvent(), ka_RespawnBall(), ka_TouchEvent(), kh_Key_Collect(), kh_Key_DropAll(), kh_Key_DropOne(), kh_Key_Think(), Monster_Damage(), Monster_Sound(), MUTATOR_HOOKFUNCTION(), NET_HANDLE(), ons_ControlPoint_Icon_BuildThink(), ons_ControlPoint_Icon_Damage(), ons_ControlPoint_Icon_Spawn(), ons_ControlPoint_Icon_Think(), ons_GeneratorDamage(), ons_GeneratorThink(), ons_Teleport(), Onslaught_CheckWinner(), plat_go_down(), plat_go_up(), plat_hit_bottom(), plat_hit_top(), play_countdown(), player_powerups_remove_all(), PlayerCorpseDamage(), PlayerDamage(), PlayerJump(), PlayerTouchExplode(), PM_check_hitground(), PM_dodging(), PM_Footsteps(), Portal_Remove(), sandbox_ObjectFunction_Touch(), target_init_use(), TeleportPlayer(), train_next(), turret_die(), turret_gibboom(), UpdatePlayerSounds(), vehicles_damage(), vehicles_gib_explode(), vehicles_projectile(), W_Nexball_Touch(), W_Reload(), W_SetupShot_Dir_ProjectileSize_Range(), W_WeaponFrame(), and weapon_prepareattack_checkammo().

◆ VOL_BASEVOICE

const float VOL_BASEVOICE = 1.0

Definition at line 37 of file sound.qh.

Referenced by FireRailgunBullet(), NET_HANDLE(), PlayerPreThink(), and vehicle_alarm().

◆ VOL_MUFFLED

const float VOL_MUFFLED = 0.35

Definition at line 38 of file sound.qh.

Referenced by PM_check_hitground().