Пример #1
0
        private bool stepSound()
        {
            if (inputPosition + inputBytesPerFrame >= inputLength)
            {
                // Loop sound
                inputPosition = inputOffset;
            }

            int result = codec.decode(inputAddr + inputPosition, inputBytesPerFrame, samplesAddr);

            if (result < 0)
            {
                return(false);
            }

            inputPosition += inputBytesPerFrame;

            sbyte[] bytes = new sbyte[codec.NumberOfSamples * 2 * channels];
            for (int i = 0; i < bytes.Length; i++)
            {
                bytes[i] = (sbyte)mem.read8(samplesAddr + i);
            }
            mLine.write(bytes, 0, bytes.Length);

            return(true);
        }
Пример #2
0
        protected internal override void  writeImpl(short[] samples, int offs, int len)
        {
            if (source == null)
            {
                createSource();
            }

            sbyte[] b = toByteArray(samples, offs, len);
            source.write(b, 0, len * 2);
        }