Пример #1
0
        public bool Init()
        {
            if (!_intf.Init())
            {
                return(false);
            }

            _activeChannels   = new sbyte[16];
            _sustainChannels  = new sbyte[16];
            _assignedChannels = new ActiveChannel[128];
            for (int i = 0; i < _assignedChannels.Length; i++)
            {
                _assignedChannels[i] = new ActiveChannel();
            }
            _eventBuffer = new DlEvent[64];

            _tEnable    = new byte[32];
            _tMode      = new byte[32];
            _tOrdr      = new byte[32];
            _tLevel     = new sbyte[32];
            _tTranspose = new sbyte[32];

            Reset();

            return(true);
        }
Пример #2
0
        void Reset()
        {
            _intf.Callback(0);

            _intf.Callback(74);
            _intf.Callback(70, 0);
            _intf.Callback(75, 3);

            SetTimerA(true, 1);
            SetTimerA(false, 1);
            SetTimerB(true, 221);

            _paraCount = _command = _para[0] = _para[1] = 0;
            Array.Clear(_sustainChannels, 0, 16);
            for (int i = 0; i < 16; i++)
            {
                _activeChannels[i] = -1;
            }
            for (int i = 0; i < 128; i++)
            {
                _assignedChannels[i].chan = _assignedChannels[i].next = -1;
                _assignedChannels[i].note = _assignedChannels[i].sub = 0;
            }

            int e = 0;

            for (int i = 0; i < 6; i++)
            {
                AssignChannel(i, e++);
            }
            for (int i = 0x40; i < 0x48; i++)
            {
                AssignChannel(i, e++);
            }

            ResetTables();

            for (int i = 0; i < 64; i++)
            {
                _eventBuffer[i] = new DlEvent();
            }
            _bufferedEventsCount = 0;

            _playing       = _endOfTrack = _suspendParsing = _loop = false;
            _elapsedEvents = 0;
            _tempoDiff     = 0;

            ResetTempo();

            SetTempoIntern(_defaultTempo);

            ResetControl();
        }
Пример #3
0
        void FlushEventBuffer()
        {
            int ei = 0;

            for (int i = _bufferedEventsCount; i != 0; ei++)
            {
                DlEvent e = _eventBuffer[ei];
                if (e.evt == 0)
                {
                    continue;
                }
                ProcessBufferNote(e.mode, e.evt, e.note, e.velo);
                e.evt = 0;
                --i;
                --_bufferedEventsCount;
            }
        }
Пример #4
0
        void UpdateEventBuffer()
        {
            var ei = 0;

            for (int i = _bufferedEventsCount; i != 0; ei++)
            {
                DlEvent e = _eventBuffer[ei];
                if (e.evt == 0)
                {
                    continue;
                }
                if ((--e.len) != 0)
                {
                    --i;
                    continue;
                }
                ProcessBufferNote(e.mode, e.evt, e.note, e.velo);
                e.evt = 0;
                --i;
                --_bufferedEventsCount;
            }
        }
Пример #5
0
        public bool Init()
        {
            if (!_intf.Init())
                return false;

            _activeChannels = new sbyte[16];
            _sustainChannels = new sbyte[16];
            _assignedChannels = new ActiveChannel[128];
            for (int i = 0; i < _assignedChannels.Length; i++)
            {
                _assignedChannels[i] = new ActiveChannel();
            }
            _eventBuffer = new DlEvent[64];

            _tEnable = new byte[32];
            _tMode = new byte[32];
            _tOrdr = new byte[32];
            _tLevel = new sbyte[32];
            _tTranspose = new sbyte[32];

            Reset();

            return true;
        }
Пример #6
0
        void Reset()
        {
            _intf.Callback(0);

            _intf.Callback(74);
            _intf.Callback(70, 0);
            _intf.Callback(75, 3);

            SetTimerA(true, 1);
            SetTimerA(false, 1);
            SetTimerB(true, 221);

            _paraCount = _command = _para[0] = _para[1] = 0;
            Array.Clear(_sustainChannels, 0, 16);
            for (int i = 0; i < 16; i++)
            {
                _activeChannels[i] = -1;
            }
            for (int i = 0; i < 128; i++)
            {
                _assignedChannels[i].chan = _assignedChannels[i].next = -1;
                _assignedChannels[i].note = _assignedChannels[i].sub = 0;
            }

            int e = 0;
            for (int i = 0; i < 6; i++)
                AssignChannel(i, e++);
            for (int i = 0x40; i < 0x48; i++)
                AssignChannel(i, e++);

            ResetTables();

            for (int i = 0; i < 64; i++)
            {
                _eventBuffer[i] = new DlEvent();
            }
            _bufferedEventsCount = 0;

            _playing = _endOfTrack = _suspendParsing = _loop = false;
            _elapsedEvents = 0;
            _tempoDiff = 0;

            ResetTempo();

            SetTempoIntern(_defaultTempo);

            ResetControl();
        }