I have spent the morning playing with the audio API, but so far haven't been able to confirm a proper setup. If anyone has experience in this field, I would appreciate a little guidance. Here are the steps I am following:
1) Initialize a WAVEFORMATEX structure to zero and set the sample rate, bits per second, channels, block alignment, average bytes per second, and set the format to WAVE_FORMAT_PCM.
where:
sr = 8000;
bps = 8;
c = 1;
ba = bps * c;
abps = ba * sr;
f = WAVE_FORMAT_PCM;
2) Initialize a WAVEHDR structure to zero and set the buffer length to a size compatible with the value of abps from above, pass it a buffer of that size, and set the flags to WHDR_BEGINLOOP|WHDR_ENDLOOP.
3) Format the header.
4) Open.
[ waveInOpen(&hwavein, WAVE_MAPPED, &wavefmtx, hwnd, 0, CALLBACK_WINDOW|WAVE_MAPPER); ]
5) Start.
6) Stop.
7) Unformat the header.
8) Free the buffer.
In the Window procedure, I am monitoring for the MM_WIM_OPEN, MM_WIM_CLOSE, and MM_WIM_DATA messages, and that is the problem. I am not recieving them as of yet, which leads me to believe I am doing something wrong. Any advice would be highly appreciated...