Esempio n. 1
0
        /// <summary>
        /// Adiciona a resposta da rodada dada.
        /// </summary>
        /// <param name="rodada">Número da rodada atual, 0 indexado.</param>
        /// <param name="resposta">A resposta dada pelo sujeito. Este método
        /// não checa se esse valor é válido.</param>
        public void OuvirResposta(int rodada, int resposta)
        {
            // Registrando cronômetro
            Cronometro.Stop();
            Tempos.Add(Cronometro.ElapsedMilliseconds);

            // Registrando resposta
            Respostas.Add(resposta);
            if (OpcoesCorretas[rodada] == resposta)
            {
                NoRespostasCorretas++;
            }
        }
Esempio n. 2
0
        private Midi.MidiTrack GetMidiHeader()
        {
            var midiHeader = new Midi.MidiTrack();

            //text(s) - name of song, artist etc., created by Gitaro
            //copyright - by Gitaro
            //midi port 0
            //time signature
            //key signature
            //set tempo
            ///////marker text (will be seen in file) - also Gitaro copyright blabla
            //end_of_track
            midiHeader.Messages.Add(new Midi.MidiMessage("track_name", new string[] { "untitled" }, 0));
            midiHeader.Messages.Add(new Midi.MidiMessage("text", new string[] { Title }, 0));
            midiHeader.Messages.Add(new Midi.MidiMessage("text", new string[] { Subtitle }, 0));
            midiHeader.Messages.Add(new Midi.MidiMessage("text", new string[] { Artist }, 0));
            midiHeader.Messages.Add(new Midi.MidiMessage("text", new string[] { Album }, 0));
            midiHeader.Messages.Add(new Midi.MidiMessage("text", new string[] { Words }, 0));
            midiHeader.Messages.Add(new Midi.MidiMessage("text", new string[] { Music }, 0));
            midiHeader.Messages.Add(new Midi.MidiMessage("copyright", new string[] { "Copyright 2017 by Gitaro" }, 0));
            midiHeader.Messages.Add(new Midi.MidiMessage("marker", new string[] { Title + " / " + Artist + " - Copyright 2017 by Gitaro" }, 0));
            midiHeader.Messages.Add(new Midi.MidiMessage("midi_port", new string[] { "0" }, 0));

            //Get tempos from List tempos, get key_signature and time_signature from barMaster
            var tempoIndex       = 0;
            var masterBarIndex   = 0;
            var currentIndex     = 0;
            var oldTimeSignature = "";
            var oldKeySignature  = "";

            if (Tempos.Count == 0)
            {
                Tempos.Add(new Tempo());
            }
            while (tempoIndex < Tempos.Count || masterBarIndex < BarMaster.Count)
            {
                //Compare next entry of both possible sources
                if (tempoIndex == Tempos.Count || Tempos[tempoIndex].Position >= BarMaster[masterBarIndex].Index) //next measure comes first
                {
                    if (!BarMaster[masterBarIndex].KeyBoth.Equals(oldKeySignature))
                    {
                        //Add Key-Sig to midiHeader
                        midiHeader.Messages.Add(new Midi.MidiMessage("key_signature", new string[] { "" + BarMaster[masterBarIndex].Key, "" + BarMaster[masterBarIndex].KeyType }, BarMaster[masterBarIndex].Index - currentIndex));
                        currentIndex = BarMaster[masterBarIndex].Index;

                        oldKeySignature = BarMaster[masterBarIndex].KeyBoth;
                    }
                    if (!BarMaster[masterBarIndex].Time.Equals(oldTimeSignature))
                    {
                        //Add Time-Sig to midiHeader
                        midiHeader.Messages.Add(new Midi.MidiMessage("time_signature", new string[] { "" + BarMaster[masterBarIndex].Num, "" + BarMaster[masterBarIndex].Den, "24", "8" }, BarMaster[masterBarIndex].Index - currentIndex));
                        currentIndex = BarMaster[masterBarIndex].Index;

                        oldTimeSignature = BarMaster[masterBarIndex].Time;
                    }
                    masterBarIndex++;
                }
                else //next tempo signature comes first
                {
                    //Add Tempo-Sig to midiHeader
                    int tempo = (int)(Math.Round((60 * 1000000) / Tempos[tempoIndex].Value));
                    midiHeader.Messages.Add(new Midi.MidiMessage("set_tempo", new string[] { "" + tempo }, Tempos[tempoIndex].Position - currentIndex));
                    currentIndex = Tempos[tempoIndex].Position;
                    tempoIndex++;
                }
            }



            midiHeader.Messages.Add(new Midi.MidiMessage("end_of_track", new string[] { }, 0));


            return(midiHeader);
        }