Во, нашел в MSDN. Хватит такого частотного диапазона?
#define DEFINE_GUIDS 1
#include "windows.h"
#include "stdio.h"
#include "wfmtmidi.h"
/*
DTMF frequencies:
DTMF stands for Dual Tone Multi Frequency. These are the tones used
for key presees on a telephone touchpad. The tone of the button is the
sum of the column and row tones. The ABCD keys do not exist on standard
telephones.
Frequency 1
1209 1336 1477 1633
------------------------
697 | 1 2 3 A
770 | 4 5 6 B
Frequency 2 852 | 7 8 9 C
941 | * 0 # D
Frequencies of other telephone tones
Type Hz On Off
-------------------------------------------
Dial Tone 350 & 400 --- ---
Busy Signal 480 & 620 0.5 0.5
Toll Congestion 480 & 620 0.2 0.3
Ringback (Normal) 440 & 480 2.0 4.0
Ringback (PBX) 440 & 480 1.5 4.5
Reorder (Local) 480 & 620 3.0 2.0
Invalid Number 200 & 400
Hang Up Warning 1400 & 2060 0.1 0.1
Hang Up 2450 & 2600 --- ---
*/
HANDLE hEvent;
void CALLBACK waveOutProc(
HWAVEOUT hwo,
UINT uMsg,
DWORD dwInstance,
DWORD dwParam1,
DWORD dwParam2
) {
if (uMsg==WOM_DONE) {
SetEvent(hEvent);
}
return;
}
int _tmain(int argc, TCHAR *argv[]) {
hEvent=CreateEvent( NULL,TRUE,FALSE,NULL);
WAVEFORMAT_MIDI wfm;
memset(&wfm,0,sizeof(wfm));
wfm.wfx.wFormatTag=WAVE_FORMAT_MIDI;
wfm.wfx.nChannels=1;
wfm.wfx.nSamplesPerSec=32;
wfm.wfx.nAvgBytesPerSec=32;
wfm.wfx.nBlockAlign=sizeof(WAVEFORMAT_MIDI_MESSAGE);
wfm.wfx.wBitsPerSample=16;
wfm.wfx.cbSize=WAVEFORMAT_MIDI_EXTRASIZE;
wfm.USecPerQuarterNote=9600000; // Force each tick to be 1/10 sec
MMRESULT Result;
HWAVEOUT hWaveOut;
Result = waveOutOpen(&hWaveOut, WAVE_MAPPER,
(LPWAVEFORMATEX)&wfm, (DWORD)waveOutProc,
0, CALLBACK_FUNCTION);
if (Result!=MMSYSERR_NOERROR) {
return -1;
}
WAVEFORMAT_MIDI_MESSAGE MidiMessage[5];
MidiMessage[0].DeltaTicks=0;
MidiMessage[0].MidiMsg=0x203F0000 | 480;
MidiMessage[1].DeltaTicks=0;
MidiMessage[1].MidiMsg=0x203F0000 | 620;
MidiMessage[2].DeltaTicks=2;
MidiMessage[2].MidiMsg=0x303F0000 | 480;
MidiMessage[3].DeltaTicks=0;
MidiMessage[3].MidiMsg=0x303F0000 | 620;
MidiMessage[4].DeltaTicks=3;
MidiMessage[4].MidiMsg=0; // Dummy msg, does nothing
WAVEHDR WaveHdr;
WaveHdr.lpData = (LPSTR)&MidiMessage;
WaveHdr.dwBufferLength = sizeof(MidiMessage);
WaveHdr.dwFlags = WHDR_BEGINLOOP|WHDR_ENDLOOP;
WaveHdr.dwLoops = 20;
Result = waveOutPrepareHeader(hWaveOut,&WaveHdr,sizeof(WaveHdr));
Result = waveOutWrite(hWaveOut,&WaveHdr,sizeof(WaveHdr));
WaitForSingleObject(hEvent,INFINITE);
Result = waveOutUnprepareHeader(hWaveOut,&WaveHdr,sizeof(WaveHdr));
Result = waveOutClose(hWaveOut);
return 0;
}