Inheritance: UnityEngine.ScriptableObject
Exemple #1
0
        // 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;
            }
        }
Exemple #2
0
        public FilterProperty(PropertyInfo info, AGATFilter filterInstance)
        {
            _info = info;

            object[] attributes = info.GetCustomAttributes(typeof(FloatPropertyRange), true);

            if (attributes.Length == 0)
            {
                attributes = info.GetCustomAttributes(typeof(ToggleGroupProperty), true);
                if (attributes.Length == 1)
                {
                    _isGroupToggle = true;
                }
            }
            else
            {
                _range = ( FloatPropertyRange )attributes[0];
            }


            object val = info.GetValue(filterInstance, null);

            if (val is float)
            {
                _currentValue = ( float )val;
                _labelString  = _info.Name + ": " + _currentValue.ToString("0.00");
            }
            else if (val is double)
            {
                _currentValue = ( float )(( double )val);
                _labelString  = _info.Name + ": " + _currentValue.ToString("0.00");
            }
            else if (val is bool)
            {
                GroupToggleState = ( bool )val;
                _labelString     = _info.Name;
            }

            _filter = filterInstance;
        }
Exemple #3
0
        public FilterProperty( PropertyInfo info, AGATFilter filterInstance )
        {
            _info = info;

            object[] attributes = info.GetCustomAttributes( typeof( FloatPropertyRange ), true );

            if( attributes.Length == 0 )
            {
                attributes = info.GetCustomAttributes( typeof( ToggleGroupProperty ), true );
                if( attributes.Length == 1 )
                {
                    _isGroupToggle = true;
                }
            }
            else
            {
                _range = ( FloatPropertyRange )attributes[ 0 ];
            }

            object val = info.GetValue( filterInstance, null );

            if( val is float )
            {
                _currentValue = ( float )val;
                _labelString = _info.Name + ": " + _currentValue.ToString("0.00");
            }
            else if( val is double )
            {
                _currentValue = ( float )( ( double )val );
                _labelString = _info.Name + ": " + _currentValue.ToString("0.00");
            }
            else if( val is bool )
            {
                GroupToggleState = ( bool )val;
                _labelString = _info.Name;
            }

            _filter = filterInstance;
        }
Exemple #4
0
 /// <summary>
 /// Applies a filter to the instance's audio data.
 /// </summary>
 public void ApplyFilter(AGATFilter filter, int fromIndex, int length, bool emptyData)
 {
     fromIndex += _offset;
     filter.ProcessChunk(_parentArray, fromIndex, length, emptyData);
 }
        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();
        }
Exemple #6
0
        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();
        }
Exemple #7
0
 /// <summary>
 /// Applies a filter to the instance's audio data.
 /// </summary>
 public void ApplyFilter( AGATFilter filter, int fromIndex, int length, bool emptyData )
 {
     fromIndex += _offset;
     filter.ProcessChunk( _parentArray, fromIndex, length, emptyData );
 }
Exemple #8
0
        // 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;
            }
        }