Ejemplo n.º 1
0
        private void SetupMarks()
        {
            if (MarkCollections == null || !MarkCollections.Any())
            {
                LipSyncMode = LipSyncMode.Phoneme;
                return;
            }

            if (string.IsNullOrEmpty(MarkCollectionId))
            {
                var dmc = MarkCollections.FirstOrDefault(x => x.CollectionType == MarkCollectionType.Phoneme);
                if (dmc != null && string.IsNullOrEmpty(MarkCollectionId))
                {
                    MarkCollectionId = dmc.Name;
                }
            }


            IMarkCollection mc = MarkCollections.FirstOrDefault(x => x.Id == _data.MarkCollectionId);

            if (mc != null)
            {
                _marks = mc.MarksInclusiveOfTime(StartTime, StartTime + TimeSpan);
            }
            else
            {
                _marks = new List <IMark>();
            }
        }
Ejemplo n.º 2
0
 /// <inheritdoc />
 protected override void MarkCollectionsChanged()
 {
     if (LipSyncMode == LipSyncMode.MarkCollection)
     {
         var markCollection = MarkCollections.FirstOrDefault(x => x.Name.Equals(MarkCollectionId));
         InitializeMarkCollectionListeners(markCollection);
     }
 }
Ejemplo n.º 3
0
 /// <inheritdoc />
 protected override void MarkCollectionsChanged()
 {
     if (FireworksSource == FireworksSource.MarkCollection)
     {
         var markCollection = MarkCollections.FirstOrDefault(x => x.Name.Equals(MarkCollectionId));
         InitializeMarkCollectionListeners(markCollection);
     }
 }
Ejemplo n.º 4
0
 /// <inheritdoc />
 protected override void MarkCollectionsChanged()
 {
     if (StrobeSource != StrobeSource.TimeInterval)
     {
         var markCollection = MarkCollections.FirstOrDefault(x => x.Name.Equals(MarkCollectionId));
         InitializeMarkCollectionListeners(markCollection);
     }
 }
Ejemplo n.º 5
0
 /// <inheritdoc />
 protected override void MarkCollectionsChanged()
 {
     if (TextSource != TextSource.None)
     {
         var markCollection = MarkCollections.FirstOrDefault(x => x.Name.Equals(MarkCollectionId));
         InitializeMarkCollectionListeners(markCollection);
     }
 }
Ejemplo n.º 6
0
        private void SetupMarks()
        {
            IMarkCollection mc = MarkCollections.FirstOrDefault(x => x.Id == _data.MarkCollectionId);

            if (mc != null)
            {
                _marks = mc.MarksInclusiveOfTime(StartTime, StartTime + TimeSpan);
            }
            else
            {
                _marks = new List <IMark>();
            }
        }
Ejemplo n.º 7
0
        private void SetupMarks()
        {
            IMarkCollection mc = MarkCollections.FirstOrDefault(x => x.Id == _data.MarkCollectionId);

            _marks = mc?.MarksInclusiveOfTime(StartTime, StartTime + TimeSpan);
            if (_marks == null)
            {
                return;
            }

            bool        firstMark = true;
            StrobeClass t;

            foreach (var mark in _marks)
            {
                if (firstMark && mark.StartTime > StartTime)
                {
                    t = new StrobeClass {
                        StartTime = TimeSpan.Zero, CycleTime = (int)(StrobeSource == StrobeSource.MarkCollectionLabelDuration ? mark.Duration.TotalMilliseconds : GetMarkLabelValue(mark.Text))
                    };
                    _strobeClass.Add(t);
                    firstMark = false;
                }

                if (mark.StartTime < StartTime)
                {
                    continue;
                }
                t = new StrobeClass {
                    CycleTime = (int)(StrobeSource == StrobeSource.MarkCollectionLabelDuration ? mark.Duration.TotalMilliseconds : GetMarkLabelValue(mark.Text)), StartTime = mark.StartTime - StartTime
                };
                _strobeClass.Add(t);
                firstMark = false;
            }

            if (_strobeClass.Count > 0)
            {
                t = new StrobeClass {
                    CycleTime = _strobeClass.Last().CycleTime, StartTime = TimeSpan
                };
                _strobeClass.Add(t);
            }
        }
Ejemplo n.º 8
0
        private void SetupMarks()
        {
            IMarkCollection mc = MarkCollections.FirstOrDefault(x => x.Id == _data.MarkCollectionId);

            _marks = mc?.MarksInclusiveOfTime(StartTime, StartTime + TimeSpan);
        }
Ejemplo n.º 9
0
        private void SetupMarks()
        {
            IMarkCollection mc = MarkCollections.FirstOrDefault(x => x.Id == _data.MarkCollectionId);

            _marks = mc?.MarksInclusiveOfTime(StartTime, StartTime + TimeSpan);

            // Populate TextClass with start frame, mark frame and endframe
            if ((_text.Count > 0 || TextSource == TextSource.MarkCollectionLabels) && _marks != null)
            {
                var i           = 0;
                var currentMark = 0;
                foreach (var mark in _marks)
                {
                    TextClass t = new TextClass();
                    if (TextSource == TextSource.MarkCollectionLabels)
                    {
                        t.Text.Add(mark.Text);
                    }
                    else
                    {
                        foreach (string t1 in _text)
                        {
                            if (t1.Split(' ').Length > i)
                            {
                                t.Text.Add(t1.Split(' ')[i]);
                            }
                        }
                    }

                    double markTime = mark.StartTime.TotalMilliseconds - StartTime.TotalMilliseconds;
                    t.Frame = (int)markTime / 50;

                    t.EndFrame = (int)(mark.EndTime.TotalMilliseconds - StartTime.TotalMilliseconds) / 50;
                    if (_textClass.Count == 0)
                    {
                        t.StartFrame = 0;
                    }
                    else
                    {
                        t.StartFrame = ((t.Frame - _textClass[_textClass.Count - 1].Frame) / 2) + _textClass[_textClass.Count - 1].Frame;
                        if (TextDuration != TextDuration.MarkDuration)
                        {
                            _textClass[_textClass.Count - 1].EndFrame = t.StartFrame;
                        }
                    }

                    if (_marks.Count() == currentMark + 1 && TextDuration != TextDuration.MarkDuration)
                    {
                        t.EndFrame = GetNumberFrames();
                    }

                    i++;
                    if (t.Text.Count == 0 && RepeatText)
                    {
                        t.Text = _textClass[0].Text;
                        i      = 1;
                    }
                    _textClass.Add(t);
                    currentMark++;
                }
            }

            // Adjusts start and end frames for each mark depending on fade settings.
            for (var i = 0; i < _textClass.Count; i++)
            {
                TextClass text = _textClass[i];
                if (text.Text.Count == 0)
                {
                    text.Text.Add(" ");
                }
                else if (text.Text[0] == "")
                {
                    text.Text[0] = " ";
                }
                switch (TextFade)
                {
                case TextFade.In:
                    switch (TextDuration)
                    {
                    case TextDuration.AutoFit:
                        if (i != 0)
                        {
                            text.StartFrame = _textClass[i - 1].Frame;
                        }
                        text.EndFrame = text.Frame;
                        break;

                    case TextDuration.MarkDuration:
                        text.StartFrame = text.Frame;
                        break;

                    case TextDuration.UserDefined:
                        //Gets max and min frame to compare with users Visual time setting and pick the smallest.
                        int minFrameOffset = i != 0
                                                                        ? text.Frame - _textClass[i - 1].Frame
                                                                        : text.Frame;
                        text.EndFrame   = text.Frame;
                        text.StartFrame = (int)(text.Frame - Math.Min((double)TimeVisibleLength / 50, minFrameOffset));
                        break;
                    }
                    break;

                case TextFade.None:
                case TextFade.Out:
                    switch (TextDuration)
                    {
                    case TextDuration.AutoFit:
                        if (i != _textClass.Count - 1)
                        {
                            text.EndFrame = _textClass[i + 1].Frame;
                        }
                        text.StartFrame = text.Frame;
                        break;

                    case TextDuration.MarkDuration:
                        text.StartFrame = text.Frame;
                        break;

                    case TextDuration.UserDefined:
                        //Gets max and min frame to compare with users Visual time setting and pick the smallest.
                        int maxFrameOffset = i != _textClass.Count - 1
                                                                        ? _textClass[i + 1].Frame - text.Frame
                                                                        : GetNumberFrames() - text.Frame;
                        text.StartFrame = text.Frame;
                        text.EndFrame   = (int)(text.Frame + Math.Min((double)TimeVisibleLength / 50, maxFrameOffset));
                        break;
                    }
                    break;

                case TextFade.InOut:
                    switch (TextDuration)
                    {
                    case TextDuration.MarkDuration:
                        text.StartFrame = text.Frame;
                        break;

                    case TextDuration.UserDefined:
                        //Gets max and min frame to compare with users Visual time setting and pick the smallest.
                        int maxFrameOffset = i != _textClass.Count - 1
                                                                        ? _textClass[i + 1].Frame - text.Frame
                                                                        : GetNumberFrames() - text.Frame;
                        int minFrameOffset = i != 0
                                                                        ? text.Frame - _textClass[i - 1].Frame
                                                                        : text.Frame;
                        text.EndFrame   = (int)(text.Frame + Math.Min((double)TimeVisibleLength / 100, maxFrameOffset));
                        text.StartFrame = (int)(text.Frame - Math.Min((double)TimeVisibleLength / 100, minFrameOffset));
                        break;
                    }
                    break;
                }
            }
        }