/// <exception cref="NGit.Api.Errors.GitAPIException"></exception> public override Note Call() { CheckCallable(); RevWalk walk = new RevWalk(repo); NoteMap map = NoteMap.NewEmptyMap(); RevCommit notesCommit = null; try { Ref @ref = repo.GetRef(notesRef); // if we have a notes ref, use it if (@ref != null) { notesCommit = walk.ParseCommit(@ref.GetObjectId()); map = NoteMap.Read(walk.GetObjectReader(), notesCommit); } return(map.GetNote(id)); } catch (IOException e) { throw new JGitInternalException(e.Message, e); } finally { walk.Release(); } }
private static void Go(long userId) { var settings = new MongoServerSettings { Server = new MongoServerAddress("127.0.0.1", 27017), SafeMode = SafeMode.False }; var mongoServer = new MongoServer(settings); var database = mongoServer.GetDatabase("Test"); var map = new NoteMap(); var collection = new EntityCollection<Note>(database, map.GetDescriptor(), true); var note = new Note { NoteID = "1", Title = "This is a book.", Content = "Oh yeah", UserID = 123321L }; // collection.InsertOnSubmit(note); // collection.SubmitChanges(); // var data = collection.SelectTo(n => new { n.NoteID, n.UserID }); collection.Log = Console.Out; var a = 4; collection.Update( n => new Note { }, n => true); }
private void AddBtn_Click(object sender, EventArgs e) { if (NoteMap == null) { return; } MapNoteDetails dlg = new MapNoteDetails { MapNoteItem = new MapNoteItem() { KeyName = "New Note Map", TriggerNoteNumber = 64, OutputNoteNumber = 64 } }; if (dlg.ShowDialog(this) == DialogResult.OK) { if (NoteMap.Contains(dlg.MapNoteItem.TriggerNoteNumber)) { NoteMap.Remove(NoteMap[dlg.MapNoteItem.TriggerNoteNumber]); } NoteMap.Add(dlg.MapNoteItem); FillList(); } }
/// <exception cref="System.IO.IOException"></exception> private void CommitNoteMap(RevWalk walk, NoteMap map, RevCommit notesCommit, ObjectInserter inserter, string msg) { // commit the note NGit.CommitBuilder builder = new NGit.CommitBuilder(); builder.TreeId = map.WriteTree(inserter); builder.Author = new PersonIdent(repo); builder.Committer = builder.Author; builder.Message = msg; if (notesCommit != null) { builder.SetParentIds(notesCommit); } ObjectId commit = inserter.Insert(builder); inserter.Flush(); RefUpdate refUpdate = repo.UpdateRef(notesRef); if (notesCommit != null) { refUpdate.SetExpectedOldObjectId(notesCommit); } else { refUpdate.SetExpectedOldObjectId(ObjectId.ZeroId); } refUpdate.SetNewObjectId(commit); refUpdate.Update(walk); }
private NoteMap CreateNoteMap(string inNotes, string outNote) { NoteMap noteMap = new NoteMap(); noteMap.InNotes = new InputValueParameters(inNotes); noteMap.OutNote = new NoteEventOutputParameters(outNote, 0, 127); return(noteMap); }
public void NoteChannelMap() { MidiMappingRules mappingRules = new MidiMappingRules(); NoteMap noteMap = new NoteMap(); noteMap.InNotes = new InputValueParameters("*"); noteMap.OutChannel = new NoteEventOutputParameters("7", 1, 16); mappingRules.NoteRules.Add(noteMap); CheckChannelMap(1, 7, mappingRules); CheckChannelMap(2, 7, mappingRules); CheckChannelMap(7, 7, mappingRules); CheckChannelMap(16, 7, mappingRules); }
private void DeleteBtn_Click(object sender, EventArgs e) { if (MapListVw.SelectedItems.Count > 0) { MapNoteItem item = (MapNoteItem)MapListVw.SelectedItems[0].Tag; if (MessageBox.Show(this, String.Format("Are you sure you want to delete {0}.", item.KeyName), "Delete a Note Map Item.", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { NoteMap.Remove(item); FillList(); } } }
private bool CompareNoteMapping(NoteMap target, SongItem.MidiNote note) { //The root octave for the wetdrymidi library is 4 var rootOffset = 4 - referenceRootOctave; if (ignoreOctave) { return(target.noteName == note.noteName); } if (ignoreName) { return(target.noteOctave == note.noteOctave - rootOffset); } return(target.noteName == note.noteName && target.noteOctave == note.noteOctave - rootOffset); }
/// <summary> /// </summary> /// <param name="octave"></param> /// <param name="numberOfSequences"> /// set to 0 if you dont want to limit the number of sequences applied. i.e. just keep going /// till we run out of notes. /// </param> /// <param name="scaleNotes"></param> public void ApplyScaleToNotesInSequence(byte octave, byte numberOfSequences, bool pingPong, params NoteMap[] scaleNotes) { if (octave > 10) { throw new ArgumentOutOfRangeException("octave must be between 0 and 10"); } //if (minOctave > maxOctave) // throw new ArgumentOutOfRangeException("minOctave cannot be higher than maxOctave"); byte octaveSize = 12; byte offset = (byte)(octave * octaveSize); Random randy = new Random(); int scaleNoteIndex = 0; int sequenceCounter = 0; //sint direction = 1; List <NoteMap> convertedNotes = new List <NoteMap>(scaleNotes);//convert so we can easily reverse foreach (Note note in this.Notes) { NoteMap scaleNote = convertedNotes[scaleNoteIndex]; note.NoteNumber = (byte)(scaleNote + offset); scaleNoteIndex++; if (scaleNoteIndex == convertedNotes.Count) { ///scale has hit the top note... sequenceCounter++; ///if numberOfSequences = 0 then we will never hit this break statement. if (sequenceCounter == numberOfSequences) { break; } if (pingPong) { convertedNotes.Reverse(); } scaleNoteIndex = 0; } } }
internal void CreateEvs() { //* create evs from notemapcf Evs = new List <clsEv>(); //for (int q = 0; q < P.F.CF.NoteMap.GetLengthQTime(); q++) { for (int q = 0; q < P.F.MaxBBT.QI; q++) { if (q > 0 && NoteMap.GetMap(q) == NoteMap.GetMap(q - 1) && //null != unrecognised chord NoteMap.GetChordAtt(q).ChordEquals(NoteMap.GetChordAtt(q - 1))) { continue; } clsMTime.clsBBT bbt = new clsMTime.clsBBT(q * P.F.TicksPerQI); clsNoteMapCF ncf = (clsNoteMapCF)NoteMap; clsEv ev = new clsEvPC(this, bbt, ncf[q], ncf.GetChordAtt(q).Root); ev.ChordQualifier = clsNoteMap.PtrToDesc(ncf.GetChordAtt(q).Qualifier); if (ev.Notes.Length == 0 && P.frmStart.chkIgnoreNullChords.Checked) { continue; //null chord } //if (ncf.ChordAtt[q].Marked > 0) ev.Mark = true; if (Evs.Count > 0 && Evs[Evs.Count - 1].Notes.Length == 0) //previous ev was null { if (bbt.Ticks - Evs[Evs.Count - 1].OnTime <= Forms.frmSC.SyncopationDefault.Ticks) { Evs.RemoveAt(Evs.Count - 1); } } if (Evs.Count > 0) { Evs[Evs.Count - 1].OffBBT = bbt; //set offtime for previous line } Evs.Add(ev); } if (Evs.Count > 0) { SetLastEv(); } SyncEvsToKeys(); //if (P.frmSC != null && P.F.AutoSync == null) P.frmSC.mnuCreateSyncFile.Enabled = true; }
public void ApplyScaleToNotesRandomly(byte octave, int jump, params NoteMap[] scaleNotes) { if (octave > 10) { throw new ArgumentOutOfRangeException("octave must be between 0 and 10"); } byte octaveSize = 12; byte offset = (byte)(octave * octaveSize); Random randy = new Random(); byte lastNoteNumber = 0; int scaleNoteIndex = 0; foreach (Note note in this.Notes) { int min = scaleNoteIndex - jump; int max = scaleNoteIndex + jump; scaleNoteIndex = randy.Next(0, scaleNotes.Length); NoteMap scaleNote = scaleNotes[scaleNoteIndex]; note.NoteNumber = (byte)(scaleNote + offset); lastNoteNumber = note.NoteNumber; } }