Example #1
0
        public int Read(byte[] buffer, int offset, int count)
        {
            int sampleCount = count;

            short[] tempBuffer = new short[sampleCount / 2];

            Nuked.OPL3_GenerateStream(ref chip, tempBuffer, (ushort)(sampleCount / 2), 0);

            int pos = 0;

            for (int i = 0; i < tempBuffer.Length; i++)
            {
                buffer[pos]     = (byte)(tempBuffer[i] & 0xFF);
                buffer[pos + 1] = (byte)(tempBuffer[i] >> 8 & 0xFF);
                pos            += 2;
            }

            return(count);
        }
Example #2
0
        //void generateSamples(short[] buffer, int length)
        //{
        //    Nuked.OPL3_GenerateStream(chip, buffer, (ushort)(length / 2), 0);
        //}

        public void ReadBuffer(short[] buffer, int pos, int length)
        {
            Nuked.OPL3_GenerateStream(ref chip, buffer, (ushort)(length / 2), pos);
        }