Ejemplo n.º 1
0
        public Main()
        {
            _instance = this;

            this.FontGenerator = new Endogine.Text.FontGenerator();
            Endogine.Text.FontGenerator fg = this.FontGenerator;
            fg.UseStyleTemplate("Test1");
            fg.FontSize          = 20;
            fg.DefinedCharacters = Endogine.Text.FontGenerator.GetCharSet(Endogine.Text.FontGenerator.CharSet.Default, false, false);

            this.Score = new Score();
            this.Score.FontGenerator = fg;
            this.Score.Value         = 0;
            this.Score.Loc           = new EPointF(30, 30);

//			Endogine.Forms.Label lbl = new Endogine.Forms.Label();
//			lbl.FontGenerator = fg;
//			lbl.Text = "AbrakadagvAsk49Å";
//			lbl.Loc = new EPointF(100,100);


            this._scripter = ScriptingProvider.CreateScripter("boo");
            Hashtable htScripts = new Hashtable();

            htScripts.Add("Test", Endogine.Files.FileReadWrite.Read(Endogine.AppSettings.Instance.FindFile("test.boo")));
            this._interactorClassNames = new ArrayList();
            this._interactorClassNames.Add("Test");
            this._scripter.CompileMultiple(htScripts);


            //Hashtable htKeys = new Hashtable();
            //Endogine.KeysSteering _keys = new KeysSteering(htKeys);
            EH.Instance.KeyEvent += new KeyEventHandler(Instance_KeyEvent);

            Node   tracks = new Node();
            string sFile  = "Muppet_Show";

            sFile = "Flourish";
            float fSpeed = 1f;

            switch (sFile)
            {
            case "Flourish":
                tracks.GetOrCreate("Drums.Interactor").Text   = "X";
                tracks.GetOrCreate("Drums.LocSetter").Text    = "Default";
                tracks.GetOrCreate("Kalimba.Interactor").Text = "Shake";
                tracks.GetOrCreate("Kalimba.LocSetter").Text  = "Swirl";
                tracks.GetOrCreate("Piano.Interactor").Text   = "Default";
                sFile  = @"C:\WINDOWS\Media\" + sFile;
                fSpeed = 0.8f;
                break;

            case "Muppet_Show":
                tracks.GetOrCreate("HONKY TONK PIAN.Interactor").Text = "X";
                tracks.GetOrCreate("HONKY TONK PIAN.LocSetter").Text  = "Default";
                tracks.GetOrCreate("SAX.Interactor").Text             = "Shake";
                tracks.GetOrCreate("SAX.LocSetter").Text   = "Swirl";
                tracks.GetOrCreate("TUBA.Interactor").Text = "Default";
                break;
            }

            this._factory = new InteractorFactory(tracks);
            this._factory.ReadAheadMsecs = this._readAheadMsecs;

            sFile = Endogine.AppSettings.Instance.FindFile(sFile + ".mid");
            //sFile = @"C:\WINDOWS\Media\Flourish.MID"; //ONESTOP
            MidiFileReader reader = new MidiFileReader(sFile);

            OutputDevice output = new OutputDevice(0);

            output.Open(0);
            this._sequencer          = new SequencerBase(null, output);
            this._sequencer.Sequence = reader.Sequence;

            this._sequencer.PlaybackSpeed = fSpeed;
            this._sequencer.Start();
            //			this._sequencer.Tempo = 40;

            Endogine.Midi.Devices.EmptyMidiSender midiSender = new Endogine.Midi.Devices.EmptyMidiSender();
            //ScreenOutputDevice midiSender = new ScreenOutputDevice(this.progressBar1);
            this._sequencerPre          = new SequencerBase(null, midiSender);
            this._sequencerPre.Sequence = reader.Sequence;

            TrackPlayer tp;

            for (int i = 0; i < tracks.ChildNodes.Count; i++)
            {
                tp = this._sequencerPre.Player.GetTrackPlayer(tracks[i].Name);                 //Drums
                tp.TrackMessage += new Endogine.Midi.TrackPlayer.TrackMessageDelegate(tp_TrackMessage);
            }

            this._sequencerPre.Start();
            this._sequencerPre.Position      = (int)(this._sequencer.PlaybackTempo * this._readAheadMsecs / 1000 * 6);  //PlaybackTempo
            this._sequencerPre.PlaybackSpeed = this._sequencer.PlaybackSpeed;
            this._sequencerPre.Tempo         = this._sequencer.Tempo;
        }