Tone.CurrentVolume Property

Gets or sets the volume.

Syntax

public int CurrentVolume

Property Values

Current volume level associated with the Tone object:

Tone.VOLUME.OFF
Tone.VOLUME.LOW
Tone.VOLUME.NORMAL
Tone.VOLUME.LOUD
Tone.VOLUME.VERY_LOUD
Tone.VOLUME.MUTE
Tone.VOLUME.UNMUTE
Tone.VOLUME.CURRENT_CFG_VOL

Notes

CurrentVolume provides a way to change a Tone object's volume. It accepts the Tone.VOLUME enumeration type. CurrentVolume is subject to range limits { VOLUME.OFF - VOLUME.VERY_LOUD } as defined in the Range Constants.

.NET languages such as C# permit typecasting an integer value to the VOLUME type when assigning this property. For example,

CurrentVolume = (Tone.VOLUME)10 ;

However, when using integer values, be aware that computers may have differing volume values and ranges. Integer values that fall outside of the range Tone.VOLUME.OFF to Tone.VOLUME.VERY_LOUD are clamped to the nearest end of the range without generating an error or raising an exception.

Only constructors and assignments set this property. Other methods such as Play may use this property but do not update it with values from their argument list.

The scope of the CurrentVolume property is limited to each individual Device.Audio.Tone object, and it only affects the application. It cannot be used to configure the volume on the computer so that it applies globally to all applications or all execution contexts on that device. When getting the CurrentVolume, be aware that this is the volume associated with the specific Tone instance, and not the global volume setting on your computer.

When the special-purpose value Tone.VOLUME.CURRENT_CFG_VOL is assigned to CurrentVolume, the current volume as configured by the device settings on the computer are applied. Subsequent updates to the device's volume setting are automatically re-applied to Tone objects that have been initialized using Tone.VOLUME.CURRENT_CFG_VOL.

Two special-purpose values permit muting and unmuting a Tone object, these are Tone.VOLUME.MUTE and Tone.VOLUME.UNMUTE respectively. When the former is used to mute a Tone object, the latter restores the Tone to its former volume level. If Tone.VOLUME.UNMUTE is assigned to CurrentVolume for a Tone object that is not in the muted state, it has no effect on the volume setting.

Muted tone objects can accept volume level changes via the CurrentVolume property while the tone remains muted. In this case, any value other than Tone.VOLUME.UNMUTE updates the tone's restore-level, but leaves the tone in a muted state. When Tone.VOLUME.UNMUTE is subsequently applied, the new restore-level is activated.

Example

[C#]
Honeywell.Mobility.Device.Audio.Tone  tone1 = new Honeywell.Mobility.Device.Audio.Tone( 440, 100, 0 ); // Silent tone.
tone1.CurrentVolume = Tone.VOLUME.LOUD ; // Set the Tone to LOUD.
tone1.CurrentVolume = Tone.VOLUME.MUTE ; // Mute the Tone.
... // (Other code)
tone1.CurrentVolume = Tone.VOLUME.UNMUTE ; // Restore the Tone to LOUD.

More Information

Tone Class