NScumm.Scumm.Audio.Players.Player_AppleII.StartSound C# (CSharp) Метод

StartSound() публичный Метод

public StartSound ( int nr ) : void
nr int
Результат void
        public void StartSound(int nr)
        {
            lock (_mutex)
            {
                var data = _vm.ResourceManager.GetSound(_vm.Sound.MusicType, nr);
                Debug.Assert(data != null);
                const int ptr1 = 4;

                ResetState();
                _soundNr = nr;
                _type = data[ptr1];
                _loop = (data.Length > 5) ? data[ptr1 + 1] : 0;
                _params = (data.Length > 6) ? new byte[data.Length - ptr1 - 2] : new byte[0];
                if (_params.Length > 0)
                {
                    Array.Copy(data, ptr1 + 2, _params, 0, _params.Length);
                }

                switch (_type)
                {
                    case 0: // empty (nothing to play)
                        ResetState();
                        return;
                    case 1:
                        _soundFunc = new AppleII_SoundFunction1_FreqUpDown();
                        break;
                    case 2:
                        _soundFunc = new AppleII_SoundFunction2_SymmetricWave();
                        break;
                    case 3:
                        _soundFunc = new AppleII_SoundFunction3_AsymmetricWave();
                        break;
                    case 4:
                        _soundFunc = new AppleII_SoundFunction4_Polyphone();
                        break;
                    case 5:
                        _soundFunc = new AppleII_SoundFunction5_Noise();
                        break;
                }
                _soundFunc.Init(this, _params);

                Debug.Assert(_loop > 0);

                Debug.WriteLine("startSound {0}: type {1}, loop {2}", nr, _type, _loop);
            }
        }