Example #1
0
    // Compute the upcoming notes, i.e., the notes that have not yet been finished at the playback position.
    private List <Note> GetUpcomingSortedNotes(double positionInSongInMillis)
    {
        List <Note> result = SongMetaUtils.GetAllNotes(songMeta)
                             .Where(note => BpmUtils.BeatToMillisecondsInSong(songMeta, note.EndBeat) > positionInSongInMillis)
                             .ToList();

        result.Sort(Note.comparerByStartBeat);
        return(result);
    }
Example #2
0
    // Returns the notes in the song as well as the notes in the layers in no particular order.
    public List <Note> GetAllNotes()
    {
        List <Note> result        = new List <Note>();
        List <Note> notesInVoices = SongMetaUtils.GetAllNotes(SongMeta);
        List <Note> notesInLayers = songEditorLayerManager.GetAllNotes();

        result.AddRange(notesInVoices);
        result.AddRange(notesInLayers);
        return(result);
    }
Example #3
0
 private void Start()
 {
     button.OnClickAsObservable().Subscribe(_ =>
     {
         if (int.TryParse(numberOfBeatsInputField.text, out int spaceInBeats))
         {
             List <Note> notes = selectionController.GetSelectedNotes();
             if (notes.IsNullOrEmpty())
             {
                 notes = SongMetaUtils.GetAllNotes(songMeta);
             }
             spaceBetweenNotesAction.ExecuteAndNotify(notes, spaceInBeats);
         }
     });
 }
 private void Start()
 {
     button.OnClickAsObservable().Subscribe(_ =>
     {
         if (int.TryParse(numberOfBeatsInputField.text, out int spaceInBeats))
         {
             List <Note> selectedNotes = selectionController.GetSelectedNotes();
             if (selectedNotes.IsNullOrEmpty())
             {
                 // Perform on all notes, but per voice
                 songMeta.GetVoices()
                 .ForEach(voice => spaceBetweenNotesAction.ExecuteAndNotify(SongMetaUtils.GetAllNotes(voice), spaceInBeats));
             }
             else
             {
                 spaceBetweenNotesAction.ExecuteAndNotify(selectedNotes, spaceInBeats);
             }
         }
     });
 }
    private void CreateAddSpaceBetweenNotesDialog()
    {
        void DoAddSpaceBetweenNotes(int spaceInBeats)
        {
            List <Note> selectedNotes = selectionControl.GetSelectedNotes();

            if (selectedNotes.IsNullOrEmpty())
            {
                // Perform on all notes, but per voice
                songMeta.GetVoices()
                .ForEach(voice => spaceBetweenNotesAction.ExecuteAndNotify(SongMetaUtils.GetAllNotes(voice), spaceInBeats));
            }
            else
            {
                spaceBetweenNotesAction.ExecuteAndNotify(selectedNotes, spaceInBeats);
            }
        }

        songEditorSceneControl.CreateNumberInputDialog("Add space between notes",
                                                       "Enter the number of beats that should be the minimal distance between adjacent notes.",
                                                       spaceInBeats => DoAddSpaceBetweenNotes((int)spaceInBeats));
    }