public int Open(SoundStream stream)
{
this.waveStream = stream;
this.channels = stream.Format.Channels;
this.blockAlign = stream.Format.BlockAlign;
this.numberOfFrames = (int)stream.Length / blockAlign;
this.sampleRate = stream.Format.SampleRate;
this.numberOfSamples = numberOfFrames * Channels;
this.duration = (int)(numberOfFrames / (double)sampleRate * 1000.0);
this.bitsPerSample = stream.Format.BitsPerSample;
this.averageBitsPerSecond = stream.Format.AverageBytesPerSecond * 8;
return numberOfFrames;
}