mciOpen.lpstrElementName = "test.avi"; // Set the filename.
mciOpen.dwStyle = WS_CHILD; // Set the style.
mciOpen.hWndParent = hWnd // Give a window handle.
//mci로 동영상 열기
if (mciSendCommand(0, MCI_OPEN,
//(DWORD)(MCI_OPEN_ELEMENT|MCI_DGV_OPEN_PARENT ),
(DWORD)(MCI_OPEN_ELEMENT),
(DWORD)(LPSTR)&mciOpen) == 0)
{
// Open operation is successful. Continue.
}
MCI_DGV_PLAY_PARMS mciPlay; // play parameters
DWORD dwFlags = 0;
//동영상 재생
mciSendCommand(wDevID, MCI_PLAY, dwFlags,
(DWORD)(LPVOID)&mciPlay);
x = waveInPrepareHeader(hWave, &wh[i], sizeof(WAVEHDR));
x = waveInAddBuffer(hWave, &wh[i], sizeof(WAVEHDR));
}
x = waveInStart(hWave);
int all_buffer=30; //
int bk=0;
int offset=0;
for ( i=0; i<all_buffer; i++)
{
WaitForSingleObject(rec_event, INFINITE);
int x = waveInUnprepareHeader(hWave, &wh[bk], sizeof(WAVEHDR));
int size = wh[bk].dwBytesRecorded;
memcpy((char *)data + offset, wh[bk].lpData, size);
offset += size;
wh[bk].dwFlags = 0L;
wh[bk].dwBufferLength = 1600*2;
wh[bk].reserved = 0L;
if (i < all_buffer-2)
{
x = waveInPrepareHeader(hWave, &wh[bk],sizeof(WAVEHDR));
x = waveInAddBuffer(hWave, &wh[bk],sizeof(WAVEHDR));
}
bk++;
if (bk == 2)
bk=0;
}
x = waveInReset(hWave);
int z[2];
for ( i=0; i<2; i++)
{
z[i] = waveInUnprepareHeader(hWave,&wh[i],sizeof(WAVEHDR));
GlobalUnlock(mmm[i]);
GlobalFree(mmm[i]);
}
CString m_strFileName;
int m_nSamplingRate = 0;;
int m_nResolution = 0;;
short m_max_amp = 0;;
short m_min_amp = 0;;
int m_nFileSize = 0;;
short *m_pBUFFER = NULL;
CFileDialog soundFileDlg(true,"wav","example.wav",OFN_OVERWRITEPROMPT,NULL,NULL);
if(IDOK==soundFileDlg.DoModal())
{
CWaveSoundRead *pWaveFileReader = new CWaveSoundRead();
//decompress 비디오 스트림으로 가져오기
//두번째 인자가 NULL이면 가져올 스트림 타겟의 포멧이 적절히 선택된다.
//직접 설정하려고 해봤자 크기정도 밖에는 선택못한다고 한다
pgf = AVIStreamGetFrameOpen(pavi, NULL);
if (pgf==NULL)
{
// An Error Occurred Opening The Frame
MessageBox (HWND_DESKTOP, "Failed To Open The AVI Frame", "Error", MB_OK | MB_ICONEXCLAMATION);
}