Ejemplo n.º 1
0
            private void _WriteNotes()
            {
                for (int i = 0; i < _Song.Notes.VoiceCount; i++)
                {
                    CVoice voice = _Song.Notes.GetVoice(i);
                    if (_Song.Notes.VoiceCount > 1)
                    {
                        _Tw.WriteLine("P" + Math.Pow(2, i));
                    }
                    int       currentBeat = 0;
                    CSongLine lastLine    = null;
                    foreach (CSongLine line in voice.Lines)
                    {
                        if (lastLine != null)
                        {
                            string lineTxt = "- " + (_GetBreakBeat(lastLine.EndBeat + 1, line.FirstNoteBeat) - currentBeat);
                            if (_Song.Relative)
                            {
                                lineTxt    += " " + (line.FirstNoteBeat - currentBeat);
                                currentBeat = line.FirstNoteBeat;
                            }
                            _Tw.WriteLine(lineTxt);
                        }
                        foreach (CSongNote note in line.Notes)
                        {
                            string tag;
                            switch (note.Type)
                            {
                            case ENoteType.Normal:
                                tag = ":";
                                break;

                            case ENoteType.Golden:
                                tag = "*";
                                break;

                            case ENoteType.Freestyle:
                                tag = "F";
                                break;

                            default:
                                throw new NotImplementedException("Note type " + note.Type);
                            }
                            _Tw.WriteLine(tag + " " + (note.StartBeat - currentBeat) + " " + note.Duration + " " + note.Tone + " " + note.Text);
                        }
                        lastLine = line;
                    }
                }
                _Tw.WriteLine("E");
            }
Ejemplo n.º 2
0
        public bool AddNote(CSongNote note, bool updateTimings = true)
        {
            int lineIndex = FindPreviousLine(note.StartBeat);

            if (lineIndex + 1 < _Lines.Count && _Lines[lineIndex + 1].FirstNoteBeat < note.EndBeat) //First note in next line starts before this one ends
            {
                return(false);
            }
            if (lineIndex < 0)
            {
                //Note is before ALL lines
                if (_Lines.Count > 0)
                {
                    //Add to first line
                    if (!_Lines[0].AddNote(note))
                    {
                        return(false);
                    }
                }
                else
                {
                    var line = new CSongLine();
                    line.AddNote(note);
                    _Lines.Add(line);
                }
            }
            else
            {
                if (!_Lines[lineIndex].AddNote(note))
                {
                    return(false);
                }
            }
            if (updateTimings)
            {
                UpdateTimings();
            }
            return(true);
        }