예제 #1
0
 void AdjustLength(Ust ust)
 {
     Log("Adjusting length", "Starting...");
     foreach (UNote note in Ust.MainNotes)
     {
         note.Length = note.InitLength;
         foreach (UNote child in note.Children)
         {
             if (child is null)
             {
                 continue;
             }
             double length = TransLength;
             Oto    oto    = Singer.FindOto(child.Phonemes);
             if (oto != null)
             {
                 length = oto.Length;
             }
             else
             {
                 Log("Converting to aliases", $"No alias found for {child.Phonemes}");
             }
             child.Length = MusicMath.MillisecondToTick(length, ust.Tempo);
             if (note.Length - child.Length < 10)
             {
                 child.Length = note.Length / 2;
             }
             note.Length -= child.Length;
         }
     }
     Log("Adjusting length", "Completed");
 }
예제 #2
0
 public Oto Substract(Oto oto)
 {
     foreach (var color in Colors)
     {
         if (oto.Alias.Contains(color.Suffix))
         {
             oto.Color = color;
             oto.Alias = oto.Alias.Replace(color.Suffix, "");
             return(oto);
         }
     }
     return(oto);
 }
예제 #3
0
 public Oto Substract(Oto oto)
 {
     foreach (var pitch in Pitches)
     {
         if (oto.Alias.Contains(pitch))
         {
             oto.Pitch = pitch;
             oto.Alias = oto.Alias.Replace(pitch, "");
             return(oto);
         }
     }
     return(oto);
 }
예제 #4
0
 public void Load()
 {
     Otos = new List <Oto> {
     };
     foreach (string sub in Subs)
     {
         string filename = Path.Combine(Dir, sub, "oto.ini");
         if (File.Exists(filename))
         {
             string[] lines = File.ReadAllLines(filename);
             foreach (string line in lines)
             {
                 string pattern = "(.*)=(.*),(.*),(.*),(.*),(.*),(.*)";
                 var    arr     = Regex.Split(line, pattern);
                 double temp;
                 if (arr.Length == 1)
                 {
                     continue;
                 }
                 Oto Oto = new Oto()
                 {
                     File         = arr[1],
                     Alias        = arr[2],
                     Offset       = double.TryParse(arr[3], out temp) ? temp : 0,
                     Consonant    = double.TryParse(arr[4], out temp) ? temp : 0,
                     Cutoff       = double.TryParse(arr[5], out temp) ? temp : 0,
                     Preutterance = double.TryParse(arr[6], out temp) ? temp : 0,
                     Overlap      = double.TryParse(arr[7], out temp) ? temp : 0,
                 };
                 Oto = Pitchmap.Substract(Oto);
                 Oto = Colormap.Substract(Oto);
                 Otos.Add(Oto);
             }
         }
         else
         {
             File.Create(filename);
         }
     }
 }