Class Sound
- Namespace
- ValveResourceFormat.ResourceTypes
- Assembly
- ValveResourceFormat.dll
Represents a sound resource containing audio data and metadata.
public class Sound : Block
Inheritance
Inherited Members
Extension Methods
Properties
AudioFormat
Gets the bitstream encoding format.
public Sound.WaveAudioFormat AudioFormat { get; }
Property Value
Bits
Gets the bit size.
public uint Bits { get; }
Property Value
Channels
Gets the number of channels. 1 for mono, 2 for stereo.
public uint Channels { get; }
Property Value
Duration
Gets the duration of the sound in seconds.
public float Duration { get; }
Property Value
Header
Gets the WAVE format header data for ADPCM audio.
public byte[] Header { get; }
Property Value
- byte[]
LoopEnd
Gets the loop end position in samples.
public int LoopEnd { get; }
Property Value
LoopStart
Gets the loop start position in samples.
public int LoopStart { get; }
Property Value
SampleCount
Gets the total number of audio samples.
public uint SampleCount { get; }
Property Value
SampleRate
Gets the samples per second.
public uint SampleRate { get; }
Property Value
SampleSize
Gets the size of each audio sample in bytes.
public uint SampleSize { get; }
Property Value
Sentence
Gets the sentence data containing phoneme and emphasis information.
public Sentence Sentence { get; }
Property Value
SoundType
Gets the audio file type.
public Sound.AudioFileType SoundType { get; }
Property Value
StreamingDataSize
Gets the size of the streaming audio data in bytes.
public uint StreamingDataSize { get; }
Property Value
Type
Gets the block type.
public override BlockType Type { get; }
Property Value
Methods
ConstructFromCtrl()
Constructs sound data from the control block.
public bool ConstructFromCtrl()
Returns
GetSound()
Returns a fully playable sound data. In case of WAV files, header is automatically generated as Valve removes it when compiling.
public byte[] GetSound()
Returns
- byte[]
-
Byte array containing sound data.
GetSoundStream()
Returns a fully playable sound data. In case of WAV files, header is automatically generated as Valve removes it when compiling.
public MemoryStream GetSoundStream()
Returns
- MemoryStream
-
Memory stream containing sound data.
Read(BinaryReader)
Reads the block data from a binary reader.
public override void Read(BinaryReader reader)
Parameters
reader
BinaryReader-
The binary reader to read from.
Serialize(Stream)
Writes the binary representation of the object to Stream.
public override void Serialize(Stream stream)
Parameters
stream
Stream-
Stream.
WriteText(IndentedTextWriter)
Writes the correct text dump of the object to IndentedTextWriter.
public override void WriteText(IndentedTextWriter writer)
Parameters
writer
IndentedTextWriter-
IndentedTextWriter.
Remarks
Outputs sound metadata including sample rate, format, and channel information.