public SampleCollection DecodeSamples()
        {
            Contract.Ensures(_buffer != null);
            Contract.Ensures(Contract.Result <SampleCollection>() != null);

            uint sampleCount = 4096;

            if (_buffer == null)
            {
                _buffer = new int[sampleCount * _inputDescription.ChannelsPerFrame];
            }

            GCHandle handle = GCHandle.Alloc(_buffer, GCHandleType.Pinned);

            try
            {
                var bufferList = new AudioBufferList
                {
                    NumberBuffers = 1,
                    Buffers       = new AudioBuffer[1]
                };
                bufferList.Buffers[0].NumberChannels = _inputDescription.ChannelsPerFrame;
                bufferList.Buffers[0].DataByteSize   = (uint)(_buffer.Length);
                bufferList.Buffers[0].Data           = handle.AddrOfPinnedObject();

                AudioConverterStatus status = _converter.FillBuffer(ref sampleCount, ref bufferList, null);
                if (status != AudioConverterStatus.Ok)
                {
                    throw new IOException(string.Format(CultureInfo.CurrentCulture,
                                                        Resources.LosslessSampleDecoderFillBufferError, status));
                }

                SampleCollection result =
                    SampleCollectionFactory.Instance.Create((int)_inputDescription.ChannelsPerFrame, (int)sampleCount);

                // De-interlace the output buffer into the new sample collection, converting to floating point values:
                var index = 0;
                for (var sample = 0; sample < result.SampleCount; sample++)
                {
                    for (var channel = 0; channel < result.Channels; channel++)
                    {
                        result[channel][sample] = _buffer[index++] / _divisor;
                    }
                }

                return(result);
            }
            finally
            {
                handle.Free();
            }
        }