示例#1
0
        public string Process(RenderNote note, RenderNote prev, bool isConnectedLeft)
        {
            var editorNote = note.GetEditorNote();

            if (IsDefault)
            {
                if (!editorNote.IsConnectedLeft() && note.Lyric[0] != '-')
                {
                    return("-" + note.Lyric);
                }
                return(note.Lyric);
            }

            if (note.Part.Track.Singer.VoicebankType == "Arpasing RUS" && !note.Phonemes.Contains("-"))
            {
                if (!isConnectedLeft)
                {
                    return("- " + note.Phonemes);
                }

                var prevph = prev.Phonemes;
                return($"{prevph} {note.Phonemes}");
            }

            return(note.Lyric);
        }
示例#2
0
        public void SetNote(RenderNote note, RenderNote next)
        {
            Note = note;
            if (note.RenderPosition <= 0 || note.RenderLength <= 0)
            {
                throw new Exception();
            }

            if (note.HasOto)
            {
                Phoneme.Content = note.SafeOto.Alias;
            }
            var envelope = note.Envelope;

            var    attack               = MusicMath.Current.MillisecondToTick(envelope.p1) * PartEditor.xScale;
            var    preutterance         = MusicMath.Current.MillisecondToTick(envelope.p2) * PartEditor.xScale;
            var    length               = note.RenderLength * PartEditor.xScale;
            var    decay                = MusicMath.Current.MillisecondToTick(envelope.p3) * PartEditor.xScale;
            var    straightPreutterance = preutterance - attack;
            double cutoff               = 0;

            if (next != null)
            {
                cutoff = MusicMath.Current.MillisecondToTick(next.StraightPre) * PartEditor.xScale;
            }

            Overlap.Width = attack;
            Canvas.SetLeft(Overlap, -preutterance);
            var sustain = length + straightPreutterance - decay - cutoff;

            if (sustain >= 0)
            {
                Sustain.Width = sustain;
                Canvas.SetLeft(Sustain, -straightPreutterance);
                Sustain.Visibility = Visibility.Visible;
            }
            else
            {
                NoteMainBorder.Background = new SolidColorBrush(Color.FromArgb(140, 255, 0, 0));
                Sustain.Visibility        = Visibility.Hidden;
            }
            Decay.Width = decay;
            Canvas.SetLeft(Decay, length - decay - cutoff);

            Canvas.SetLeft(this, MusicMath.Current.GetNoteXPosition(note.FinalPosition));
            Canvas.SetTop(this, MusicMath.Current.GetNoteYPosition(note.NoteNum));
            Width = note.FinalLength * PartEditor.xScale;
        }
示例#3
0
        public string GetPitchSource(RenderNote note, double x0, double y0)
        {
            var c         = yScale;
            var pitchData = note.PitchBend.Array;
            var pitchInfo = note.PitchInfo;
            // double val = pitchInfo.Start;
            var    val         = -note.SafeOto.Preutter;
            var    xP          = MusicMath.Current.MillisecondToTick(val) * xScale;
            var    y1          = pitchData[0] / c;
            double x1          = 0;
            var    m           = 2.26;
            var    f           = "f4";
            var    pitchSource = $"M {(x0 + xP).ToString(f)} {(y0 - y1 * m).ToString(f)} ";

            for (var i = 0; i < pitchData.Length - 1; i++)
            {
                y1           = pitchData[i] / c;
                x1          += Settings.Current.IntervalTick * xScale;
                pitchSource += $"L {(x0 + xP + x1).ToString(f)} {(y0 - y1 * m).ToString(f)} ";
            }

            return(pitchSource);
        }