void InitializeMemory(string path)
        {
            this.WaveForm = RiffForm.Load(path);
            this.wformat  = RiffUtil.ToNAudio(this.WaveForm.Cks.ckFmt);

            sampleData_ChunkLength = this.WaveForm["data"].ckLength;
            SampleData_SampleCount = SampleData_ChunkLength / WaveFormat.Channels;
            sampleData_DataStart   = RiffUtil.FindSampleStart(this.WaveForm);

            RawWaveData = new byte[sampleData_ChunkLength];
            using (waveFileInputStream = new FileStream(
                       this.FilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                waveFileInputStream.Seek(sampleData_DataStart, SeekOrigin.Begin);
                waveFileInputStream.Read(RawWaveData, /*sampleData_DataStart*/ 0, SampleData_ChunkLength);
            }
        }
        override public int Read(byte[] b, int position, int length)
        {
            int ToRead = RiffUtil.BytesToRead(this, lastReadOffset, length), BytesReturned = 0;

            if (Status == BufferStatus.Finished || ToRead == 0)
            {
                this.OnEndOfTrack();
                lastReadOffset = 0;
                return(lastReadOffset);
            }

            Debug.Print(
                "status: {4}, offset: {0}, length: {1}, toread: {2}, of: {3}",
                lastReadOffset, length, ToRead, SampleData_ChunkLength, Status
                );

            if (ToRead == 0)
            {
                Status = BufferStatus.Finished;
                return(BytesReturned);
            }
            else
            {
                using (MemoryStream memory = new MemoryStream(RawWaveData))
                {
                    memory.Seek(lastReadOffset, SeekOrigin.Begin);
                    lastReadOffset += BytesReturned = memory.Read(b, 0, ToRead);
                    memory.Close();
                }
            }
            if (Status == BufferStatus.LastPage)
            {
                Status = BufferStatus.Finished;
            }
            return(BytesReturned);
        }