-
Notifications
You must be signed in to change notification settings - Fork 1
/
AutoSYNC.cs
76 lines (56 loc) · 2.19 KB
/
AutoSYNC.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**
* AutoSYNC by lRaulMN7 Created 3/30/2019
**/
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ScriptPortal.Vegas;
public class EntryPoint {
public void FromVegas(Vegas vegas) {
Project proj = vegas.Project;
/*foreach (Track track in proj.Tracks)
{
//Audio detection for later on...
if(track.Name == "Sync"){
//MessageBox.Show("Audio a Sync detectado");
foreach (TrackEvent trackEvent in track.Events)
{
if(trackEvent.MediaType == MediaType.Audio){
}
}
}
}*/
foreach (Track track in proj.Tracks)
{
foreach (TrackEvent trackEvent in track.Events)
{
if(trackEvent.MediaType == MediaType.Video && trackEvent.Selected ){
VideoEvent vevnt = (VideoEvent)trackEvent;
Envelopes vevntEnv = vevnt.Envelopes;
if(!vevntEnv.HasEnvelope(EnvelopeType.Velocity)) // Comprobamos si el video tiene envolvente
{
Envelope envelope = new Envelope(EnvelopeType.Velocity);
vevntEnv.Add(envelope);
}
Envelope sensitivity = vevntEnv.FindByType(EnvelopeType.Velocity);
sensitivity.Points.Clear();
Timecode timeFirst = trackEvent.Start; //Inicio del clip en milisegundos.
Timecode timeLast = trackEvent.End; //Fin del clip en milisegundos.
sensitivity.Points.GetPointAtX(Timecode.FromMilliseconds(0)).Y=3; //Modificamos el valor del punto inicial
foreach (Marker marker in proj.Markers) //Recorremos todos los marcadores
{
if( marker.Position > timeFirst && marker.Position < timeLast && marker.Label=="" ) // Miramos si el marcador esta dentro del video
{
if(sensitivity.Points.GetPointAtX(marker.Position-timeFirst) == null){ // Comprobamos que no exista ya un punto en dicha posicion.
EnvelopePoint point = new EnvelopePoint( marker.Position-timeFirst,0.15); //Creamos un nuevo punto en el marcador
sensitivity.Points.Add(point);
}
}
}
EnvelopePoint pointEnd = new EnvelopePoint(timeLast,3); //Añadimos el punto final
sensitivity.Points.Add(pointEnd);
}
}
}
}
}