/// <summary>
        ///		Initializes a new sample buffer and writes all the audio data in the given
        ///		sample into it.
        /// </summary>
        /// <param name="driver">Audio driver to associate this sound buffer with.</param>
        /// <param name="sample">Sample to load audio data from.</param>
        public DirectSound9SampleBuffer(DirectSound9Driver driver, Sample sample, SoundFlags flags)
        {
            // Store the sample and driver for later use.
            _sample    = sample;
            _dx9Driver = driver;
            _flags     = flags;

            // Naughty people :S.
            // if (sample == null)
            //    return;

            // Create a streaming thread.
            if ((flags & SoundFlags.Streamed) != 0)
            {
                _streamingThread = new Thread(StreamingThread);
                _streamingThread.IsBackground = true;
                _streamingThread.Start();
            }
            else if (_sample != null)
            {
                GC.AddMemoryPressure(_sample.Data.Length);
            }

            // Write the data into the sample buffer.
            RefreshSampleBuffer();
        }
        /// <summary>
        ///		Initializes a new sample buffer and writes all the audio data in the given
        ///		sample into it.
        /// </summary>
        /// <param name="driver">Audio driver to associate this sound buffer with.</param>
        /// <param name="sample">Sample to load audio data from.</param>
        public DirectSound9SampleBuffer(DirectSound9Driver driver, Sample sample, SoundFlags flags)
        {
            // Store the sample and driver for later use.
            _sample    = sample;
            _dx9Driver = driver;
            _flags     = flags;

            // Naughty people :S.
               // if (sample == null)
            //    return;

            // Create a streaming thread.
            if ((flags & SoundFlags.Streamed) != 0)
            {
                _streamingThread = new Thread(StreamingThread);
                _streamingThread.IsBackground = true;
                _streamingThread.Start();
            }
            else if (_sample != null)
                GC.AddMemoryPressure(_sample.Data.Length);

            // Write the data into the sample buffer.
            RefreshSampleBuffer();
        }