Esempio n. 1
0
 public UIParams(ref WaveformPainter wavePainter, ref VolumeMeter volumeMeter, PCMAudioFormat format = PCMAudioFormat.PCM_24, Mode mode = Mode.Auscultate)
 {
     this.WavePainter = wavePainter;
     this.VolumeMeter = volumeMeter;
     this.Format      = format;
     this.Mode        = mode;
 }
Esempio n. 2
0
        protected override void LoadComplete()
        {
            VolumeMeter meter;
            MuteButton  mute;

            Add(meter = new VolumeMeter("MASTER", 125, Colour4.Blue)
            {
                Position = new Vector2(10)
            });
            AddSliderStep("master volume", 0, 10, 0, i => meter.Bindable.Value = i * 0.1);

            Add(new VolumeMeter("BIG", 250, Colour4.Red)
            {
                Anchor   = Anchor.Centre,
                Origin   = Anchor.Centre,
                Position = new Vector2(10),
            });

            Add(mute = new MuteButton
            {
                Margin = new MarginPadding {
                    Top = 200
                }
            });

            AddToggleStep("mute", b => mute.Current.Value = b);
        }
    private void Start()
    {
        _audioListener = (AudioListener)UnityEngine.Object.FindObjectOfType(typeof(AudioListener));
        VolumeMeter component = base.gameObject.GetComponent <VolumeMeter>();

        if (component != null)
        {
            component.CollectAudioComponents();
        }
    }
Esempio n. 4
0
        private void load(AudioManager audio, OsuColour colours)
        {
            AutoSizeAxes     = Axes.X;
            RelativeSizeAxes = Axes.Y;

            AddRange(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = 300,
                    Colour           = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.75f), Color4.Black.Opacity(0))
                },
                muteButton = new MuteButton
                {
                    Anchor  = Anchor.BottomLeft,
                    Origin  = Anchor.BottomLeft,
                    Margin  = new MarginPadding(10),
                    Current = { BindTarget = IsMuted }
                },
                volumeMeters = new SelectionCycleFillFlowContainer <VolumeMeter>
                {
                    Direction    = FillDirection.Vertical,
                    AutoSizeAxes = Axes.Both,
                    Anchor       = Anchor.CentreLeft,
                    Origin       = Anchor.CentreLeft,
                    Spacing      = new Vector2(0, offset),
                    Margin       = new MarginPadding {
                        Left = offset
                    },
                    Children = new[]
                    {
                        volumeMeterEffect = new VolumeMeter("EFFECTS", 125, colours.BlueDarker),
                        volumeMeterMaster = new VolumeMeter("MASTER", 150, colours.PinkDarker),
                        volumeMeterMusic  = new VolumeMeter("MUSIC", 125, colours.BlueDarker),
                    }
                }
            });

            volumeMeterMaster.Bindable.BindTo(audio.Volume);
            volumeMeterEffect.Bindable.BindTo(audio.VolumeSample);
            volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack);

            IsMuted.BindValueChanged(muted =>
            {
                if (muted.NewValue)
                {
                    audio.AddAdjustment(AdjustableProperty.Volume, muteAdjustment);
                }
                else
                {
                    audio.RemoveAdjustment(AdjustableProperty.Volume, muteAdjustment);
                }
            });
        }
Esempio n. 5
0
 private void DrawVolumeMeters(VolumeMeter volumeMeter, float length)
 {
     GUILayout.BeginVertical("box");
     GUILayout.BeginHorizontal();
     GUILayout.FlexibleSpace();
     GUILayout.Label("VolumeMeter");
     GUILayout.FlexibleSpace();
     GUILayout.EndHorizontal();
     DrawMeter("FL", volumeMeter.volumeMeterState.mPeaks.mChannels[0], length);
     DrawMeter("FR", volumeMeter.volumeMeterState.mPeaks.mChannels[1], length);
     DrawMeter("RMS", volumeMeter.volumeMeterState.mRMS, length);
     GUILayout.EndVertical();
 }
        protected override void LoadComplete()
        {
            VolumeMeter meter;
            MuteButton  mute;

            Add(meter = new VolumeMeter("MASTER", 125, Color4.Blue));
            Add(mute  = new MuteButton
            {
                Margin = new MarginPadding {
                    Top = 200
                }
            });

            AddSliderStep("master volume", 0, 10, 0, i => meter.Bindable.Value = i * 0.1);
            AddToggleStep("mute", b => mute.Current.Value = b);
        }
 public void LoadAsset(string prefabName, string destinationComponent)
 {
     if (_globalComponentTable.ContainsKey(destinationComponent))
     {
         Fabric.Component   component = _globalComponentTable[destinationComponent];
         UnityEngine.Object @object   = Resources.Load(prefabName);
         if (@object != null)
         {
             GameObject gameObject = UnityEngine.Object.Instantiate(@object) as GameObject;
             gameObject.name = gameObject.name.Replace("(Clone)", "");
             string key = destinationComponent + "_" + gameObject.name;
             if (_globalComponentTable.ContainsKey(key))
             {
                 UnityEngine.Object.Destroy(gameObject);
                 return;
             }
             gameObject.transform.parent = component.transform;
             Fabric.Component component2 = gameObject.GetComponent <Fabric.Component>();
             if (component2 != null)
             {
                 component2.Initialise(component, isComponentInstance: false);
                 component.AddComponent(component2);
                 AddChildComponentsToGlobalTable(component2, destinationComponent);
             }
             VolumeMeter component3 = component.GetComponent <VolumeMeter>();
             if (component3 != null)
             {
                 component3.CollectAudioComponents();
             }
             DebugLog.Print("Asset [" + prefabName + "] loaded succesfuly");
         }
         else
         {
             DebugLog.Print("Asset [" + prefabName + "] name not found", DebugLevel.Error);
         }
     }
     else
     {
         DebugLog.Print("Target Component [" + destinationComponent + "] not found", DebugLevel.Error);
     }
 }
Esempio n. 8
0
 private void DrawComponent(Fabric.Component component, ref float x, float y)
 {
     if (component.ToString().Contains("GroupComponent"))
     {
         GroupComponent groupComponent = (GroupComponent)component;
         if (!_soloComponents.Contains(groupComponent))
         {
             _soloComponents.Add(groupComponent);
         }
         component.ToString().LastIndexOf(".");
         string name = component.name;
         int    num  = name.Length * 10;
         float  num2 = slotHeight;
         if (num < 120)
         {
             num = 120;
         }
         VolumeMeter component2 = groupComponent.GetComponent <VolumeMeter>();
         if ((bool)component2)
         {
             num2 += 120f;
         }
         SideChain component3 = groupComponent.GetComponent <SideChain>();
         if ((bool)component3)
         {
             num2 += 120f;
         }
         GUILayout.BeginArea(new Rect(x, y, num, GetActualSize(num2)), name, GUI.skin.window);
         MixerSlot(name, groupComponent);
         if ((bool)component2)
         {
             DrawVolumeMeters(component2, GetActualSize(num - 10));
         }
         if ((bool)component3)
         {
             DrawSideChain(component3, GetActualSize(num - 30));
         }
         GUILayout.EndArea();
         x += num + 20;
     }
 }
 public void LoadAsset(GameObject component, string destinationComponent)
 {
     if (_globalComponentTable.ContainsKey(destinationComponent))
     {
         Fabric.Component component2 = _globalComponentTable[destinationComponent];
         if (component != null)
         {
             component.name = component.name.Replace("(Clone)", "");
             string key = destinationComponent + "_" + component.name;
             if (_globalComponentTable.ContainsKey(key))
             {
                 UnityEngine.Object.DestroyImmediate(component);
                 return;
             }
             component.transform.parent = component2.transform;
             Fabric.Component component3 = component.GetComponent <Fabric.Component>();
             if (component3 != null)
             {
                 component3.Initialise(component2, isComponentInstance: false);
                 component2.AddComponent(component3);
                 AddChildComponentsToGlobalTable(component3, destinationComponent);
                 VolumeMeter component4 = component2.GetComponent <VolumeMeter>();
                 if (component4 != null)
                 {
                     component4.CollectAudioComponents();
                 }
             }
             DebugLog.Print("Asset [" + component.name + "] loaded succesfuly");
         }
         else
         {
             DebugLog.Print("Asset [" + component.name + "] name not found", DebugLevel.Error);
         }
     }
     else
     {
         DebugLog.Print("Target Component [" + destinationComponent + "] not found", DebugLevel.Error);
     }
 }
        public AudioTestView()
        {
            InitializeComponent();

            volumeSlider = new VolumeSlider();
            volumeSlider.VolumeChanged   += new EventHandler(OnVolumeSliderChanged);
            this.NAudioVolumeSlider.Child = volumeSlider;

            volumeMeter1                  = new VolumeMeter();
            volumeMeter2                  = new VolumeMeter();
            volumeMeter1.ForeColor        = volumeMeter2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
            this.NAudioVolumeMeter1.Child = volumeMeter1;
            this.NAudioVolumeMeter2.Child = volumeMeter2;

            waveformPainter1           = new WaveformPainter();
            waveformPainter2           = new WaveformPainter();
            waveformPainter1.BackColor = waveformPainter2.BackColor =
                System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
            waveformPainter1.ForeColor = waveformPainter2.ForeColor =
                System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.NAudioPainter1.Child = waveformPainter1;
            this.NAudioPainter2.Child = waveformPainter2;
        }
    public bool RegisterGroupComponent(GroupComponent groupComponent, string targetGroupComponentPath, bool createProxy = true)
    {
        if (!_allowExternalGroupComponents)
        {
            DebugLog.Print("External GroupComponent registration is disabled");
            return(false);
        }
        bool result = false;

        Fabric.Component componentByName = GetComponentByName(targetGroupComponentPath);
        if (groupComponent != null)
        {
            groupComponent.Initialise(componentByName, isComponentInstance: false);
            if (componentByName != null)
            {
                componentByName.AddComponent(groupComponent);
            }
            else
            {
                _components.Add(groupComponent);
            }
            if (createProxy)
            {
                GameObject gameObject = new GameObject();
                gameObject.hideFlags = HideFlags.DontSave;
                GroupComponentProxy groupComponentProxy = gameObject.AddComponent <GroupComponentProxy>();
                groupComponentProxy._groupComponent = groupComponent;
                groupComponentProxy.name            = groupComponent.name + "_Proxy";
                if (componentByName != null)
                {
                    groupComponentProxy.transform.parent = componentByName.transform;
                }
                else
                {
                    groupComponentProxy.transform.parent = base.gameObject.transform;
                }
                _groupComponentProxies.Add(groupComponentProxy);
            }
            else if (componentByName != null)
            {
                groupComponent.transform.parent = componentByName.transform;
            }
            else
            {
                groupComponent.transform.parent = base.gameObject.transform;
            }
            if (componentByName != null)
            {
                VolumeMeter component = componentByName.GetComponent <VolumeMeter>();
                if (component != null)
                {
                    component.CollectAudioComponents();
                }
            }
            DebugLog.Print("GroupComponent [" + groupComponent.name + "] registred succesfuly");
            result = true;
        }
        else
        {
            DebugLog.Print("GroupComponent [" + groupComponent.name + "] failed to register", DebugLevel.Error);
        }
        return(result);
    }