Click or drag to resize

TouchTone Class

Touch tone generator.
Inheritance Hierarchy
SystemObject
  GSF.Media.SoundDTMF
    GSF.Media.SoundTouchTone

Namespace: GSF.Media.Sound
Assembly: GSF.Media (in GSF.Media.dll) Version: 2.4.205-beta
Syntax
public class TouchTone : DTMF
View Source

The TouchTone type exposes the following members.

Constructors
 NameDescription
Public methodTouchTone(Char) Constructs a new TouchTone for specified touch tone key character.
Public methodTouchTone(Int32) Constructs a new TouchTone for specified touch tone key number.
Public methodTouchTone(TouchToneKey) Constructs a new TouchTone for specified touch tone key.
Top
Methods
 NameDescription
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodStatic memberGetTouchTones(String) Get array of touch tones for given string.
Public methodStatic memberGetTouchTones(String, Double, Double) Get array of touch tones for given string.
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodStatic memberParse Converts the character representation of a touch tone key into an instance of the TouchTone class.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodStatic memberTryParse Converts the character representation of a touch tone key into an instance of the TouchTone class. A return value indicates whether the conversion succeeded.
Top
Fields
 NameDescription
Public fieldStatic memberDefaultInterKeyPause Default duration, in seconds, of pause between touch tones.
Public fieldStatic memberDefaultKeyDuration Default duration, in seconds, of touch tones.
Public fieldDurationFrequency duration, in seconds, of DTMF.
(Inherited from DTMF)
Public fieldHighFrequencyHigh frequency of DTMF.
(Inherited from DTMF)
Public fieldLowFrequencyLow frequency of DTMF.
(Inherited from DTMF)
Public fieldStatic memberValidTouchTones Valid touch tone keys.
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
Example
This example will "dial a phone number" over the computer's speakers:
C#
using System;
using GSF.Media;
using GSF.Media.Sound;

static class Program
{
    static void Main()
    {
        WaveFile waveFile = new WaveFile(SampleRate.Hz8000, BitsPerSample.Bits16, DataChannels.Mono);
        double volume = 0.25D;  // Set volume of TouchTone to 25% of maximum
        string phoneNumber = "9, 1 (535) 217-1631";

        // Generate touch tones for specified phone number
        DTMF.Generate(waveFile, TouchTone.GetTouchTones(phoneNumber), volume);

        Console.WriteLine("Dialing {0}...", phoneNumber);
        waveFile.Play();

        Console.ReadKey();
    }
}
See Also