public ConvertLatencyToByteSize ( int milliseconds ) : int | ||
milliseconds | int | The milliseconds. |
return | int |
public int ConvertLatencyToByteSize(int milliseconds)
{
int bytes = (int) ((AverageBytesPerSecond/1000.0)*milliseconds);
if ((bytes%BlockAlign) != 0)
{
// Return the upper BlockAligned
bytes = bytes + BlockAlign - (bytes % BlockAlign);
}
return bytes;
}
public WaveData(double seconds) { var length = Format.ConvertLatencyToByteSize((int)(seconds * 1000)); Samples = new short[length / BytesPerSample]; ByteArray = new byte[length]; }