# NewGamePhysics.Utilities.WaveFormat Class Reference

Wave format definition for unmanaged interop. More...

List of all members.

## Public Member Functions
| WaveFormat (uint rate, ushort bits, ushort channels)
| Creates a wave format object used to initialize the native audio interface.
## Public Attributes
ushort | formatTag
| The format tag. Locked to PCM in constructor.
ushort | channels
| Number of channels (1 or 2).
uint | samplesPerSec
| Samples per second (>0).
uint | averageBytesPerSec
| Average bytes per second.
ushort | blockAlignment
| Block alignment.
ushort | bitsPerSample
| Bits per sample (8 or 16).
short | cbSize
| Filler short.

## Detailed Description

Wave format definition for unmanaged interop.

Definition at line 17 of file NativeAudio.cs.

## Constructor & Destructor Documentation

NewGamePhysics.Utilities.WaveFormat.WaveFormat | ( | uint | rate,
|  | ushort | bits,
|  | ushort | channels |
| ) |  |  |

Creates a wave format object used to initialize the native audio interface.

Parameters:

  | rate | Playback rate in samples per second (>0).
  | bits | Bits per sample (8 or 16).
  | channels | Number of channels (1 or 2).

Definition at line 60 of file NativeAudio.cs.

    00061         {
    00062             if (!(rate > 0))
    00063             {
    00064                 throw new ArgumentException("'rate' must be greater than >0", "rate");
    00065             }
    00066
    00067             if (!((bits == 8) || (bits == 16)))
    00068             {
    00069                 throw new ArgumentException("'bits' must be 8 or 16", "bits");
    00070             }
    00071
    00072             if (!((channels == 1) || (channels == 2)))
    00073             {
    00074                 throw new ArgumentException("'channels' must be 1 or 2", "channels");
    00075             }
    00076
    00077             this.formatTag = 1; // lock to PCM
    00078             this.channels = channels;
    00079             this.samplesPerSec = rate;
    00080             this.bitsPerSample = bits;
    00081             this.cbSize = 0;
    00082
    00083             this.blockAlignment = (ushort)(channels * (bits / 8));
    00084             this.averageBytesPerSec = samplesPerSec * blockAlignment;
    00085         }

## Member Data Documentation

uint NewGamePhysics.Utilities.WaveFormat.averageBytesPerSec

Average bytes per second.

Definition at line 37 of file NativeAudio.cs.

ushort NewGamePhysics.Utilities.WaveFormat.bitsPerSample

Bits per sample (8 or 16).

Definition at line 47 of file NativeAudio.cs.

ushort NewGamePhysics.Utilities.WaveFormat.blockAlignment

Block alignment.

Definition at line 42 of file NativeAudio.cs.

short NewGamePhysics.Utilities.WaveFormat.cbSize

Filler short.

Definition at line 52 of file NativeAudio.cs.

ushort NewGamePhysics.Utilities.WaveFormat.channels

Number of channels (1 or 2).

Definition at line 27 of file NativeAudio.cs.

ushort NewGamePhysics.Utilities.WaveFormat.formatTag

The format tag. Locked to PCM in constructor.

Definition at line 22 of file NativeAudio.cs.

uint NewGamePhysics.Utilities.WaveFormat.samplesPerSec

Samples per second (>0).

Definition at line 32 of file NativeAudio.cs.

The documentation for this class was generated from the following file:

- C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/NewGamePhysics/Utilities/NativeAudio.cs