Exemple #1
0
 public DSBufferDesc(uint bufferSize, DSBufferCapsFlags bufferCaps, WaveFormatEx *format, Guid algorithm)
 {
     dwSize          = Size;
     dwFlags         = bufferCaps;
     dwBufferBytes   = bufferSize;
     dwReserved      = 0;
     lpwfxFormat     = format;
     guid3DAlgorithm = algorithm;
 }
        private static void LoadWaveFormat(RIFFData riff)
        {
            WaveFormatEx *format = GetWaveFormat();

            format->nChannels       = (ushort)riff.Channels;
            format->nSamplesPerSec  = (uint)riff.SampleRate;
            format->nAvgBytesPerSec = (uint)(format->nSamplesPerSec * riff.BlockAlign);
            format->nBlockAlign     = (ushort)riff.BlockAlign;
            format->wBitsPerSample  = (ushort)riff.BitsPerSample;
        }
Exemple #3
0
        /// <summary>
        /// Sets the wave format of the audio stream.
        /// </summary>
        /// <param name="header">The RIFF header of the audio stream.</param>
        public void SetWaveFormat(RIFFHeader header)
        {
            WaveFormatEx *waveFormat = GetWaveFormat();

            waveFormat->nChannels       = (ushort)header.Channels;
            waveFormat->nSamplesPerSec  = (uint)header.SampleRate;
            waveFormat->nBlockAlign     = (ushort)((header.Channels * header.BitsPerSample) / 8);
            waveFormat->nAvgBytesPerSec = (uint)(header.SampleRate * waveFormat->nBlockAlign);
            waveFormat->wBitsPerSample  = (ushort)header.BitsPerSample;
        }
 public DSBufferDesc(uint bufferSize, DSBufferCapsFlags bufferCaps, WaveFormatEx* format, Guid algorithm)
 {
     dwSize = Size;
     dwFlags = bufferCaps;
     dwBufferBytes = bufferSize;
     dwReserved = 0;
     lpwfxFormat = format;
     guid3DAlgorithm = algorithm;
 }