Class WavFormat
Represents a Wave file format.
Inherited Members
Namespace: Evergine.Common.Media
Assembly: Evergine.Common.dll
Syntax
public class WavFormat
Constructors
WavFormat()
Initializes a new instance of the WavFormat class, a new PCM 44.1Khz stereo 16 bit format.
Declaration
public WavFormat()
WavFormat(int, int)
Initializes a new instance of the WavFormat class, a new 16 bit wave format with the specified sample rate and channel count.
Declaration
public WavFormat(int sampleRate, int channels)
Parameters
Type | Name | Description |
---|---|---|
int | sampleRate | Sample Rate. |
int | channels | Number of channels. |
WavFormat(int, int, int)
Initializes a new instance of the WavFormat class, a new PCM format with the specified sample rate, bit depth and channels.
Declaration
public WavFormat(int rate, int bits, int channels)
Parameters
Type | Name | Description |
---|---|---|
int | rate | Sample rate. |
int | bits | Audio bits. |
int | channels | Audio channels. |
Fields
averageBytesPerSecond
for buffer estimation.
Declaration
protected int averageBytesPerSecond
Field Value
Type | Description |
---|---|
int |
bitsPerSample
number of bits per sample of mono data.
Declaration
protected short bitsPerSample
Field Value
Type | Description |
---|---|
short |
blockAlign
block size of data.
Declaration
protected short blockAlign
Field Value
Type | Description |
---|---|
short |
channels
number of channels.
Declaration
protected short channels
Field Value
Type | Description |
---|---|
short |
extraSize
number of following bytes.
Declaration
protected short extraSize
Field Value
Type | Description |
---|---|
short |
sampleRate
sample rate.
Declaration
protected int sampleRate
Field Value
Type | Description |
---|---|
int |
Properties
AverageBytesPerSecond
Gets the average number of bytes used per second.
Declaration
public int AverageBytesPerSecond { get; }
Property Value
Type | Description |
---|---|
int |
BitsPerSample
Gets the number of bits per sample (usually 16 or 32, sometimes 24 or 8) Can be 0 for some codecs.
Declaration
public int BitsPerSample { get; }
Property Value
Type | Description |
---|---|
int |
BlockAlign
Gets the block alignment.
Declaration
public virtual int BlockAlign { get; }
Property Value
Type | Description |
---|---|
int |
Channels
Gets the number of channels (1=mono,2=stereo etc).
Declaration
public int Channels { get; }
Property Value
Type | Description |
---|---|
int |
ExtraSize
Gets the number of extra bytes used by this waveformat. Often 0, except for compressed formats which store extra data after the WAVEFORMATEX header.
Declaration
public int ExtraSize { get; }
Property Value
Type | Description |
---|---|
int |
SampleRate
Gets the sample rate (samples per second).
Declaration
public int SampleRate { get; }
Property Value
Type | Description |
---|---|
int |
Methods
ConvertLatencyToByteSize(int)
Gets the size of a wave buffer equivalent to the latency in milliseconds.
Declaration
public int ConvertLatencyToByteSize(int milliseconds)
Parameters
Type | Name | Description |
---|---|---|
int | milliseconds | The milliseconds. |
Returns
Type | Description |
---|---|
int | Size of the wave buffer equivaelent to the latency in milliseconds. |
Equals(object)
Compares with another WaveFormat object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | Object to compare to. |
Returns
Type | Description |
---|---|
bool | True if the objects are the same. |
Overrides
GetHashCode()
Provides a Hashcode for this WaveFormat.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hashcode. |
Overrides
ToString()
Reports this WaveFormat as a string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | String describing the wave format. |