Beispiel #1
0
        private int GetDataChunk(short[] data)
        {
            int freq = _rate;

            int i, towrite = DataChunckSize;
            var pos = 0;

            while (towrite > 0)
            {
                while (minicnt < 0)
                {
                    minicnt += freq;
                    var playing = _player.Update();
                    if (!playing)
                    {
                        return(-1);
                    }
                }
                i = Math.Min(towrite, (int)(minicnt / _player.RefreshRate + 4) & ~3);
                _player.Opl.ReadBuffer(data, pos, i);
                pos     += i;
                towrite -= i;
                minicnt -= (int)(_player.RefreshRate * i);
            }

            return(DataChunckSize);
        }