/// <summary> /// Sets the normalized (Range 0-1) volume value for given volume group /// </summary> public void SetGroupVolume(VolumeGroup volumeGroup, float normalizedVolume) { bool volumeSet = audioMixer.SetFloat(volumeGroup.ToString(), NormalizedToMixerValue(normalizedVolume)); if (volumeSet) { switch (volumeGroup) { case VolumeGroup.Master: masterVolume = normalizedVolume; break; case VolumeGroup.Music: musicVolume = normalizedVolume; break; case VolumeGroup.SFX: sfxVolume = normalizedVolume; break; } } else { Debug.LogError("The AudioMixer parameter was not found"); } }
private void LoadGroupVolumeFromFile(VolumeGroup volumeGroup) { string path = Path.Combine("Audio", "Profiles", $"{name}-{volumeGroup}.txt"); if (FileStorageSystem.LoadPlainText <float>(path, out LoadResult <string> loadResult)) { SetGroupVolume(volumeGroup, float.Parse(loadResult.data)); } }
public float GetGroupVolume(VolumeGroup volumeGroup) { if (audioMixer.GetFloat(volumeGroup.ToString(), out float rawVolume)) { return(MixerValueToNormalized(rawVolume)); } else { Debug.LogError("The AudioMixer parameter was not found"); return(0f); } }
/// <summary> /// Initializes a new instance of the <see cref="AddEditVolumeGroupForm" /> class. /// </summary> /// <param name="currentStorageConfig">The selected storage config.</param> /// <param name="selectedVolumeGroup">The selected volume group.</param> public AddEditVolumeGroupForm(Configuration.Storage currentStorageConfig, VolumeGroup selectedVolumeGroup) { InitializeComponent(); SelectedVolumeGroup = selectedVolumeGroup; CurrentStorageConfig = currentStorageConfig; if (SelectedVolumeGroup != null) { Text = @"Edit Volume Group"; btnAdd.Text = @"Save"; PopulateVolumeGroupInfo(); } }
public float GetVolumeGroup(VolumeGroup volumeGroup) { switch (volumeGroup) { case VolumeGroup.Music: return(musicVolume); case VolumeGroup.Sounds: return(soundsVolume); default: throw new System.NotImplementedException(); } }
public void SaveGroupVolumeToFile(VolumeGroup volumeGroup) { string path = Path.Combine("Audio", "Profiles", $"{name}-{volumeGroup}.txt"); switch (volumeGroup) { case VolumeGroup.Master: FileStorageSystem.SaveAsPlainText(path, masterVolume); break; case VolumeGroup.Music: FileStorageSystem.SaveAsPlainText(path, musicVolume); break; case VolumeGroup.SFX: FileStorageSystem.SaveAsPlainText(path, sfxVolume); break; } }
public void SetVolumeGroup(VolumeGroup volumeGroup, float volume) { switch (volumeGroup) { case VolumeGroup.Music: musicVolume = volume; //PlayerPrefs.SetFloat("MusicVolume", musicVolume); break; case VolumeGroup.Sounds: soundsVolume = volume; //PlayerPrefs.SetFloat("SoundsVolume", soundsVolume); break; } foreach (AudioSourceClass audioSource in audioSources) { if (audioSource.VolumeGroup == volumeGroup) { audioSource.audioSource.volume = volume * audioSource.defaultVolume; } } }
public VolumeGroup SinglePartMinSizeVG(string imgName, int hdNumberToGet, int partToGet) { Image image = new Image(); image.ID = image.GetImageID(imgName); image.Read(image); Image_Physical_Specs ips = new Image_Physical_Specs(); if (!string.IsNullOrEmpty(image.ClientSizeCustom)) { ips = JsonConvert.DeserializeObject <Image_Physical_Specs>(image.ClientSizeCustom); } else { ips = JsonConvert.DeserializeObject <Image_Physical_Specs>(image.ClientSize); } int lbs_BYTE = Convert.ToInt32(ips.hd[hdNumberToGet].lbs); //Determine if any Volume Groups Are present. Needed ahead of time correctly calculate sizes. //And calculate minimum needed lvm partition size VolumeGroup VG = new VolumeGroup(); VG.minSize_BLK = 0; VG.hasLv = false; if (ips.hd[hdNumberToGet].partition[partToGet].fsid.ToLower() == "8e" || ips.hd[hdNumberToGet].partition[partToGet].fsid.ToLower() == "8e00") { if (ips.hd[hdNumberToGet].partition[partToGet].active != "1") { return(VG); } //if part.vg is null, most likely version 2.3.0 beta1 before lvm was added. if (ips.hd[hdNumberToGet].partition[partToGet].vg != null) { //if vg.name is null partition was uploaded at physical partion level, not using the resize flag if (ips.hd[hdNumberToGet].partition[partToGet].vg.name != null) { VG.name = ips.hd[hdNumberToGet].partition[partToGet].vg.name; foreach (var lv in ips.hd[hdNumberToGet].partition[partToGet].vg.lv) { if (lv.active != "1") { continue; } VG.hasLv = true; VG.pv = ips.hd[hdNumberToGet].partition[partToGet].vg.pv; if (!string.IsNullOrEmpty(lv.size_override)) { VG.minSize_BLK += Convert.ToInt64(lv.size_override); } else { if (string.IsNullOrEmpty(lv.resize)) { VG.minSize_BLK += Convert.ToInt64(lv.size); } else { if (Convert.ToInt64(lv.resize) > Convert.ToInt64(lv.used_mb)) { VG.minSize_BLK += (Convert.ToInt64(lv.resize) * 1024 * 1024) / lbs_BYTE; } else { VG.minSize_BLK += (Convert.ToInt64(lv.used_mb) * 1024 * 1024) / lbs_BYTE; } } } } //Could Have VG Without LVs //Set arbitary minimum size to 100mb if (!VG.hasLv) { VG.pv = ips.hd[hdNumberToGet].partition[partToGet].vg.pv; VG.minSize_BLK = (Convert.ToInt64("100") * 1024 * 1024) / lbs_BYTE; } } } } return(VG); }
public static VolumeGroup ConvertVolumeGroup(int i) { return(VolumeGroup.GetVolumeGroup(i)); }