Beispiel #1
0
        public static List <long> SplitedTickList(long TotalLength, List <NoteAtomObject> AtomList)
        {
            List <long> TickArray   = new List <long>();
            long        MaxLength   = TotalLength / AtomList.Count;
            long        autoCount   = 0;
            long        noSetLength = TotalLength;

            for (int i = 0; i < AtomList.Count; i++)
            {
                NoteAtomObject nao = AtomList[i];
                if (nao.AtomLength <= 0)
                {
                    TickArray.Add(0);
                    autoCount++;
                }
                else
                {
                    if (nao.LengthIsPercent)
                    {
                        long len = (long)(TotalLength * (double)nao.AtomLength / 100);
                        if (len > MaxLength)
                        {
                            len = MaxLength;
                        }
                        TickArray.Add(len);
                        noSetLength = noSetLength - len;
                    }
                    else
                    {
                        long len = nao.AtomLength;
                        if (len > MaxLength)
                        {
                            len = MaxLength;
                        }
                        TickArray.Add(len);
                        noSetLength = noSetLength - len;
                    }
                }
            }
            long setAtom = (long)((double)noSetLength / (double)autoCount);

            for (int i = 0; i < TickArray.Count; i++)
            {
                if (TickArray[i] == 0)
                {
                    if (autoCount > 1)
                    {
                        TickArray[i] = setAtom;
                        noSetLength  = noSetLength - setAtom;
                        autoCount--;
                    }
                    else
                    {
                        TickArray[i] = noSetLength;
                    }
                }
            }
            return(TickArray);
        }
Beispiel #2
0
 private void btn_BackPhonObj_Click(object sender, EventArgs e)
 {
     try
     {
         NoteAtomObject NAO1 = ListValue[CurrentIndex];
         ListValue.RemoveAt(CurrentIndex);
         ListValue.Insert(CurrentIndex - 1, NAO1);
         ReloadListValue();
         SetCurrentObject(CurrentIndex - 1);
         ResizeShown();
     }
     catch {; }
 }
Beispiel #3
0
 private void setupAtomPropertyView(int ObjectIndex)
 {
     if (ObjectIndex > ListValue.Count)
     {
         ObjectIndex = 0;
     }
     ;
     if (CurrentIndex == ObjectIndex)
     {
         if (ListValue.Count > 1)
         {
             if (CurrentIndex == 0)
             {
                 //第一个
                 NoteAtomObject         curObj = _ListValue[CurrentIndex];
                 FirstPhonemeAttrModels bpam   = new FirstPhonemeAttrModels(ref curObj);
                 AtomPropertyGrid.SelectedObject = bpam;
             }
             else if (CurrentIndex == ListValue.Count - 1)
             {
                 //最后一个
                 NoteAtomObject        curObj = _ListValue[CurrentIndex];
                 LastPhonemeAttrModels bpam   = new LastPhonemeAttrModels(ref curObj);
                 AtomPropertyGrid.SelectedObject = bpam;
             }
             else
             {
                 //其他
                 NoteAtomObject         curObj = _ListValue[CurrentIndex];
                 BasicPhonemeAttrModels bpam   = new BasicPhonemeAttrModels(ref curObj);
                 AtomPropertyGrid.SelectedObject = bpam;
             }
         }
         else if (ListValue.Count == 1)
         {
             NoteAtomObject          curObj = _ListValue[0];
             SinglePhonemeAttrModels bpam   = new SinglePhonemeAttrModels(ref curObj);
             AtomPropertyGrid.SelectedObject = bpam;
         }
     }
 }
Beispiel #4
0
        private void btn_AddPhonObj_Click(object sender, EventArgs e)
        {
            string input = Microsoft.VisualBasic.Interaction.InputBox("请输入要插入的部件发音符号", "添加部件", "a");

            if (input.Trim().Length > 0)
            {
                NoteAtomObject nao = new NoteAtomObject(input);
                nao.InitNoteAtom();
                try
                {
                    nao.FadeOutLengthMs = ListValue[ListValue.Count - 1].FadeOutLengthMs;
                    nao.Flags           = ListValue[ListValue.Count - 1].Flags;
                }
                catch {; }
                nao.AtomLength       = 0;
                nao.VolumePercentInt = 100;
                ListValue.Add(nao);
                ReloadListValue();
                ResizeShown();
                SetCurrentObject(ListValue.Count - 1);
            }
        }
        public void SetupCurrentPhonmem(NoteObject prevObject, NoteObject curObject, NoteObject nextObject, double BaseTempo, bool UseLyricDictionary)
        {
            if (BaseTempo <= 0)
            {
                BaseTempo = 120;
            }
            if (curObject == null)
            {
                return;
            }
            if (curObject.LockPhoneme)
            {
                return;
            }
            string prevLyric    = "{R}";
            string nextLyric    = "{R}";
            string currentLyric = curObject.Lyric;

            if (prevObject != null)
            {
                if (Math.Abs(curObject.Tick - (prevObject.Tick + prevObject.Length)) < 480)
                {
                    prevLyric = prevObject.Lyric;
                }
            }
            if (nextObject != null)
            {
                if (Math.Abs(nextObject.Tick - (curObject.Tick + curObject.Length)) < 480)
                {
                    nextLyric = nextObject.Lyric;
                }
            }
            List <SplitAtom> SList = null;

            if (UseLyricDictionary)
            {
                SList = GetCurrentNoteAtom(prevLyric, currentLyric, nextLyric, BaseTempo);
            }
            else
            {
                SplitAtom sa = new SplitAtom();
                sa.PhonemeAtom = currentLyric;
                SList          = new List <SplitAtom>()
                {
                    sa
                };
            }
            if (curObject.PhonemeAtoms.Count == SList.Count)
            {
                bool isSame = true;
                for (int i = 0; i < SList.Count; i++)
                {
                    if (curObject.PhonemeAtoms[i].PhonemeAtom != SList[i].PhonemeAtom)
                    {
                        isSame = false;
                        break;
                    }
                }
                if (!isSame)
                {
                    NoteAtomObject obj = curObject.PhonemeAtoms.Count > 0?curObject.PhonemeAtoms[0]:new NoteAtomObject();
                    curObject.PhonemeAtoms.Clear();
                    for (int i = 0; i < SList.Count; i++)
                    {
                        string lastPn = "";
                        if (curObject.PhonemeAtoms.Count > 0)
                        {
                            lastPn = curObject.PhonemeAtoms[curObject.PhonemeAtoms.Count - 1].PhonemeAtom;
                        }
                        if (lastPn != SList[i].PhonemeAtom)
                        {
                            NoteAtomObject nao = new NoteAtomObject();
                            nao.AtomLength      = SList[i].AtomLength;
                            nao.LengthIsPercent = SList[i].LengthIsPercent;
                            nao.PhonemeAtom     = SList[i].PhonemeAtom;
                            nao.FadeInLengthMs  = obj.FadeInLengthMs;
                            nao.FadeOutLengthMs = obj.FadeOutLengthMs;
                            nao.Flags           = obj.Flags;
                            nao.Intensity       = obj.Intensity;
                            nao.Modulation      = obj.Modulation;
                            curObject.PhonemeAtoms.Add(nao);
                        }
                    }
                }
            }
            else
            {
                NoteAtomObject obj = curObject.PhonemeAtoms.Count > 0 ? curObject.PhonemeAtoms[0] : new NoteAtomObject();
                curObject.PhonemeAtoms.Clear();
                for (int i = 0; i < SList.Count; i++)
                {
                    string lastPn = "";
                    if (curObject.PhonemeAtoms.Count > 0)
                    {
                        lastPn = curObject.PhonemeAtoms[curObject.PhonemeAtoms.Count - 1].PhonemeAtom;
                    }
                    if (lastPn != SList[i].PhonemeAtom)
                    {
                        NoteAtomObject nao = new NoteAtomObject();
                        nao.AtomLength      = SList[i].AtomLength;
                        nao.LengthIsPercent = SList[i].LengthIsPercent;
                        nao.PhonemeAtom     = SList[i].PhonemeAtom;
                        nao.FadeInLengthMs  = obj.FadeInLengthMs;
                        nao.FadeOutLengthMs = obj.FadeOutLengthMs;
                        nao.Flags           = obj.Flags;
                        nao.Intensity       = obj.Intensity;
                        nao.Modulation      = obj.Modulation;
                        curObject.PhonemeAtoms.Add(nao);
                    }
                }
            }
        }
 public SinglePhonemeAttrModels(ref NoteAtomObject BasicObj)
     : base(ref BasicObj)
 {
     this._obj = BasicObj;
 }
 public BasicPhonemeAttrModels(ref NoteAtomObject BasicObj)
 {
     this._obj = BasicObj;
 }