Barotrauma Client Doc
Barotrauma.Sounds.Sound Class Referenceabstract
Inheritance diagram for Barotrauma.Sounds.Sound:
Barotrauma.Sounds.OggSound Barotrauma.Sounds.VideoSound Barotrauma.Sounds.VoipSound

Public Member Functions

 Sound (SoundManager owner, string filename, bool stream, bool streamsReliably, ContentXElement xElement=null, bool getFullPath=true)
 
override string ToString ()
 
virtual bool IsPlaying ()
 
virtual SoundChannel Play (float gain, float range, Vector2 position, bool muffle=false)
 
virtual SoundChannel Play (float gain, float range, float freqMult, Vector2 position, bool muffle=false)
 
virtual SoundChannel Play (Vector3? position, float gain, float freqMult=1.0f, bool muffle=false)
 
virtual SoundChannel Play (float gain)
 
virtual SoundChannel Play ()
 
virtual SoundChannel Play (float? gain, string category)
 
abstract int FillStreamBuffer (int samplePos, short[] buffer)
 
abstract float GetAmplitudeAtPlaybackPos (int playbackPos)
 
virtual void InitializeAlBuffers ()
 
virtual void FillAlBuffers ()
 
virtual void DeleteAlBuffers ()
 
virtual void Dispose ()
 

Public Attributes

readonly SoundManager Owner
 
readonly string Filename
 
readonly ContentXElement XElement
 
readonly bool Stream
 
readonly bool StreamsReliably
 
int MaxSimultaneousInstances = 5
 How many instances of the same sound clip can be playing at the same time More...
 
float BaseGain
 
float BaseNear
 
float BaseFar
 

Static Protected Member Functions

static void CastBuffer (float[] inBuffer, short[] outBuffer, int length)
 
static short FloatToShort (float fVal)
 
static float ShortToFloat (short shortVal)
 

Protected Attributes

bool disposed
 
SoundBuffers buffers
 

Properties

bool Disposed [get]
 
virtual SoundManager.SourcePoolIndex SourcePoolIndex [get]
 
SoundBuffersBuffers [get]
 
int ALFormat [get, protected set]
 
int SampleRate [get, protected set]
 

Detailed Description

Definition at line 9 of file Sound.cs.

Constructor & Destructor Documentation

◆ Sound()

Barotrauma.Sounds.Sound.Sound ( SoundManager  owner,
string  filename,
bool  stream,
bool  streamsReliably,
ContentXElement  xElement = null,
bool  getFullPath = true 
)

Definition at line 63 of file Sound.cs.

Member Function Documentation

◆ CastBuffer()

static void Barotrauma.Sounds.Sound.CastBuffer ( float[]  inBuffer,
short[]  outBuffer,
int  length 
)
staticprotected

Definition at line 118 of file Sound.cs.

◆ DeleteAlBuffers()

virtual void Barotrauma.Sounds.Sound.DeleteAlBuffers ( )
virtual

Definition at line 146 of file Sound.cs.

◆ Dispose()

virtual void Barotrauma.Sounds.Sound.Dispose ( )
virtual

◆ FillAlBuffers()

virtual void Barotrauma.Sounds.Sound.FillAlBuffers ( )
virtual

Reimplemented in Barotrauma.Sounds.OggSound.

Definition at line 144 of file Sound.cs.

◆ FillStreamBuffer()

abstract int Barotrauma.Sounds.Sound.FillStreamBuffer ( int  samplePos,
short[]  buffer 
)
pure virtual

◆ FloatToShort()

static short Barotrauma.Sounds.Sound.FloatToShort ( float  fVal)
staticprotected

Definition at line 126 of file Sound.cs.

◆ GetAmplitudeAtPlaybackPos()

abstract float Barotrauma.Sounds.Sound.GetAmplitudeAtPlaybackPos ( int  playbackPos)
pure virtual

◆ InitializeAlBuffers()

virtual void Barotrauma.Sounds.Sound.InitializeAlBuffers ( )
virtual

Reimplemented in Barotrauma.Sounds.OggSound.

Definition at line 142 of file Sound.cs.

◆ IsPlaying()

virtual bool Barotrauma.Sounds.Sound.IsPlaying ( )
virtual

Reimplemented in Barotrauma.Sounds.VideoSound.

Definition at line 82 of file Sound.cs.

◆ Play() [1/6]

virtual SoundChannel Barotrauma.Sounds.Sound.Play ( )
virtual

Reimplemented in Barotrauma.Sounds.VoipSound, and Barotrauma.Sounds.VideoSound.

Definition at line 107 of file Sound.cs.

◆ Play() [2/6]

virtual SoundChannel Barotrauma.Sounds.Sound.Play ( float  gain)
virtual

Reimplemented in Barotrauma.Sounds.VoipSound, and Barotrauma.Sounds.VideoSound.

Definition at line 102 of file Sound.cs.

◆ Play() [3/6]

virtual SoundChannel Barotrauma.Sounds.Sound.Play ( float  gain,
float  range,
float  freqMult,
Vector2  position,
bool  muffle = false 
)
virtual

Definition at line 92 of file Sound.cs.

◆ Play() [4/6]

virtual SoundChannel Barotrauma.Sounds.Sound.Play ( float  gain,
float  range,
Vector2  position,
bool  muffle = false 
)
virtual

Reimplemented in Barotrauma.Sounds.VoipSound, and Barotrauma.Sounds.VideoSound.

Definition at line 87 of file Sound.cs.

◆ Play() [5/6]

virtual SoundChannel Barotrauma.Sounds.Sound.Play ( float?  gain,
string  category 
)
virtual

Definition at line 112 of file Sound.cs.

◆ Play() [6/6]

virtual SoundChannel Barotrauma.Sounds.Sound.Play ( Vector3?  position,
float  gain,
float  freqMult = 1.0f,
bool  muffle = false 
)
virtual

Reimplemented in Barotrauma.Sounds.VoipSound, and Barotrauma.Sounds.VideoSound.

Definition at line 97 of file Sound.cs.

◆ ShortToFloat()

static float Barotrauma.Sounds.Sound.ShortToFloat ( short  shortVal)
staticprotected

Definition at line 133 of file Sound.cs.

◆ ToString()

override string Barotrauma.Sounds.Sound.ToString ( )

Definition at line 77 of file Sound.cs.

Member Data Documentation

◆ BaseFar

float Barotrauma.Sounds.Sound.BaseFar

Definition at line 61 of file Sound.cs.

◆ BaseGain

float Barotrauma.Sounds.Sound.BaseGain

Definition at line 59 of file Sound.cs.

◆ BaseNear

float Barotrauma.Sounds.Sound.BaseNear

Definition at line 60 of file Sound.cs.

◆ buffers

SoundBuffers Barotrauma.Sounds.Sound.buffers
protected

Definition at line 36 of file Sound.cs.

◆ disposed

bool Barotrauma.Sounds.Sound.disposed
protected

Definition at line 11 of file Sound.cs.

◆ Filename

readonly string Barotrauma.Sounds.Sound.Filename

Definition at line 19 of file Sound.cs.

◆ MaxSimultaneousInstances

int Barotrauma.Sounds.Sound.MaxSimultaneousInstances = 5

How many instances of the same sound clip can be playing at the same time

Definition at line 57 of file Sound.cs.

◆ Owner

readonly SoundManager Barotrauma.Sounds.Sound.Owner

Definition at line 17 of file Sound.cs.

◆ Stream

readonly bool Barotrauma.Sounds.Sound.Stream

Definition at line 23 of file Sound.cs.

◆ StreamsReliably

readonly bool Barotrauma.Sounds.Sound.StreamsReliably

Definition at line 25 of file Sound.cs.

◆ XElement

readonly ContentXElement Barotrauma.Sounds.Sound.XElement

Definition at line 21 of file Sound.cs.

Property Documentation

◆ ALFormat

int Barotrauma.Sounds.Sound.ALFormat
getprotected set

Definition at line 42 of file Sound.cs.

◆ Buffers

SoundBuffers? Barotrauma.Sounds.Sound.Buffers
get

Definition at line 37 of file Sound.cs.

◆ Disposed

bool Barotrauma.Sounds.Sound.Disposed
get

Definition at line 12 of file Sound.cs.

◆ SampleRate

int Barotrauma.Sounds.Sound.SampleRate
getprotected set

Definition at line 48 of file Sound.cs.

◆ SourcePoolIndex

virtual SoundManager.SourcePoolIndex Barotrauma.Sounds.Sound.SourcePoolIndex
get

Definition at line 28 of file Sound.cs.