コード例 #1
0
    private void Start()
    {
        vcaControl   = FMODUnity.RuntimeManager.GetVCA("vca:/" + vcaName);
        volumeSlider = GetComponent <Slider>();

        vcaControl.getVolume(out vcaVolume);

        switch (vcaName)
        {
        case "Master":
            savedVolMaster = PlayerPrefs.GetFloat("MasterVol", 1);
            vcaControl.setVolume(savedVolMaster);
            volumeSlider.value = savedVolMaster;
            volumeShower.text  = "Master Volume: " + (savedVolMaster * 100).ToString("F0");
            break;

        case "Music":
            savedVolMusic = PlayerPrefs.GetFloat("MusicVol", 1);
            vcaControl.setVolume(savedVolMusic);
            volumeSlider.value = savedVolMusic;
            volumeShower.text  = "Music Volume: " + (savedVolMusic * 100).ToString("F0");
            break;

        case "SFX":
            savedVolSfx = PlayerPrefs.GetFloat("SFXVol", 1);
            vcaControl.setVolume(savedVolSfx);
            volumeSlider.value = savedVolSfx;
            volumeShower.text  = "SFX Volume: " + (savedVolSfx * 100).ToString("F0");
            break;
        }
    }
コード例 #2
0
    public void SetVCAVolume(string _name, float _volume)
    {
        VCA vca = RuntimeManager.GetVCA("vca:/" + _name);

        if (vca.isValid())
        {
            vca.setVolume(_volume);
        }
    }
コード例 #3
0
 public void SetSFXVolume(float volume)
 {
     if (this.sfxVCA == null)
     {
         this.sfxVCA = FMOD_StudioSystem.instance.GetVCA("vca:/SFX Volume Control");
     }
     if (this.sfxVCA != null)
     {
         this.sfxVCA.setFaderLevel(volume);
     }
 }
コード例 #4
0
    public VCA GetVCA(string path)
    {
        VCA vCA = null;

        FMOD_StudioSystem.ERRCHECK(this.system.getVCA(path, out vCA));
        if (vCA == null)
        {
            UnityUtil.Log("GetVCA FAILED!!!");
        }
        return(vCA);
    }
コード例 #5
0
    private void InitializeManager()
    {
        MusicVCA = RuntimeManager.GetVCA("vca:/Music");
        FXVCA    = RuntimeManager.GetVCA("vca:/FX");
        SetFXVolume(1.0f);
        SetMusicVolume(1.0f);

        CheckCamera();

        ChangePlayingMusic();
    }
コード例 #6
0
    protected override void OnOpen()
    {
        _masterVCAInstance = RuntimeManager.GetVCA(masterVCA);
        _musicCAInstance   = RuntimeManager.GetVCA(musicVCA);
        _sfxVCAInstance    = RuntimeManager.GetVCA(sfxVCA);

        _masterVCAInstance.getVolume(out var masterVolume);
        masterVolumeSlider.SetValueWithoutNotify(masterVolume);

        _musicCAInstance.getVolume(out var musicVolume);
        musicVolumeSlider.SetValueWithoutNotify(musicVolume);

        _sfxVCAInstance.getVolume(out var sfxVolume);
        effectsVolumeSlider.SetValueWithoutNotify(sfxVolume);

        masterVolumeSlider.onValueChanged.AddListener((x) => HandleVolumeUpdate(x, _masterVCAInstance));
        musicVolumeSlider.onValueChanged.AddListener((x) => HandleVolumeUpdate(x, _musicCAInstance));
        effectsVolumeSlider.onValueChanged.AddListener((x) => HandleVolumeUpdate(x, _sfxVCAInstance));
    }
コード例 #7
0
 private void HandleVolumeUpdate(float volume, VCA vcaInstance)
 {
     vcaInstance.setVolume(volume);
 }
コード例 #8
0
ファイル: fmod_studio.cs プロジェクト: andi2/FireStarter
            public RESULT getVCAByID(GUID guid, out VCA vca)
            {
                vca = null;

                IntPtr newPtr = new IntPtr();
                RESULT result = FMOD_Studio_System_GetVCAByID(rawPtr, ref guid, out newPtr);
                if (result != RESULT.OK)
                {
                return result;
                }

                vca = new VCA(newPtr);
                return result;
            }
コード例 #9
0
ファイル: fmod_studio.cs プロジェクト: andi2/FireStarter
            public RESULT getVCA(string path, out VCA vca)
            {
                vca = null;

                IntPtr newPtr = new IntPtr();
                RESULT result = FMOD_Studio_System_GetVCA(rawPtr, Encoding.UTF8.GetBytes(path + Char.MinValue), out newPtr);
                if (result != RESULT.OK)
                {
                return result;
                }

                vca = new VCA(newPtr);
                return result;
            }
コード例 #10
0
ファイル: fmod_studio.cs プロジェクト: andi2/FireStarter
            public RESULT getVCAList(out VCA[] array)
            {
                array = null;

                RESULT result;
                int capacity;
                result = FMOD_Studio_Bank_GetVCACount(rawPtr, out capacity);
                if (result != RESULT.OK)
                {
                return result;
                }
                if (capacity == 0)
                {
                array = new VCA[0];
                return result;
                }

                IntPtr[] rawArray = new IntPtr[capacity];
                int actualCount;
                result = FMOD_Studio_Bank_GetVCAList(rawPtr, rawArray, capacity, out actualCount);
                if (result != RESULT.OK)
                {
                return result;
                }
                if (actualCount > capacity) // More items added since we queried just now?
                {
                actualCount = capacity;
                }
                array = new VCA[actualCount];
                for (int i = 0; i < actualCount; ++i)
                {
                array[i] = new VCA(rawArray[i]);
                }
                return RESULT.OK;
            }