Exemplo n.º 1
0
        //internal wAudioBuffer(wAudioProvider parent, DS.IDirectSoundBuffer8 buffer) { _dsb8 = buffer; }
        internal wAudioBuffer(wAudioProvider parent, ref DS.DSBufferDesc desc)
        {
            _parent = parent;
            _parent._ds8.CreateSoundBuffer(ref desc, out _dsb8, IntPtr.Zero);

            _format        = desc.lpwfxFormat->wFormatTag;
            _frequency     = (int)desc.lpwfxFormat->nSamplesPerSec;
            _channels      = desc.lpwfxFormat->nChannels;
            _bitsPerSample = desc.lpwfxFormat->wBitsPerSample;
            _dataLength    = (int)desc.dwBufferBytes;
            _blockAlign    = _bitsPerSample * _channels / 8;
            _sampleLength  = _dataLength / _blockAlign;
        }
        //internal wAudioBuffer(wAudioProvider parent, DS.IDirectSoundBuffer8 buffer) { _dsb8 = buffer; }
        internal wAudioBuffer(wAudioProvider parent, ref DS.DSBufferDesc desc)
        {
            _parent = parent;

            if (desc.dwBufferBytes == 0)
                return;

            _parent._ds8.CreateSoundBuffer(ref desc, out _dsb8, IntPtr.Zero);

            _format = desc.lpwfxFormat->wFormatTag;
            _frequency = (int)desc.lpwfxFormat->nSamplesPerSec;
            _channels = desc.lpwfxFormat->nChannels;
            _bitsPerSample = desc.lpwfxFormat->wBitsPerSample;
            _dataLength = (int)desc.dwBufferBytes;
            _blockAlign = _bitsPerSample * _channels / 8;
            _sampleLength = _dataLength / _blockAlign;
        }