when i am trying to record sounds it shows an error such tat"Invalid MCI device id .use the id that is returned while opening the device" i hereby have attached the code ..
void CmineDlg::OnRecord()
{
// TODO: Add your control notification handler code here
MCIWndNew(hwnd,"waveaudio");
MCI_WAVE_SET_PARMS set_parms; // audio parameters
set_parms.wFormatTag = WAVE_FORMAT_PCM;
set_parms.wBitsPerSample = 16;
set_parms.nChannels = 1;
set_parms.nSamplesPerSec = 44100;
set_parms.nBlockAlign = (set_parms.nChannels*set_parms.wBitsPerSample)/8;
set_parms.nAvgBytesPerSec = ((set_parms.wBitsPerSample) *
set_parms.nChannels *
set_parms.nSamplesPerSec)/8;
// now send the format changes with MCI_SET
int deviceID=MCIWndGetDeviceID(hwnd);
int result = mciSendCommand( deviceID, MCI_SET,
MCI_WAIT
| MCI_WAVE_SET_FORMATTAG
| MCI_WAVE_SET_BITSPERSAMPLE
| MCI_WAVE_SET_CHANNELS
| MCI_WAVE_SET_SAMPLESPERSEC
| MCI_WAVE_SET_AVGBYTESPERSEC
| MCI_WAVE_SET_BLOCKALIGN,
(DWORD)(LPVOID)&set_parms);
if ( result ) // failed?
{
char buffer[100];
mciGetErrorString(result,LPWSTR(buffer), sizeof(buffer));
AfxMessageBox(LPCTSTR(buffer));
return;
}
if (MCIWndCanRecord(hwnd))
MCIWndRecord(hwnd);
}
This post has been edited by Skydiver: 19 March 2013 - 05:31 AM
Reason for edit:: Put code into code tags. Learn to do this yourself.

New Topic/Question
Reply



MultiQuote







|