/// <summary> /// Will sey the Volumn of the givn sound instance /// </summary> /// <param name="newVolume">Must be a number btween 0 and 1 representing a value between 0% and 100%</param> /// <param name="targetSound">The identifier associated with the sound instance in question</param> /// <returns>If True, the Volumn was set. If False no changes were made</returns> public bool setVolume(double newVolume, int targetSound) { if (isLoaded() && newVolume >= 0 && newVolume <= 1 && targetSound >= 0 && targetSound < soundPlayers.Length) { updateSoundPlayerDouble volumndelegate = setVolumn; soundPlayers[targetSound].Dispatcher.Invoke(volumndelegate, new Object[] { soundPlayers[targetSound], targetSound }); return(true); } return(false); }
/// <summary> /// Will set the Volume of all instances of this sound to the given Level /// </summary> /// <param name="newVolume">Must be a number btween 0 and 1 representing a value between 0% and 100%</param> /// <returns>If True, the Volumn was set. If False no changes were made</returns> public bool setVolume(double newVolume) { if (isLoaded() && newVolume >= 0 && newVolume <= 1) { Object[] args = new Object[] { null, newVolume }; for (int loop = 0; loop < soundPlayers.Length; loop++) { updateSoundPlayerDouble volumndelegate = setVolumn; args[0] = soundPlayers[loop]; soundPlayers[loop].Dispatcher.Invoke(volumndelegate, args); } return(true); } return(false); }