MFormats SDK

To detect a tone you should create the MFSignalingDTMF class object, configure it, subscribe to its events and process frames with it just like any other plugin. The events will rise every time it detects a signal:

Generating DTMF signals

MPlatform SDK

To generate DTMF signals you should use the DTMFToneAdd method of MFSignalingDTMF class.

Using the second parameter you can specify the DTMF creation way: replace original sound with your tone (1), or mix the tone with original sound (0).

// Create DTMF class object
MFSignalingDTMFClass m_objDTMF = new MFSignalingDTMFClass();
// Add it as plugin to another object where you plan to detect tones
// For example MFile, MLive or any other
m_objFile.PluginsAdd(m_objDTMF, 0);
// Set channel number you want to add DTMF signal to
m_objDTMF.PropsSet("channel_generate", "0");
// Generate the "5" tone
//The tone will replace the original sound of the channel
m_objDTMF.DTMFToneAdd("5", 1);
// Generate the "#12B" tones one by one with small silence spacers
// The tones will be mixed with the original sound of the channel
m_objDTMF.DTMFToneAdd("#12B", 0);

MFormats SDK

To generate DTMF signals you should process each frame with MFSignalingDTMF class object and use the DTMFToneAdd method to add the tone to the channel.

Using the second parameter you can specify the DTMF creation way: replace original sound with your tone (1), or mix the tone with original sound (0).

// Create DTMF class object
MFSignalingDTMFClass m_objDTMF = new MFSignalingDTMFClass();
// Set channel number you want to add DTMF signal to
m_objDTMF.PropsSet("channel_generate", "0");
// Generate the "5" tone
//The tone will replace the original sound of the channel
m_objDTMF.DTMFToneAdd("5", 1);
// Generate the "#12B" tones one by one with small silence spacers
// The tones will be mixed with the original sound of the channel
m_objDTMF.DTMFToneAdd("#12B", 0);
// ...
// Some threading stuff to start picking frames from the source.
// ...
// Process source frames by MDTMF class object.
m_objDTMF.ProcessFrame(pFrame, out pFrameOut, out nFramesRes, "");