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; } }
public void SetVCAVolume(string _name, float _volume) { VCA vca = RuntimeManager.GetVCA("vca:/" + _name); if (vca.isValid()) { vca.setVolume(_volume); } }
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); } }
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); }
private void InitializeManager() { MusicVCA = RuntimeManager.GetVCA("vca:/Music"); FXVCA = RuntimeManager.GetVCA("vca:/FX"); SetFXVolume(1.0f); SetMusicVolume(1.0f); CheckCamera(); ChangePlayingMusic(); }
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)); }
private void HandleVolumeUpdate(float volume, VCA vcaInstance) { vcaInstance.setVolume(volume); }
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; }
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; }
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; }