CAmbientGeneric (CS)

From AlliedModders Wiki
Jump to: navigation, search


Basic Information

  • Classname: CAmbientGeneric.
  • Inheriting Instances: ambient_generic.
  • Description: The ambient_generic allows you to play a specific sound.


Class Hierarchy


Entity Data

W = Windows | L = Linux

Name W. Offset L. Offset L. Diff Type Description
m_flAttenuation 34 38 +4 float Attenuation value.
-1	    : "Default"	      | None
ATTN_NONE   : "Everywhere"    | AMBIENT_SOUND_EVERYWHERE   
ATTN_IDLE   : "Small Radius"  | AMBIENT_SOUND_SMALLRADIUS  
ATTN_STATIC : "Medium Radius" | AMBIENT_SOUND_MEDIUMRADIUS
ATTN_NORM   : "Large Radius"  | AMBIENT_SOUND_LARGERADIUS
m_dpv.preset 35 39 +4 int None.
m_dpv.pitchrun 36 40 +4 int Pitch shift % when sound is running 0 - 255.
m_dpv.pitchstart 37 41 +4 int Pitch shift % when sound stops or starts 0 - 255.
m_dpv.spinup 38 42 +4 int Spinup time 0 - 100.
m_dpv.spindown 39 43 +5 int Spindown time 0 - 100.
m_dpv.volrun 40 44 +4 int Volume change % when sound is running 0 - 10.
m_dpv.volstart 41 45 +4 int Volume change % when sound stops or starts 0 - 10.
m_dpv.fadein 42 46 +4 int Volume fade in time 0 - 100.
m_dpv.fadeout 43 47 +4 int Volume fade out time 0 - 100.
m_dpv.lfotype 44 48 +4 int Low Frequency Oscillator. 0) off 1) square 2) triangle 3) random.
m_dpv.lforate 45 49 +4 int Low Frequency Oscillator. 0 - 1000, how fast lfo osciallates.
m_dpv.lfomodpitch 46 50 +4 int 0-100 mod of current pitch. 0 is off.
m_dpv.lfomodvol 47 51 +4 int 0-100 mod of current volume. 0 is off.
m_dpv.cspinup 48 52 +4 int Each trigger hit increments counter and spinup pitch.
m_dpv.cspincount 49 53 +4 int None.
m_dpv.pitch 50 54 +4 int None.
m_dpv.spinupsav 51 55 +4 int None.
m_dpv.spindownsav 52 56 +4 int None.
m_dpv.cspincount 53 57 +4 int None.
m_dpv.pitchfrac 54 58 +4 int None.
m_dpv.vol 55 59 +4 int None.
m_dpv.fadeoutsav 56 60 +4 int None.
m_dpv.volfrac 57 61 +4 int None.
m_dpv.lfofrac 58 62 +4 int None.
m_dpv.lfomult 59 63 +4 int None.
m_fActive 60 64 +4 BOOL Only TRUE when the entity is playing a looping sound.
m_fLooping 61 65 +4 BOOL TRUE when the sound played will loop.


Entity Attributes

  • Name (targetname) - Property used to identify entities.
  • WAV name (message) - This is the path/filename of the .wav file (note the forward-slash).
  • Volume (health) - Volume of the sound. Range: 0-10.
  • Dynamic Presets (preset) - Various effects that can be applied to the sound:
0 = None
1 = Huge Machine
2 = Big Machine
3 = Machine
4 = Slow Fade in
5 = Fade in
6 = Quick Fade in
7 = Slow Pulse
8 = Pulse
9 = Quick pulse
10 = Slow Oscillator
11 = Oscillator
12 = Quick Oscillator
13 = Grunge pitch
14 = Very low pitch
15 = Low pitch
16 = High pitch
17 = Very high pitch
18 = Screaming pitch
19 = Oscillate spinup/down
20 = Pulse spinup/down
21 = Random pitch
22 = Random pitch fast
23 = Incremental Spinup
24 = Alien
25 = Bizzare
26 = Planet X
27 = Haunted
  • Start volume (volstart)
  • Fade-in time (fadein) - Time taken for the sound to fade in. Range: 0-100
  • Fade-out time (fadeout) - Time taken for the sound to fade out, if not looped. Range: 0-100
  • Pitch (pitch) - 100 is normal, > 100 higher, < 100 lower.
  • Start pitch (pitchstart)
  • Spin-up time (spinup) - Range: 0-100
  • spin-down time (spindown) - Range: 0-100
  • LFO type (lfotype) - Values: 0=off,1=sqr,2=tri,3=rnd
  • LFO rate (lforate) - Range: 0-1000
  • LFO mod pitch (lfomodpitch) - Range: 0-100
  • LFO modvol (lfomodvol) - Range: 0-100
  • Incremental spin-up count (cspinup)


Entity Flags

#define AMBIENT_SOUND_STATIC		0  
#define AMBIENT_SOUND_EVERYWHERE	1   // Play Everywhere (1) - Sound will be heard in the entire level.
#define AMBIENT_SOUND_SMALLRADIUS	2   // Small Radius    (2) - Sound range is about 800 units at max volume.
#define AMBIENT_SOUND_MEDIUMRADIUS	4   // Medium Radius   (4) - Sound range is about 1250 units at max volume.
#define AMBIENT_SOUND_LARGERADIUS	8   // Large Radius    (8) - Sound range is about 2000 units at max volume.
#define AMBIENT_SOUND_START_SILENT	16  // Start Silent   (16) - Checking this means the entity must be triggered to work.
#define AMBIENT_SOUND_NOT_LOOPING	32  // Not Toggled    (32) - Older FGDs show this as Not Looped. Specifies that 
                                            /* the sound is to be played only once. With this flag checked, each time the 
                                               entity is triggered it will play once. If it is not checked, triggering it will
                                               cause the sound to alternate between on and off. */


Constants

// channels
#define CHAN_AUTO		0
#define CHAN_WEAPON		1
#define	CHAN_VOICE		2
#define CHAN_ITEM		3
#define	CHAN_BODY	        4
#define CHAN_STREAM		5	// allocate stream channel from the static or dynamic area
#define CHAN_STATIC		6	// allocate channel from the static area 
#define CHAN_NETWORKVOICE_BASE	7	// voice data coming across the network
#define CHAN_NETWORKVOICE_END	500     // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END).
 
// attenuation values
#define ATTN_NONE		0
#define	ATTN_NORM		0.8
#define ATTN_IDLE		2
#define ATTN_STATIC		1.25 
 
// pitch values
#define	PITCH_NORM		100	// non-pitch shifted
#define PITCH_LOW		95	// other values are possible - 0-255, where 255 is very high
#define PITCH_HIGH		120
 
// volume values
#define VOL_NORM		1.0


Notes

  • From WorldCraft 2.1 Help: “To play a wav through the streaming code (for very large, one-shot wavs) use * in front of the name. For instance, ambience/*speak2.wav would stream speak2.wav. Streaming sounds are loaded in segments from the disk, played, and flushed from memory.
  • To play any sentence from sentences.txt, replace the path/filename.wav with ! followed by the sentence name. For instance, !NA1 plays the sentence named NA1.
  • All the keyvalues from volstart to cspinup are various pitch, volume, and low frequency pitch oscillation settings that are overridden by the dynamic preset setting. In general, don't use these. The incremental spin-up count may be used as follows: each time the ambient is triggered, its pitch will rise from 'start pitch' to 'pitch' by this many increments. So, a setting of '3' means that the pitch of the ambient will rise from 'start pitch' to 'pitch' in three presses (ie: three triggers).


HLSDK Reference


Related Links