Nuclide
Software Development Kit for id Technology (BETA)
Loading...
Searching...
No Matches
soundDef.h
1/*
2 * Copyright (c) 2016-2024 Vera Visions LLC.
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
14 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*/
16
112
113.float maxspeed;
114.float flags;
115
116var logLevel_t autocvar_s_logLevel = LOGLEVEL_DEFAULT;
117void
118_SndLog(string functionName, string msg)
119{
120 if (autocvar_g_logTimestamps)
121 print(sprintf("^9%f ^xF50%s^7: %s\n", time, functionName, msg));
122 else
123 print(sprintf("^xF50%s^7: %s\n", functionName, msg));
124}
125
130#define SndLog(...) if (autocvar_s_logLevel >= LOGLEVEL_DEBUG) _SndLog(__FUNC__, sprintf(__VA_ARGS__))
131
132void
133_SndEntLog(string className, string functionName, float edictNum, string warnMessage)
134{
135 if (autocvar_g_logTimestamps)
136 print(sprintf("^9%f ^xF50%s (id: %d)^7: %s\n", time, functionName, edictNum, warnMessage));
137 else
138 print(sprintf("^xF50%s (id: %d)^7: %s\n", functionName, edictNum, warnMessage));
139}
140
145#define SndEntLog(...) if (autocvar_s_logLevel >= LOGLEVEL_DEBUG) _SndEntLog(classname, __FUNC__, num_for_edict(this), sprintf(__VA_ARGS__))
146
148typedef struct
149{
150 string m_strSnd;
153} sound_t;
154
156void SoundDef_Init(void);
158void SoundDef_Shutdown(void);
160int SoundDef_Precache(string sndDef);
162void SoundDef_Play(entity targetEntity, int sndChannel, string sndDef);
164void SoundDef_PlayAt(vector worldPos, string sndDef);
165
166#ifdef CLIENT
168void SoundDef_PlayLocal(string shader);
170void SoundDef_Update(entity targetEntity, int sndChannel, int sndSample, float desiredVolume);
171
172int SoundDef_GetID(string sndDef);
173#else
175void SoundDef_Speak(entity targetEntity, string sentencesEntry);
176#endif
177
179void SoundDef_Stop(entity target, float chan);
180
181void SoundDef_DebugList();
182 // end of sounddefs
float flags
Definition soundDef.h:114
var logLevel_t autocvar_s_logLevel
Definition soundDef.h:116
int SoundDef_GetID(string sndDef)
Definition soundDef.qc:790
void _SndLog(string functionName, string msg)
Definition soundDef.h:118
void SoundDef_Play(entity targetEntity, int sndChannel, string sndDef)
Play a soundDef on a given target entity.
Definition soundDef.qc:577
void SoundDef_DebugList()
Called by listSoundDef.
Definition soundDef.qc:957
float maxspeed
Definition soundDef.h:113
void SoundDef_Shutdown(void)
Called by CSQC_Shutdown() and in theory, somewhere on the server.
Definition soundDef.qc:36
void SoundDef_Update(entity targetEntity, int sndChannel, int sndSample, float desiredVolume)
Client-side only: Update the sound parameters on a given entity.
Definition soundDef.qc:800
int SoundDef_Precache(string sndDef)
Force the precache of a soundDef file.
Definition soundDef.qc:386
void SoundDef_Init(void)
Called by the client inside CSQC_Init(), and on the server inside init().
Definition soundDef.qc:47
void _SndEntLog(string className, string functionName, float edictNum, string warnMessage)
Definition soundDef.h:133
void SoundDef_Stop(entity target, float chan)
Stops sounds on a given channel, on a target entity.
Definition soundDef.qc:570
void SoundDef_PlayLocal(string shader)
Client-side only: Play a sound locally, outside the game world.
Definition soundDef.qc:762
void SoundDef_PlayAt(vector worldPos, string sndDef)
Play a soundDef a a given location.
Definition soundDef.qc:699
A sound sample of a sentences.txt word sequence.
Definition soundDef.h:149
string m_strSnd
Definition soundDef.h:150
float m_flLength
Definition soundDef.h:151
float m_flPitch
Definition soundDef.h:152