private async Task LoadAsync() { Envelopes.Clear(); var service = new EnvelopeManager(); var envelopes = await service.GetEnvelopeByAccountAsync(accID); foreach (var item in envelopes) { Envelopes.Add(item); } }
void ImportEnvelope(XmlElement elt, Envelopes envelopes) { EnvelopeType type = ChildEnvelopeType(elt, "Type"); Boolean isSurroundMode = (myVegas.Project.Audio.MasterBusMode == AudioBusMode.Surround); Envelope envelope = null; switch (type) { case EnvelopeType.PanY: case EnvelopeType.PanSmoothness: case EnvelopeType.PanCenter: // skip surround-related envelopes if not in surround mode if (!isSurroundMode) { return; } // make sure the surround pan position x envelope exists Envelope panEnvelope = envelopes.FindByType(EnvelopeType.Pan); if (null == panEnvelope) { panEnvelope = new Envelope(EnvelopeType.Pan); envelopes.Add(panEnvelope); } envelope = envelopes.FindByType(type); if (null == envelope) { throw new ApplicationException("Failed to create envelope of type: " + type.ToString()); } break; default: envelope = new Envelope(type); envelopes.Add(envelope); break; } ImportPoints(elt, envelope.Points); }
private async Task ReceiveEnvelopeAsync(Envelope envelope, Dispatcher dispatcher) { var envelopeViewModel = new EnvelopeViewModel { Envelope = envelope, Direction = DataOperation.Receive }; await await dispatcher.InvokeAsync(async() => { Envelopes.Add(envelopeViewModel); foreach (var macro in Macros.Where(m => m.IsActive)) { await macro.Macro.ProcessAsync(envelopeViewModel, this); } }); }
public Task OnEnvelopeAsync(T envelope, CancellationToken cancellationToken) { Envelopes.Add(envelope); return(Task.CompletedTask); }
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); } } } }
private async Task SendAsync(object parameter) { var times = 0; var repeatCountVariable = Variables.FirstOrDefault(v => v.Name == "repeatCount"); if (repeatCountVariable == null) { repeatCountVariable = new VariableViewModel() { Name = "repeatCount" }; Variables.Add(repeatCountVariable); } do { repeatCountVariable.Value = (times + 1).ToString(); await ExecuteAsync(async() => { AddStatusMessage("Sending..."); var inputJson = parameter.ToString(); if (ParseBeforeSend) { inputJson = ParseInput(inputJson, Variables); } var timeoutCancellationToken = _operationTimeout.ToCancellationToken(); var envelopeViewModel = new EnvelopeViewModel(false); envelopeViewModel.Json = inputJson; var envelope = envelopeViewModel.Envelope; envelopeViewModel.Direction = DataOperation.Send; if (SendAsRaw) { envelopeViewModel.IsRaw = true; var stream = TcpClient.GetStream(); var envelopeBytes = Encoding.UTF8.GetBytes(envelopeViewModel.Json); await stream.WriteAsync(envelopeBytes, 0, envelopeBytes.Length, timeoutCancellationToken); } else { await Transport.SendAsync(envelope, timeoutCancellationToken); envelopeViewModel.IndentJson(); } Envelopes.Add(envelopeViewModel); if (ClearAfterSent) { InputJson = string.Empty; } AddStatusMessage(string.Format("{0} envelope sent", envelope.GetType().Name)); }); } while (Repeat && RepeatTimes > ++times); }