/*void AddFilter( GATFilterType type, int slot ) * { * switch( type ) * { * case GATFilterType.Distortion: * _filters[ slot ] = _handler.AddFilter < GATDistortion >( slot ); * break; * * case GATFilterType.LFO: * _filters[ slot ] = _handler.AddFilter < GATLFO >( slot ); * break; * * case GATFilterType.LowPass: * _filters[ slot ] = _handler.AddFilter < GATLowPassFilter >( slot ); * break; * * case GATFilterType.HighPass: * _filters[ slot ] = _handler.AddFilter < GATHighPassFilter >( slot ); * break; * * case GATFilterType.Notch: * _filters[ slot ] = _handler.AddFilter < GATNotchFilter >( slot ); * break; * * case GATFilterType.Peak: * _filters[ slot ] = _handler.AddFilter < GATPeakFilter >( slot ); * break; * * case GATFilterType.LowShelf: * _filters[ slot ] = _handler.AddFilter < GATLowShelfFilter >( slot ); * break; * * case GATFilterType.HighShelf: * _filters[ slot ] = _handler.AddFilter < GATHighShelfFilter >( slot ); * break; * * case GATFilterType.GainAndClip: * _filters[ slot ] = _handler.AddFilter < GATGainFilter >( slot ); * break; * } * * _filterTypes[ slot ] = type; * _filterNames[ slot ] = type.ToString(); * }*/ void AddFilter(System.Type type, int slot) { MethodInfo generic = __addFilterMethod.MakeGenericMethod(type); _filters[slot] = ( AGATFilter )generic.Invoke(_handler, new object[] { slot }); _filterNames[slot] = AGATMonoFilter.FilterNameForType(type); }
/// <summary> /// Adds a filter of the specified type. /// Returns a reference to the AGATMonoFilter base /// class, which should be casted to the requested type. /// </summary> public AGATMonoFilter AddFilter <T>() where T : AGATMonoFilter { AGATMonoFilter filter = ScriptableObject.CreateInstance <T>(); _filters.Add(filter); return(filter); }
/// <summary> /// Inserts a filter of the specified type. /// Returns a reference to the AGATMonoFilter base /// class, which should be casted to the requested type. /// </summary> public AGATMonoFilter AddFilter <T>(int index) where T : AGATMonoFilter { if (index > _filters.Count) { index = _filters.Count; } AGATMonoFilter filter = ScriptableObject.CreateInstance <T>(); _filters.Insert(index, filter); return(filter); }
/// <summary> /// Initialize a filter parameter handler for the given filter. /// paramName should be the exact name of the property /// to tweak. /// </summary> public GATFilterParam( AGATMonoFilter filter, string paramName ) { Type t = filter.GetType(); _propInfo = t.GetProperty( paramName, BindingFlags.Public | BindingFlags.Instance ); if( _propInfo == null ) { throw new GATException( "No such filter!" ); } Filter = filter; }
/// <summary> /// Initialize a filter parameter handler for the given filter. /// paramName should be the exact name of the property /// to tweak. /// </summary> public GATFilterParam( AGATMonoFilter filter, string paramName ) { Type t = filter.GetType(); _propInfo = t.GetProperty( paramName, BindingFlags.Public | BindingFlags.Instance ); if( _propInfo == null ) { throw new GATException( "No such filter!" ); } Filter = filter; }
// Update track and filter info when the user switches track void UpdateCurrentTrack() { _currentTrack = GATManager.DefaultPlayer.GetTrack(_recs[_currentRecIndex].trackNb); _selectedFilter = _currentTrack.FiltersHandler.GetFilterAtSlot(0); if (_selectedFilter != null) { _trackFilterProps = _selectedFilter.GetFilterProperties(); _filterName = AGATMonoFilter.FilterNameForType(_selectedFilter.GetType()); } if (_micMode == MicMode.Track) // if we're routing the mic through a track, we should update the streamToTrack object { streamToTrack.TargetTrack = _currentTrack; } }
/// <summary> /// Removes the filter at specified slot, or does nothing if the slot is already empty. /// </summary> public void RemoveFilterAtSlot(int slotIndex) { int i; AGATMonoFilter filter = null; if (_filters.Count == 0) { return; } for (i = 0; i < _filters.Count; i++) { if (_filters[i].SlotIndex == slotIndex) { filter = _filters[i]; break; } } if (filter == null) { return; } lock ( _lock ) { _filters.Remove(filter); } if (Application.isPlaying) { Destroy(filter); } else { DestroyImmediate(filter); } }
public TrackFiltersInfo(GATFiltersHandler handler) { int i; AGATMonoFilter monoFilter; _filters = new AGATFilter[MONOFILTERS_COUNT]; _filterNames = new string[MONOFILTERS_COUNT]; _handler = handler; for (i = 0; i < MONOFILTERS_COUNT; i++) { monoFilter = handler.GetFilterAtSlot(i); if (monoFilter != null) { _filters[i] = monoFilter; _filterNames[i] = AGATMonoFilter.FilterNameForType(monoFilter.GetType()); } else { _filterNames[i] = "Slot " + i; } } }
static GATAudialDistortion() { AGATMonoFilter.RegisterMonoFilter("Audial > Distortion", typeof(GATAudialDistortion)); }
static GATDistortion() { AGATMonoFilter.RegisterMonoFilter("Distortion", typeof(GATDistortion)); }
static GATAudialSaturator() { AGATMonoFilter.RegisterMonoFilter("Audial > Saturator", typeof(GATAudialSaturator)); }
public void DrawFiltersToolbar() { int i; int slot; Rect boxRect; string[] allFilterNames; boxRect = EditorGUILayout.BeginVertical(); GUI.backgroundColor = filterBgdColor; GUI.Box(boxRect, ""); GUI.backgroundColor = Color.white; EditorGUILayout.Space(); _handler.SelectedFilterSlot = GUILayout.Toolbar(_handler.SelectedFilterSlot, _filterNames); slot = _handler.SelectedFilterSlot; EditorGUILayout.Space(); if (_filters[slot] != null) { GUI.color = Color.red; if (GUILayout.Button("Remove Filter", __filtersButtonOptions)) { RemoveFilter(slot); } GUI.color = Color.white; if (_selectedFilter != _filters[slot]) { _selectedFilter = _filters[slot]; _selectedFilterProperties = _selectedFilter.GetFilterProperties(); } if (_selectedFilter != null) { AGATFilter.FilterProperty filterProp; GUI.enabled = !_selectedFilter.Bypass; for (i = 0; i < _selectedFilterProperties.Length; i++) { filterProp = _selectedFilterProperties[i]; if (filterProp.IsGroupToggle) { filterProp.SetToggleValue(GUILayout.Toggle(filterProp.GroupToggleState, filterProp.LabelString)); if (filterProp.GroupToggleState == false) { i++; } continue; } GUILayout.BeginHorizontal(); GUILayout.Label(filterProp.LabelString, __filtersLabelOptions); filterProp.SetValue(GUILayout.HorizontalSlider(filterProp.CurrentValue, filterProp.Range.Min, filterProp.Range.Max, __sliderOptions)); GUILayout.EndHorizontal(); } GUI.enabled = true; _selectedFilter.Bypass = GUILayout.Toggle(_selectedFilter.Bypass, "Bypass"); } } else { allFilterNames = AGATMonoFilter.GetAllFilterNames(); EditorGUILayout.BeginHorizontal(); _selectedFilterIndexInOptions = EditorGUILayout.Popup(_selectedFilterIndexInOptions, allFilterNames, __filtersTypeOptions); GUI.color = Color.green; if (GUILayout.Button("Add Filter", __filtersButtonOptions)) { Type filterType = AGATMonoFilter.FilterTyperForName(allFilterNames[_selectedFilterIndexInOptions]); AddFilter(filterType, slot); } GUI.color = Color.white; EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); EditorGUILayout.EndVertical(); }
static GATLowShelfFilter() { AGATMonoFilter.RegisterMonoFilter("Low Shelf", typeof(GATLowShelfFilter)); }
static GATHighShelfFilter() { AGATMonoFilter.RegisterMonoFilter("High Shelf", typeof(GATHighShelfFilter)); }
static GATLFO() { AGATMonoFilter.RegisterMonoFilter("LFO", typeof(GATLFO)); }
static GATDelay() { AGATMonoFilter.RegisterMonoFilter("Delay", typeof(GATDelay)); }
static GATPeakFilter() { AGATMonoFilter.RegisterMonoFilter("Peak", typeof(GATPeakFilter)); }
static GATNotchFilter() { AGATMonoFilter.RegisterMonoFilter("Notch", typeof(GATNotchFilter)); }
static GATAudialSimpleDelay() { AGATMonoFilter.RegisterMonoFilter("Audial > Simple Delay", typeof(GATAudialSimpleDelay)); }
static GATHighPassFilter() { AGATMonoFilter.RegisterMonoFilter("High Pass", typeof(GATHighPassFilter)); }
static GATGainFilter() { AGATMonoFilter.RegisterMonoFilter("Gain and Clip", typeof(GATGainFilter)); }
/// <summary> /// Removes the specified filter. /// </summary> public void RemoveFilter(AGATMonoFilter filter) { _filters.Remove(filter); }
static GATLowPassFilter() { AGATMonoFilter.RegisterMonoFilter("Low Pass", typeof(GATLowPassFilter)); }