Tone Constructors

Use these constructors to instantiate the Tone class.

To set pitch, duration, and volume to default levels

Use this constructor to set tone pitch, duration, and volume to default levels:

public Tone ()

To specify pitch, duration, and volume

Use this constructor to specify tone pitch, duration, and volume:

public Tone( int Pitch, int Duration, VOLUME Vol )

where:

Pitch
Frequency in cycles-per-second (Hertz), subject to range limits defined by Tone.PITCH.

Duration
Duration in milliseconds, subject to range limits defined by Tone.DURATION.

Vol
Volume, subject to range limits defined by Tone.VOLUME.

Or:

Use this constructor to specify tone pitch, duration and volume:

public Tone( int Pitch, int Duration, int Vol )

where:

Pitch
Frequency in cycles-per-second (Hertz), subject to range limits defined by Tone.PITCH.

Duration
Duration in milliseconds, subject to range limits defined by Tone.DURATION.

Vol
Volume. The logical range is 0 to 100 on all computers. However, the physical or actual range is always considerably narrower than the logical range and is subject to the specific audio characteristics of each computer type. For instance, the most common physical range for most computer types is from 0 to 10, but some computer types demonstrate exceptions to this rule. To help make these differences more transparent to the developer, the enumeration type 'Tone.VOLUME' can be used in place of integer volume values. Tone.VOLUME also provides several special-purpose values that can be applied to the CurrentVolume property as described in the next section, Range Constants.

See the Notes for more information.

Range Constants

public int PITCH.MIN
public int PITCH.MAX
public int DURATION.MIN
public int DURATION.MAX
public enum VOLUME
{
OFF, LOW, NORMAL, LOUD, VERY_LOUD, MUTE, UNMUTE, CURRENT_CFG_VOL
}

The Tone.VOLUME enumeration type provides Tone.VOLUME.OFF and four audible volume levels calibrated to each particular computer's physical range (LOW to VERY_LOUD). Though this enumeration spans the entire volume range for all computers (for example, VERY_LOUD is always the maximum supported volume), it does not necessarily represent all possible values available within this range on all computers as some computers exceed this four-step granularity. If full volume granularity is desired, use the value Tone.VOLUME.VERY_LOUD to determine whether or not there are more than 4 audible volume levels supported on your computer.

The special-purpose value Tone.VOLUME.UNMUTE restores a Tone to its former volume after having been muted previously with Tone.VOLUME.MUTE. These values should only be used with the CurrentVolume property; they should not be used with the Tone constructor or with the Play method. Using Tone.VOLUME.MUTE with the constructor yields the maximum volume; using it with the Play method has no effect and the object's CurrentVolume property is applied instead.

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.

The special-purpose value Tone.VOLUME.CURRENT_CFG_VOL specifies the use of the current volume as configured by the device settings on the computer. This allows either the user or a remote administrative user to set the volume level outside of the context of your .NET application by using configuration tools provided on the device. Subsequent changes to the device's volume setting are automatically re-applied to Tone objects that specify Tone.VOLUME.CURRENT_CFG_VOL.

Remote access to device settings is available on most computers. For more information on remote device configuration, see the user manual for your computer.

Notes

When using integer values to specify volume levels, be aware that computers may have different volume values and ranges. Integer Volume values outside of the range VOLUME.OFF to VOLUME.VERY_LOUD will be clamped to the nearest end of the range without generating an error or raising an exception.

The integer value 0 may be used in place of VOLUME.OFF, and the value 100 may be used in place of VOLUME.VERY_LOUD. However, these values do not represent the actual numeric range on any computer (in other words, the integer values represented by LOW, NORMAL, and LOUD cannot be interpolated from the range 0 to 100).

To implement the greatest level of granularity over the entire volume range for all computers, use all integer values between Tone.VOLUME.OFF and Tone.VOLUME.VERY_LOUD.

More Information

Tone Class