private void GenerateTutorialClips() { ChordProgression chordProgression = chordProgressionLibrary.GetFirstChordProgression(); Rhythm rhythm = GetRandomEnum <Rhythm>(); Tempo tempo = GetRandomEnum <Tempo>(); Key key = GetRandomEnum <Key>(); for (int i = 0; i < loopCount; i++) { for (int j = 0; j < 2; j++) { MusicalChange change = GetRandomMusicalChange(); if (change == MusicalChange.Tempo) { tempo = GetRandomEnumOtherThan(tempo); } else { rhythm = GetRandomEnumOtherThan(rhythm); } int chordIndex = 0; for (int k = 0; k < 4; k++) { PercussionMusicClip percussionClip = percussionClipLibrary.GetRandomClipWithRhythmAndTempo(rhythm, tempo); InputMusicClip inputClip = inputClipLibrary.GetClipWithInstrumentAndChord( Instrument.ElectricGuitar, KeyNotationToChordHelper.GetChord(key, chordProgression.chords[chordIndex])); MusicClip clip = new MusicClip(percussionClip, inputClip, null); musicMixer.QueueClip(clip); chordIndex++; } } } }
public static void ExportMsb(Stream dataStream, string outPath) { var file = MsbFile.Read(dataStream); var midiFile = new MidiFile(); var tempoMap = TempoMap.Create(new TicksPerQuarterNoteTimeDivision(960), Tempo.FromBeatsPerMinute((int)file.BpmEntries[0].Bpm)); foreach (var score in file.ScoreEntries) { var track = new TrackChunk(); var scoreNotes = new List <Note>(); foreach (var bar in score.Bars) { scoreNotes.Add(new Note(new SevenBitNumber((byte)(bar.Note + 24)), bar.Length, bar.Offset)); } track.AddNotes(scoreNotes); midiFile.Chunks.Add(track); } midiFile.ReplaceTempoMap(tempoMap); midiFile.Write(outPath); }
protected override void Execute() { var tempo = new Tempo(120, 4); var text = tempo.ToText() + " "; FileHandler.AddText(text); }
public ICommandResult Handle(NovoProgramaCommand command) { RemoveAllNotifications(); var tempo = new Tempo(command.Tempo); var potencia = new Potencia(command.Potencia); var caracter = new Caracter(command.Caracter); var aquecimento = new Aquecimento(tempo, potencia, caracter, command.Chave); var programa = new Programa(command.Nome, command.Instrucoes, aquecimento); AddNotifications(tempo.Notifications); AddNotifications(potencia.Notifications); AddNotifications(caracter.Notifications); var existePrograma = _repositorio.Get(programa.Nome) != null; if (existePrograma) { AddNotification("Nome", "Ja existe um programa com o mesmo nome informado"); } if (Invalid) { return(new NovoProgramaResult(false, "Por favor corrija os campos abaixo", Notifications)); } _repositorio.Novo(programa); return(new NovoProgramaResult(true, "Novo programa cadastrado com sucesso", new { Nome = programa.Nome })); }
public void CheckInequality_SameValues() { var tempo1 = new Tempo(200); var tempo2 = new Tempo(200); Assert.IsFalse(tempo1 != tempo2, "First tempo doesn't equal to second one."); }
public void CheckInequality_DifferentValues() { var tempo1 = new Tempo(200); var tempo2 = new Tempo(100); Assert.IsTrue(tempo1 != tempo2, "First tempo equals to second one."); }
public void GreaterOrEqual_SecondGreater() { var tempo1 = new Tempo(100); var tempo2 = new Tempo(200); Assert.IsFalse(tempo1 >= tempo2, "First tempo greater than or equals to second one."); }
private static TempoMap GenerateComplexTempoMap() { // 4/4 5/8 5/16 5/8 // |----+----+----+----|----+----+----+----|--+--+--+--+--|-+-+-+-+-|-+-+-+-+-|-+-+-+-+-|--+--+--+--+--| // 0 1 2 3 4 5 6 7 var steps = new[] { Tuple.Create(2 * MusicalTimeSpan.Whole, new TimeSignature(5, 8)), Tuple.Create(5 * MusicalTimeSpan.Eighth, new TimeSignature(5, 16)), Tuple.Create(15 * MusicalTimeSpan.Sixteenth, new TimeSignature(5, 8)), }; using (var tempoMapManager = new TempoMapManager(new TicksPerQuarterNoteTimeDivision(TicksPerQuarterNote))) { var time = new MusicalTimeSpan(); foreach (var step in steps) { time += step.Item1; tempoMapManager.SetTimeSignature(time, step.Item2); } tempoMapManager.SetTempo(new MetricTimeSpan(0, 0, 10), Tempo.FromMillisecondsPerQuarterNote(300)); tempoMapManager.SetTempo(new MetricTimeSpan(0, 1, 30), Tempo.FromMillisecondsPerQuarterNote(600)); tempoMapManager.SetTempo(new MetricTimeSpan(0, 1, 31), Tempo.FromMillisecondsPerQuarterNote(640)); return(tempoMapManager.TempoMap); } }
public void GreaterOrEqual_SecondNull() { var tempo1 = new Tempo(100); var tempo2 = default(Tempo); Assert.Throws <ArgumentNullException>(() => { var x = tempo1 >= tempo2; }, "Exception not thrown for null tempo."); }
public void GreaterOrEqual_FirstGreater() { var tempo1 = new Tempo(200); var tempo2 = new Tempo(100); Assert.IsTrue(tempo1 >= tempo2, "First tempo doesn't greater than or equals to second one."); }
public void Greater_SecondGreater() { var tempo1 = new Tempo(100); var tempo2 = new Tempo(200); Assert.IsFalse(tempo1 > tempo2, "First tempo greater than second one."); }
public void Greater_FirstGreater() { var tempo1 = new Tempo(200); var tempo2 = new Tempo(100); Assert.IsTrue(tempo1 > tempo2, "First tempo doesn't greater than second one."); }
public void LessOrEqual_SecondLess() { var tempo1 = new Tempo(200); var tempo2 = new Tempo(100); Assert.IsFalse(tempo1 <= tempo2, "First tempo less than or equals to second one."); }
public Microondas(MicroondasOperacao operacao, Tempo tempo, MicroondasStatus status, int potencia = 10) { Operacao = operacao; Tempo = tempo; Potencia = potencia; Status = status; }
public void CheckInequality_SecondNull() { var tempo1 = new Tempo(100); var tempo2 = default(Tempo); Assert.IsTrue(tempo1 != tempo2, "First tempo equals to second one."); }
public void LessOrEqual_FirstLess() { var tempo1 = new Tempo(100); var tempo2 = new Tempo(200); Assert.IsTrue(tempo1 <= tempo2, "First tempo doesn't less than or equals to second one."); }
public MusicClipSet GetFirstClipSet() { clipSets.Clear(); ChordProgression chordProgression; if (previousChordProgression == null) { chordProgression = chordProgressionLibrary.GetRandomChordProgression(); } else { chordProgression = chordProgressionLibrary.GetRandomChordProgressionOtherThan(previousChordProgression); } previousChordProgression = chordProgression; Key key = GetRandomEnum <Key>(); Rhythm rhythm = GetRandomEnum <Rhythm>(); Tempo tempo = GetRandomEnum <Tempo>(); Debug.Log($"First clip created with Tempo: {tempo}, Rhythm: {rhythm}, Key: {key} and Chord Progression: {chordProgression.name}"); MusicClipSet clipSet = GenerateClipSetWithParameters(key, tempo, rhythm, chordProgression); clipSets.Add(clipSet); return(clipSet); }
public static void UpdateBpm(MidiFile rawMidi, SongItem midi) { if (rawMidi == null) { Debug.LogError("Cannot find the midi file"); return; } midi.notes.Clear(); if (midi.bpm <= 0) { return; } var tempoMap = TempoMap.Create(Tempo.FromBeatsPerMinute(midi.bpm)); foreach (var note in rawMidi.GetNotes()) { midi.notes.Add(new SongItem.MidiNote() { noteName = ParseEnum <SongItem.NoteName>(note.NoteName.ToString()), noteOctave = note.Octave, time = GetMetricTimeSpanTotal(note.TimeAs <MetricTimeSpan>(tempoMap)), noteLength = GetMetricTimeSpanTotal(note.LengthAs <MetricTimeSpan>(tempoMap)) }); } EditorUtility.SetDirty(midi); }
public static async Task <Tempo> GetPrevisaoDoTempo(string cidade) { string appId = "00c9d7d8480e68193dc77c08e2214c76"; string queryString = "http://api.openweathermap.org/data/2.5/weather?q=" + cidade + "&units=metric" + "&appid=" + appId; dynamic resultado = await getDataFromService(queryString).ConfigureAwait(false); if (resultado["weather"] != null) { Tempo previsao = new Tempo(); previsao.Title = (string)resultado["name"]; previsao.Temperature = (string)resultado["main"]["temp"] + "C"; previsao.Wind = (string)resultado["wind"]["speed"] + "mph"; previsao.Humidity = (string)resultado["main"]["humidity"] + "%"; previsao.Visibility = (string)resultado["weather"][0]["main"]; DateTime time = new DateTime(1970, 1, 1, 0, 0, 0, 0); DateTime sunrise = time.AddSeconds((double)resultado["sys"]["sunrise"]); DateTime sunset = time.AddSeconds((double)resultado["sys"]["sunset"]); previsao.Sunrise = String.Format("{0:d/MM/YYY HH:mm:ss}", sunrise); previsao.Sunset = String.Format("{0:d/MM/YYY HH:mm:ss}", sunset); return(previsao); } else { return(null); } }
public void LessOrEqual_FirstNull() { var tempo1 = default(Tempo); var tempo2 = new Tempo(100); Assert.Throws <ArgumentNullException>(() => { var x = tempo1 <= tempo2; }, "Exception not thrown for null tempo."); }
public static async Task <Tempo> GetPrevisaoTempo(string cidade) { string appId = "suakey"; string queryString = "https://api.openweathermap.org/data/2.5/weather?q=" + cidade.Trim() + "&units=metric&appid=" + appId.Trim(); dynamic response = await getDataFromService(queryString).ConfigureAwait(false); if (response["weather"] != null) { Tempo temp = new Tempo(); temp.title = (string)response["name"]; temp.temperature = (string)response["main"]["temp"] + "C"; temp.wind = (string)response["wind"]["speed"] + "mph"; temp.humidity = (string)response["main"]["humidity"] + "%"; temp.visibility = (string)response["weather"][0]["main"]; DateTime time = new DateTime(1970, 1, 1, 0, 0, 0, 0); DateTime sunrise = time.AddSeconds((double)response["sys"]["sunrise"]); DateTime sunset = time.AddSeconds((double)response["sys"]["sunset"]); temp.sunrise = String.Format("{0:d/MM/yyyy HH:mm:ss}", sunrise); temp.sunset = String.Format("{0:d/MM/yyyy HH:mm:ss}", sunset); return(temp); } else { return(null); } }
void Start() { anim = gameObject.GetComponent <Animator>(); //destruir luzes for (int i = 0; i < 17; i++) { luzes_gerador[i] = GameObject.Find("Luz_gerador (" + i + ")").GetComponent <Light>(); luzes_gerador[i].enabled = false; } for (int i = 0; i < 14; i++) { luzes_emergencia[i] = GameObject.Find("luz_emergencia (" + i + ")").GetComponent <Light>(); luzes_emergencia[i].enabled = false; } for (int i = 0; i < 4; i++) { luzes_piscando[i] = GameObject.Find("Choquinho (" + i + ")"); Destroy(luzes_piscando[i]); } Destroy(GameObject.Find("Objeto_para_Otto")); print("OTTO"); Tela = gameObject; telaMorte = Tela.GetComponent <Tela_morte>(); tempo = GameObject.Find("TEMPO").GetComponent <Tempo>(); musica_fase = GameObject.Find("fase").GetComponent <AudioSource>(); }
public List <Tempo> ListarTodos() { List <Tempo> tempos = new List <Tempo>(); //Sala usuario = null; DataTable resultado = new DataTable(); using (OleDbConnection oConn = new OleDbConnection(ConexaoSingle.conexao)) { oConn.Open(); using (OleDbCommand cmd = new OleDbCommand(" SELECT * FROM HORARIO.DBF ORDER BY NOME")) { cmd.Connection = oConn; OleDbDataAdapter DA = new OleDbDataAdapter(cmd); DA.Fill(resultado); if (resultado.Rows.Count > 0) { for (int i = 0; i < resultado.Rows.Count; i++) { Tempo tempo = new Tempo(); tempo.Codigo = int.Parse(resultado.Rows[i]["ID"].ToString()); tempo.Nome = resultado.Rows[i]["NOME"].ToString(); tempo.Temporizador = resultado.Rows[i]["TEMPO"].ToString(); tempos.Add(tempo); } } } } return(tempos); }
public Tempo BuscarPorNome(string pNome) { Tempo tempo = null; //Sala usuario = null; DataTable resultado = new DataTable(); using (OleDbConnection oConn = new OleDbConnection(ConexaoSingle.conexao)) { oConn.Open(); using (OleDbCommand cmd = new OleDbCommand(" SELECT * FROM HORARIO.DBF where NOME = '" + pNome + "'")) { cmd.Connection = oConn; OleDbDataAdapter DA = new OleDbDataAdapter(cmd); DA.Fill(resultado); if (resultado.Rows.Count > 0) { tempo = new Tempo(); tempo.Codigo = int.Parse(resultado.Rows[0]["ID"].ToString()); tempo.Nome = resultado.Rows[0]["NOME"].ToString(); tempo.Temporizador = resultado.Rows[0]["TEMPO"].ToString(); } } } return(tempo); }
public double CalcularValorPago(Tempo tempo, DateTime HoraSaida, Precos preco) { int horaEntrada = Convert.ToInt32(tempo.HoraEntrada.ToShortTimeString().Trim().Replace(":", "")); int horaSaida = Convert.ToInt32(HoraSaida.ToShortTimeString().Trim().Replace(":", "")); double valorTotal = Convert.ToDouble(preco.PrecoSemanalManha + preco.PrecoSemanalTarde); //Preço semanal if (tempo.Feriado == false) { if (horaSaida <= 1159) { valorTotal = Convert.ToDouble(preco.PrecoSemanalManha); } else if (horaSaida >= 1200 && horaEntrada >= 1200) { valorTotal = Convert.ToDouble(preco.PrecoSemanalTarde); } return(valorTotal); } //Preço Final de semana e Feriados valorTotal = Convert.ToDouble(preco.PrecoFinalDeSemanaFeriados); return(valorTotal); }
// Start is called before the first frame update void Start() { plant = GetComponent <Plant>(); globalTempo = GameObject.FindGameObjectWithTag("Tempo").GetComponent <Tempo>(); globalTempo.beat.AddListener(changeSway); }
private void addTempo(Tempo tempo) { if (currentTempo == tempo || tempo == null) { if (currentTempo == null) { addTempo(new Tempo() { bpm = 120 }); } return; } else { currentTempo = tempo; } int speed = (60000000 / currentTempo.bpm); byte[] newTempo = new byte[3]; newTempo[0] = (byte)((speed >> 16) & 0xff); newTempo[1] = (byte)((speed >> 8) & 0xff); newTempo[2] = (byte)(speed & 0xff); sequence[0].Insert(currentTick, new MetaMessage(MetaType.Tempo, newTempo)); }
private void frm_HelpDesk_Load(object sender, EventArgs e) { if (acesso_adm == false) { var login = new frm_login(); login.Close(); } else { help_atendimento.help_ID = 4; help_atendimento.help_Nome = "Admistrador"; help_atendimento.Usu_ID = 17; } empresa.Emp_ID = Properties.Settings.Default.EMPRESA_ID; cb_config_filial.combox_Carregado_Filial(cb_provedor_atendimento_descricao, empresa); lbl_usuario.Text = "Usuário: " + help_atendimento.help_Nome; lbl_base.Text = cb_provedor_atendimento_descricao.Text; if (mes_consolidado == 0) { mes_consolidado = Convert.ToInt32(DateTime.Now.Month); set_Mes_Atual_Consolida_Atendimento(mes_consolidado); } if (ano_consolidado == 0) { ano_consolidado = Convert.ToInt32(DateTime.Now.Year); cx_ano.Text = ano_consolidado.ToString(); } Tempo.Start(); defini_sexo_imagen(sexo_usuario); }
public override int GetHashCode() { unchecked { var hashCode = (ModifiedTimestamp != null ? ModifiedTimestamp.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CreatedIn != null ? CreatedIn.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ModifiedIn != null ? ModifiedIn.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Title != null ? Title.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Language != null ? Language.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CcliIdentifier != null ? CcliIdentifier.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Copyright != null ? Copyright.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ReleaseYear != null ? ReleaseYear.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Authors != null ? Authors.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (RightsManagement != null ? RightsManagement.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Publisher != null ? Publisher.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Version != null ? Version.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Key != null ? Key.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Transposition; hashCode = (hashCode * 397) ^ (Tempo != null ? Tempo.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Variant != null ? Variant.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Themes != null ? Themes.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Comment != null ? Comment.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (SongBooks != null ? SongBooks.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Parts != null ? Parts.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PartSequence != null ? PartSequence.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (QualityIssues != null ? QualityIssues.GetHashCode() : 0); return(hashCode); } }
public void LoadSong(String songName) { // Load audio clip (from "Assets/Resources/Music") audioSource = GetComponent <AudioSource>(); audioSource.Stop(); audioSource.clip = Resources.Load <AudioClip>("Music/" + songName); // Load midi data (from "Assets/Resources/MusicData") notesInLanes = new List <List <GameNote> >(); var midiFile = MidiFile.Read(Application.dataPath + "/Resources/MusicData/" + songName + ".mid"); var tempoMap = midiFile.GetTempoMap(); // Load midi data into note names and note hit times allNotes = new List <GameNote>(); foreach (var note in midiFile.GetNotes()) { NoteName noteName = note.NoteName; MetricTimeSpan metricTimeSpan = note.TimeAs <MetricTimeSpan>(tempoMap); allNotes.Add(new GameNote(noteName, timeInSeconds(metricTimeSpan))); } for (int i = 0; i < 4; i++) { List <GameNote> laneNotes = allNotes.Where(note => note.NoteName == laneNoteNames[i]).ToList(); notesInLanes.Add(laneNotes); } sampleRate = audioSource.clip.frequency; startingTempo = tempoMap.Tempo.AtTime(0); }
static void Main(string[] args) { Tempo t = new Tempo(); t.Hora = 10; t.Minuto = 20; t.Segundo = 59; Console.WriteLine(t.ToString()); Console.Read(); }
public static void SetTimer(MusicState s, Tempo t) { Random r = new Random(); switch (s) { case MusicState.Level1: if (t == Tempo.T140) { numberOfUnits = 3; } else { numberOfUnits = 2; } break; case MusicState.Level2: if (t == Tempo.T100) { numberOfUnits = r.Next(6, 8); } else if (t == Tempo.T120) { numberOfUnits = r.Next(7, 10); } else if (t == Tempo.T140) { numberOfUnits = r.Next(9, 12); } break; case MusicState.Level3: if (t == Tempo.T100) { numberOfUnits = r.Next(4, 6); } else if (t == Tempo.T120) { numberOfUnits = r.Next(4, 7); } else if (t == Tempo.T140) { numberOfUnits = r.Next(5, 8); } break; } note = beat = bar = unit = 0; timer.Interval = (60d / (int)tempo) * 1000d / 4d; timer.Stop(); timer.Start(); }
public static void SetState(MusicState s) { if (s != state) { Global.Output += "State being set to " + s; switch (s) { case MusicState.Analysis: break; case MusicState.Level1: if (analysis != null && analysis.Length > 0) { float bpm = 0; for (int i = 0; i < analysis.Length; i++) { bpm += analysis[0].BPM; } bpm /= analysis.Length; Global.Output += "Average BPM of all players: " + bpm; tempo = Tempo.T100; SetTimer(s, tempo); } break; case MusicState.Level2: SetTimer(s, tempo); break; case MusicState.Level3: SetTimer(s, tempo); break; } state = s; } }