コード例 #1
0
        public TowerAudioEngine(BaseModel baseModel)
        {
          try
          {
            this.baseModel = baseModel;

            audioEngine = new AudioEngine("Content/8bit.xgs");
            audioEngine.Update();

            //setting the values in App.Instance.Music
            App.Instance.Model.Music.TimeSignature = new TimeSignature(4, 4);
            App.Instance.Model.Music.Tempo = 60;
            App.Instance.Model.Music.ClicksPerBeat = 4;

            //this is needed as the constructor does something magical which allows the sounds to play
            waveBanks = new LinkedList<WaveBank>();
            waveBanks.Add(new WaveBank(audioEngine, "Content/Drum Bank.xwb"));
            waveBanks.Add(new WaveBank(audioEngine, "Content/Effect Bank.xwb"));
            waveBanks.Add(new WaveBank(audioEngine, "Content/Eva Bank.xwb"));
            waveBanks.Add(new WaveBank(audioEngine, "Content/Simpleb Bank.xwb"));
            waveBanks.Add(new WaveBank(audioEngine, "Content/Spaceb Bank.xwb"));
            waveBanks.Add(new WaveBank(audioEngine, "Content/Weeping Bank.xwb"));

            drumPlayer = new DrumPlayer(audioEngine);
            melodyPlayer = new MelodyPlayer(audioEngine);
            effectPlayer = new EffectPlayer(audioEngine, this);

            App.Instance.Model.Music.Click += new EventHandler(OnClick);
            App.Instance.Model.Music.Beat += new EventHandler(OnBeat);
            App.Instance.Model.Music.Bar += new EventHandler(OnBar);
            App.Instance.Model.Update += new EventHandler<SurfaceTower.Model.EventArguments.UpdateArgs>(OnUpdate);
          }
          catch (InvalidOperationException)
          {
            Console.WriteLine("There is no audio device plugged in. AudioEngine will not be used.");
          }
        }
コード例 #2
0
        public TowerAudioEngine(BaseModel baseModel)
        {
            try
            {
                this.baseModel = baseModel;

                audioEngine = new AudioEngine("Content/8bit.xgs");
                audioEngine.Update();

                //setting the values in App.Instance.Music
                App.Instance.Model.Music.TimeSignature = new TimeSignature(4, 4);
                App.Instance.Model.Music.Tempo         = 60;
                App.Instance.Model.Music.ClicksPerBeat = 4;

                //this is needed as the constructor does something magical which allows the sounds to play
                waveBanks = new LinkedList <WaveBank>();
                waveBanks.Add(new WaveBank(audioEngine, "Content/Drum Bank.xwb"));
                waveBanks.Add(new WaveBank(audioEngine, "Content/Effect Bank.xwb"));
                waveBanks.Add(new WaveBank(audioEngine, "Content/Eva Bank.xwb"));
                waveBanks.Add(new WaveBank(audioEngine, "Content/Simpleb Bank.xwb"));
                waveBanks.Add(new WaveBank(audioEngine, "Content/Spaceb Bank.xwb"));
                waveBanks.Add(new WaveBank(audioEngine, "Content/Weeping Bank.xwb"));

                drumPlayer   = new DrumPlayer(audioEngine);
                melodyPlayer = new MelodyPlayer(audioEngine);
                effectPlayer = new EffectPlayer(audioEngine, this);

                App.Instance.Model.Music.Click += new EventHandler(OnClick);
                App.Instance.Model.Music.Beat  += new EventHandler(OnBeat);
                App.Instance.Model.Music.Bar   += new EventHandler(OnBar);
                App.Instance.Model.Update      += new EventHandler <SurfaceTower.Model.EventArguments.UpdateArgs>(OnUpdate);
            }
            catch (InvalidOperationException)
            {
                Console.WriteLine("There is no audio device plugged in. AudioEngine will not be used.");
            }
        }