Example #1
0
        public MidiDriver_TOWNS(IMixer mixer)
        {
            _baseTempo = 10080;
            _rand = 1;

            // We set exteral mutex handling to true to avoid lockups in SCUMM which has its own mutex.
            _intf = new TownsAudioInterface(mixer, this, true);

            _channels = new TownsMidiInputChannel[32];
            for (int i = 0; i < 32; i++)
                _channels[i] = new TownsMidiInputChannel(this, i > 8 ? (i + 1) : i);

            _out = new TownsMidiOutputChannel[6];
            for (int i = 0; i < 6; i++)
            {
                _out[i] = new TownsMidiOutputChannel(this, i);
            }

            _chanState = new TownsMidiChanState[32];
            for (int i = 0; i < _chanState.Length; i++)
            {
                _chanState[i] = new TownsMidiChanState();
            }

            _operatorLevelTable = new byte[2048];
            for (int i = 0; i < 64; i++)
            {
                for (int ii = 0; ii < 32; ii++)
                    _operatorLevelTable[(i << 5) + ii] = (byte)(((i * (ii + 1)) >> 5) & 0xff);
            }
            for (int i = 0; i < 64; i++)
                _operatorLevelTable[i << 5] = 0;
        }
Example #2
0
        public MidiDriver_TOWNS(IMixer mixer)
        {
            _baseTempo = 10080;
            _rand      = 1;

            // We set exteral mutex handling to true to avoid lockups in SCUMM which has its own mutex.
            _intf = new TownsAudioInterface(mixer, this, true);

            _channels = new TownsMidiInputChannel[32];
            for (int i = 0; i < 32; i++)
            {
                _channels[i] = new TownsMidiInputChannel(this, i > 8 ? (i + 1) : i);
            }

            _out = new TownsMidiOutputChannel[6];
            for (int i = 0; i < 6; i++)
            {
                _out[i] = new TownsMidiOutputChannel(this, i);
            }

            _chanState = new TownsMidiChanState[32];
            for (int i = 0; i < _chanState.Length; i++)
            {
                _chanState[i] = new TownsMidiChanState();
            }

            _operatorLevelTable = new byte[2048];
            for (int i = 0; i < 64; i++)
            {
                for (int ii = 0; ii < 32; ii++)
                {
                    _operatorLevelTable[(i << 5) + ii] = (byte)(((i * (ii + 1)) >> 5) & 0xff);
                }
            }
            for (int i = 0; i < 64; i++)
            {
                _operatorLevelTable[i << 5] = 0;
            }
        }