Class Tone
A DTMF (telephone-event) tone.
Inheritance
Namespace: FM.LiveSwitch.Dtmf
Assembly: FM.LiveSwitch.dll
Syntax
public class Tone : object
Constructors
Tone(String)
Initializes a new instance of the Tone class.
Declaration
public Tone(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
Tone(String, Int32)
Initializes a new instance of the Tone class.
Declaration
public Tone(string value, int duration)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
System.Int32 | duration | The duration. |
Properties
A
Gets A tone.
Declaration
public static Tone A { get; }
Property Value
Type | Description |
---|---|
Tone |
AValue
Gets the A value ("A").
Declaration
public static string AValue { get; }
Property Value
Type | Description |
---|---|
System.String |
B
Gets the B tone.
Declaration
public static Tone B { get; }
Property Value
Type | Description |
---|---|
Tone |
BValue
Gets the B value ("B").
Declaration
public static string BValue { get; }
Property Value
Type | Description |
---|---|
System.String |
C
Gets the C tone.
Declaration
public static Tone C { get; }
Property Value
Type | Description |
---|---|
Tone |
CValue
Gets the C value ("C").
Declaration
public static string CValue { get; }
Property Value
Type | Description |
---|---|
System.String |
D
Gets the D tone.
Declaration
public static Tone D { get; }
Property Value
Type | Description |
---|---|
Tone |
Duration
Gets or sets the duration in milliseconds.
Declaration
public int Duration { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
DValue
Gets the D value ("D").
Declaration
public static string DValue { get; }
Property Value
Type | Description |
---|---|
System.String |
Eight
Gets the eight tone.
Declaration
public static Tone Eight { get; }
Property Value
Type | Description |
---|---|
Tone |
EightValue
Gets the eight value ("8").
Declaration
public static string EightValue { get; }
Property Value
Type | Description |
---|---|
System.String |
Empty
Gets the empty tone.
Declaration
public static Tone Empty { get; }
Property Value
Type | Description |
---|---|
Tone |
EmptyValue
Gets the empty value ("").
Declaration
public static string EmptyValue { get; }
Property Value
Type | Description |
---|---|
System.String |
End
Gets or sets whether this is the final tone raised for the current value.
Declaration
public bool End { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Five
Gets the five tone.
Declaration
public static Tone Five { get; }
Property Value
Type | Description |
---|---|
Tone |
FiveValue
Gets the five value ("5").
Declaration
public static string FiveValue { get; }
Property Value
Type | Description |
---|---|
System.String |
Four
Gets the four tone.
Declaration
public static Tone Four { get; }
Property Value
Type | Description |
---|---|
Tone |
FourValue
Gets the four value ("4").
Declaration
public static string FourValue { get; }
Property Value
Type | Description |
---|---|
System.String |
Hash
Gets the hash tone.
Declaration
public static Tone Hash { get; }
Property Value
Type | Description |
---|---|
Tone |
HashValue
Gets the hash value ("#").
Declaration
public static string HashValue { get; }
Property Value
Type | Description |
---|---|
System.String |
Nine
Gets the nine tone.
Declaration
public static Tone Nine { get; }
Property Value
Type | Description |
---|---|
Tone |
NineValue
Gets the nine value ("9").
Declaration
public static string NineValue { get; }
Property Value
Type | Description |
---|---|
System.String |
One
Gets the one tone.
Declaration
public static Tone One { get; }
Property Value
Type | Description |
---|---|
Tone |
OneValue
Gets the one value ("1").
Declaration
public static string OneValue { get; }
Property Value
Type | Description |
---|---|
System.String |
Pause
Gets the pause tone.
Declaration
public static Tone Pause { get; }
Property Value
Type | Description |
---|---|
Tone |
PauseDuration
Gets the pause duration in milliseconds (2000).
Declaration
public static int PauseDuration { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
PauseValue
Gets the pause value (",").
Declaration
public static string PauseValue { get; }
Property Value
Type | Description |
---|---|
System.String |
Seven
Gets the seven tone.
Declaration
public static Tone Seven { get; }
Property Value
Type | Description |
---|---|
Tone |
SevenValue
Gets the seven value ("7").
Declaration
public static string SevenValue { get; }
Property Value
Type | Description |
---|---|
System.String |
Six
Gets the six tone.
Declaration
public static Tone Six { get; }
Property Value
Type | Description |
---|---|
Tone |
SixValue
Gets the six value ("6").
Declaration
public static string SixValue { get; }
Property Value
Type | Description |
---|---|
System.String |
Star
Gets the star tone.
Declaration
public static Tone Star { get; }
Property Value
Type | Description |
---|---|
Tone |
StarValue
Gets the star value ("*").
Declaration
public static string StarValue { get; }
Property Value
Type | Description |
---|---|
System.String |
Three
Gets the three tone.
Declaration
public static Tone Three { get; }
Property Value
Type | Description |
---|---|
Tone |
ThreeValue
Gets the three value ("3").
Declaration
public static string ThreeValue { get; }
Property Value
Type | Description |
---|---|
System.String |
Two
Gets the two tone.
Declaration
public static Tone Two { get; }
Property Value
Type | Description |
---|---|
Tone |
TwoValue
Gets the two value ("2").
Declaration
public static string TwoValue { get; }
Property Value
Type | Description |
---|---|
System.String |
Value
Gets or sets the value.
Declaration
public string Value { get; }
Property Value
Type | Description |
---|---|
System.String |
Zero
Gets the zero tone.
Declaration
public static Tone Zero { get; }
Property Value
Type | Description |
---|---|
Tone |
ZeroValue
Gets the zero value ("0").
Declaration
public static string ZeroValue { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Clone()
Clones this instance.
Declaration
public Tone Clone()
Returns
Type | Description |
---|---|
Tone |
Clone(Int32)
Clones this instance.
Declaration
public Tone Clone(int duration)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | duration | The new duration. |
Returns
Type | Description |
---|---|
Tone |
FromJson(String)
Deserializes from JSON.
Declaration
public static Tone FromJson(string toneJson)
Parameters
Type | Name | Description |
---|---|---|
System.String | toneJson | The JSON. |
Returns
Type | Description |
---|---|
Tone |
FromJsonArray(String)
Deserializes an array from JSON.
Declaration
public static Tone[] FromJsonArray(string tonesJson)
Parameters
Type | Name | Description |
---|---|---|
System.String | tonesJson | The JSON. |
Returns
Type | Description |
---|---|
Tone[] |
FromPacket(Packet, Int32)
Deserializes from a packet.
Declaration
public static Tone FromPacket(Packet packet, int clockRate)
Parameters
Type | Name | Description |
---|---|---|
Packet | packet | The packet. |
System.Int32 | clockRate | The clock rate. |
Returns
Type | Description |
---|---|
Tone |
FromToneString(String)
Converts a DTMF tone string into an array of tones. Each tone will have a duration of 100ms and an inter-tone gap of 100ms.
Declaration
public static Tone[] FromToneString(string toneString)
Parameters
Type | Name | Description |
---|---|---|
System.String | toneString | The tone string. |
Returns
Type | Description |
---|---|
Tone[] |
FromToneString(String, Int32)
Converts a DTMF tone string into an array of tones. Each tone will have an inter-tone gap of 100ms.
Declaration
public static Tone[] FromToneString(string toneString, int duration)
Parameters
Type | Name | Description |
---|---|---|
System.String | toneString | The tone string. |
System.Int32 | duration | The duration, in milliseconds (minimum of 40, maximum of 2,000). |
Returns
Type | Description |
---|---|
Tone[] |
FromToneString(String, Int32, Int32)
Converts a DTMF tone string into an array of tones.
Declaration
public static Tone[] FromToneString(string toneString, int duration, int interToneGap)
Parameters
Type | Name | Description |
---|---|---|
System.String | toneString | The tone string. |
System.Int32 | duration | The duration, in milliseconds (minimum of 40, maximum of 2,000). |
System.Int32 | interToneGap | The time between tones, in milliseconds (minimum of 40). |
Returns
Type | Description |
---|---|
Tone[] |
ToJson()
Serializes to JSON.
Declaration
public string ToJson()
Returns
Type | Description |
---|---|
System.String |
ToJson(Tone)
Serializes to JSON.
Declaration
public static string ToJson(Tone tone)
Parameters
Type | Name | Description |
---|---|---|
Tone | tone |
Returns
Type | Description |
---|---|
System.String |
ToJsonArray(Tone[])
Serializes an array to JSON.
Declaration
public static string ToJsonArray(Tone[] tones)
Parameters
Type | Name | Description |
---|---|---|
Tone[] | tones | The array. |
Returns
Type | Description |
---|---|
System.String |
ToPacket(Int32)
Serializes to a packet.
Declaration
public Packet ToPacket(int clockRate)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | clockRate | The clock rate. |
Returns
Type | Description |
---|---|
Packet |
ToString()
Serializes to a string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
ToToneString(Tone[])
Converts an array of DTMF tones into a tone string. This discards duration and inter-tone gap data.
Declaration
public static string ToToneString(Tone[] tones)
Parameters
Type | Name | Description |
---|---|---|
Tone[] | tones | The tones. |
Returns
Type | Description |
---|---|
System.String |