Esempio n. 1
0
 public Reclist()
 {
     Name              = EMPTY_NAME;
     WavMask           = new WavMask(false);
     Phonemes          = new List <Phoneme>();
     Reclines          = new List <Recline>();
     reclineByFilename = new Dictionary <string, Recline>();
 }
Esempio n. 2
0
        private bool ApplyZonesAndReturnCompleted(ProjectLine projectLine, PhonemeType type)
        {
            var points   = projectLine.PointsOfType(type, false);
            var zones    = projectLine.ZonesOfType(type);
            var phonemes = projectLine.Recline.PhonemesOfType(type);
            var filename = projectLine.Recline.Name;

            zones.Clear();
            var completed = true;

            int pointI = 0;

            if (type == PhonemeType.Rest)
            {
                for (int i = 0; i < phonemes.Count; i++)
                {
                    while (WavMask.MustSkipPhoneme(filename, type, i) && i < phonemes.Count)
                    {
                        phonemes[i].IsSkipped = true;
                        i++;
                    }
                    if (i >= phonemes.Count)
                    {
                        return(completed);
                    }
                    var phoneme = phonemes[i];
                    phoneme.IsSkipped = false;

                    if ((i == 0 || i == phonemes.Count - 1) && pointI < points.Count)
                    {
                        var pointIn  = points[pointI];
                        var pointOut = points[pointI];
                        pointI++;
                        phoneme.Zone    = new Zone(pointIn, pointOut);
                        phoneme.HasZone = true;
                        zones.Add(phoneme.Zone);
                    }
                    else if (pointI + 1 >= points.Count)
                    {
                        completed       = false;
                        phoneme.Zone    = new Zone();
                        phoneme.HasZone = false;
                    }
                    else
                    {
                        var pointIn = points[pointI];
                        pointI++;
                        var pointOut = points[pointI];
                        pointI++;
                        phoneme.Zone    = new Zone(pointIn, pointOut);
                        phoneme.HasZone = true;
                        zones.Add(phoneme.Zone);
                    }
                }
            }
            else
            {
                for (int i = 0; i < phonemes.Count; i++)
                {
                    while (WavMask.MustSkipPhoneme(filename, type, i) && i < phonemes.Count)
                    {
                        phonemes[i].IsSkipped = true;
                        i++;
                    }
                    if (i >= phonemes.Count)
                    {
                        return(completed);
                    }
                    var phoneme = phonemes[i];
                    phoneme.IsSkipped = false;

                    if (pointI + 1 >= points.Count)
                    {
                        completed       = false;
                        phoneme.Zone    = new Zone();
                        phoneme.HasZone = false;
                    }
                    else
                    {
                        var pointIn = points[pointI];
                        pointI++;
                        var pointOut = points[pointI];
                        pointI++;
                        phoneme.Zone    = new Zone(pointIn, pointOut);
                        phoneme.HasZone = true;
                        zones.Add(phoneme.Zone);
                    }
                }
            }
            return(completed);
        }