Example #1
0
        public override int Read(byte[] buffer, int offset, int count)
        {
            if (!isPlaying)
            {
                GmeNative.gme_start_track(emuHandle, track++);
                isPlaying = true;
            }

            // Make a buffer and fill it.
            short[] sBuffer = new short[count / 2];
            GmeNative.gme_play(emuHandle, count / 2, sBuffer);

            // Convert the short samples to byte samples and place them
            // in the NAudio byte sample buffer.
            Buffer.BlockCopy(sBuffer, 0, buffer, 0, buffer.Length);

            return(buffer.Length);
        }