Exemplo n.º 1
0
        internal wAudioProvider(AudioDevice device)
        {
            _device = device ?? wAudioDevice.DefaultPlaybackDevice;

            Guid guid = ((wAudioDevice)_device)._guid;

            DS.DirectSoundCreate8(&guid, out _ds8, IntPtr.Zero);
        }
        //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;
        }