Example #1
0
        public static float GetBusVolume(AudioBusses bus)
        {
            float volume = 0;
            float final;

            switch (bus)
            {
            case AudioBusses.MainBus:
                MasterBus.getVolume(out volume, out final);
                break;

            case AudioBusses.MusicBus:
                MusicBus.getVolume(out volume, out final);
                break;

            case AudioBusses.SfxBus:
                SfxBus.getVolume(out volume, out final);
                break;

            default:
                break;
            }

            return(volume);
        }
Example #2
0
        /// <summary>
        /// <paramref name="mute"/> → TRUE for turning off audio. FALSE for turning it back on.
        /// </summary>
        public static void MuteBus(AudioBusses busToMute, bool mute)
        {
            switch (busToMute)
            {
            case AudioBusses.MainBus:
                MasterBus.setMute(mute);
                break;

            case AudioBusses.MusicBus:
                MusicBus.setMute(mute);
                break;

            case AudioBusses.SfxBus:
                SfxBus.setMute(mute);
                break;

            default:
                break;
            }
        }
Example #3
0
        /// <summary>
        /// "<paramref name="volumeToChangeWith"/>" should preferably be something small, such as 0.15f (volume increase) or -0.15f (volume decrease)
        /// <para></para> "<paramref name="volumeToChangeWith"/>" = 0 → No volume, -80 dB.
        /// <para></para> "<paramref name="volumeToChangeWith"/>" = 1 → Max volume, the level of the Bus's fader set in the Fmod-project.
        /// </summary>
        public static void SetBusVolume(AudioBusses busToChangeVolumeOn, float volumeToChangeWith)
        {
            busVolumeToSet += volumeToChangeWith;
            busVolumeToSet  = Mathf.Clamp01(busVolumeToSet);

            switch (busToChangeVolumeOn)
            {
            case AudioBusses.MainBus:
                MasterBus.setVolume(busVolumeToSet);
                break;

            case AudioBusses.MusicBus:
                MusicBus.setVolume(busVolumeToSet);
                break;

            case AudioBusses.SfxBus:
                SfxBus.setVolume(busVolumeToSet);
                break;

            default:
                break;
            }
            //print(busVolumeToSet);
        }