public static void SaveAutomationAttributes(string trackDescription, AutomationAttributes attributes) { if (!AllAttributes.ContainsKey(trackDescription)) { AllAttributes.Add(trackDescription, attributes); } else { AllAttributes[trackDescription] = attributes; } Task.Run(() => SaveToDatabase()); }
/// <summary> /// Gets the current automated track FX. /// </summary> /// <returns>The current automated track FX.</returns> private SampleTrigger GetCurrentSampleTrigger(AutomationAttributes attributes = null) { if (CurrentTrack == null) { return(null); } if (attributes == null) { attributes = AutomationAttributesHelper.GetAutomationAttributes(CurrentTrack.Description); } var position = AudioStreamHelper.GetPosition(CurrentTrack); return(GetCurrentSampleTriggers(attributes) .OrderBy(t => Math.Abs(t.StartSample - position)) .FirstOrDefault()); }
/// <summary> /// Gets the current automated track FX. /// </summary> /// <returns>The current automated track FX.</returns> private TrackFXTrigger GetPrevTrackFxTrigger(AutomationAttributes attributes = null) { if (CurrentTrack == null) { return(null); } if (attributes == null) { attributes = AutomationAttributesHelper.GetAutomationAttributes(CurrentTrack.Description); } var position = AudioStreamHelper.GetPosition(CurrentTrack); return(attributes .TrackFXTriggers .Where(ta => ta.StartSample <= position) .OrderBy(ta => Math.Abs(ta.StartSample - position)) .FirstOrDefault()); }
/// <summary> /// Gets the sample triggers from the next track for the current track. /// </summary> /// <returns>A list of the sample triggers</returns> private List <SampleTrigger> GetNextTrackSampleTriggers(AutomationAttributes attributes = null) { if (NextTrack == null) { return(new List <SampleTrigger>()); } if (attributes == null) { attributes = AutomationAttributesHelper.GetAutomationAttributes(CurrentTrack.Description); } if (attributes == null) { return(new List <SampleTrigger>()); } var mixDetails = attributes.GetExtendedMixAttributes(NextTrack.Description); return(mixDetails == null ? new List <SampleTrigger>() : mixDetails.SampleTriggers); }
/// <summary> /// Gets the sample triggers for the current track, including ones specific to the next track /// </summary> /// <returns>A list of sample triggers, or an empty list if there are none</returns> private IEnumerable <SampleTrigger> GetCurrentSampleTriggers(AutomationAttributes attributes = null) { if (CurrentTrack == null) { return(new List <SampleTrigger>()); } if (attributes == null) { attributes = AutomationAttributesHelper.GetAutomationAttributes(CurrentTrack.Description); } if (attributes == null) { return(new List <SampleTrigger>()); } return(attributes .SampleTriggers .Union(GetNextTrackSampleTriggers()) .OrderBy(t => t.StartSample) .ToList()); }