strange problem (audio)
-
I met a strange problem. This is my code #include "stdafx.h" #include #include #include #pragma comment(lib, "winmm.lib") using namespace std; int _tmain(int argc, _TCHAR* argv[]) { DWORD datasize = 48000; HWAVEIN mh; WAVEFORMATEX wf; wf.wFormatTag=WAVE_FORMAT_PCM; wf.nChannels=1; wf.nSamplesPerSec=8000; wf.nAvgBytesPerSec=8000; wf.nBlockAlign=1; wf.wBitsPerSample=8; wf.cbSize=0; int r;// = ; cout << "poo1"; int k = waveInOpen(&mh,WAVE_MAPPER,&wf,NULL,0L,CALLBACK_WINDOW); cout << k; cout << "poo2"; if (k == MMSYSERR_NOERROR) cout << "success"; else cout << "fail"; cout << "poo7"; //WAVEHDR mp; //mp.dwFlags=0; //mp.dwUser=0; //mp.dwLoops=0; //mp.dwBytesRecorded=0; //mp.lpData = (char *)GlobalLock( GlobalAlloc(GMEM_MOVEABLE|GMEM_SHARE, datasize) ); //memset(mp.lpData, 0, datasize ); //mp.dwBufferLength = datasize; //int p = waveInPrepareHeader( mh, &mp, sizeof(WAVEHDR) ); //cout << p; cout << "poo4"; //waveInAddBuffer int i ; r= waveInGetNumDev(); cout << "poo5"; cout << r ; cin >> i ; //cout << " " << endl; return 0; } and It runs the result following poo0poosuccesspoo3 It's strange. I change the code, but the program dont know. Can somebody help me? minihotto
-
I met a strange problem. This is my code #include "stdafx.h" #include #include #include #pragma comment(lib, "winmm.lib") using namespace std; int _tmain(int argc, _TCHAR* argv[]) { DWORD datasize = 48000; HWAVEIN mh; WAVEFORMATEX wf; wf.wFormatTag=WAVE_FORMAT_PCM; wf.nChannels=1; wf.nSamplesPerSec=8000; wf.nAvgBytesPerSec=8000; wf.nBlockAlign=1; wf.wBitsPerSample=8; wf.cbSize=0; int r;// = ; cout << "poo1"; int k = waveInOpen(&mh,WAVE_MAPPER,&wf,NULL,0L,CALLBACK_WINDOW); cout << k; cout << "poo2"; if (k == MMSYSERR_NOERROR) cout << "success"; else cout << "fail"; cout << "poo7"; //WAVEHDR mp; //mp.dwFlags=0; //mp.dwUser=0; //mp.dwLoops=0; //mp.dwBytesRecorded=0; //mp.lpData = (char *)GlobalLock( GlobalAlloc(GMEM_MOVEABLE|GMEM_SHARE, datasize) ); //memset(mp.lpData, 0, datasize ); //mp.dwBufferLength = datasize; //int p = waveInPrepareHeader( mh, &mp, sizeof(WAVEHDR) ); //cout << p; cout << "poo4"; //waveInAddBuffer int i ; r= waveInGetNumDev(); cout << "poo5"; cout << r ; cin >> i ; //cout << " " << endl; return 0; } and It runs the result following poo0poosuccesspoo3 It's strange. I change the code, but the program dont know. Can somebody help me? minihotto
:) #include #include #include #pragma comment(lib, "winmm.lib") int main(int argc, _TCHAR*argv[]) { DWORD datasize = 48000; HWAVEIN mh; WAVEFORMATEX wf; wf.wFormatTag=WAVE_FORMAT_PCM; wf.nChannels=1; wf.nSamplesPerSec=8000; wf.nAvgBytesPerSec=8000; wf.nBlockAlign=1; wf.wBitsPerSample=8; wf.cbSize=0; int r;// = ; cout << "poo1"; int k = ::waveInOpen(&mh,WAVE_MAPPER,&wf,NULL,0L,CALLBACK_WINDOW); cout << k; cout << "poo2"; if (k == MMSYSERR_NOERROR) cout << "success"; else cout << "fail"; cout << "poo7"; cout << "poo4"; //waveInAddBuffer int i ; r= waveInGetNumDevs(); cout << "poo5"; cout << r ; cin >> i ; //cout << " " << endl; return 0; } Try out mythili
-
:) #include #include #include #pragma comment(lib, "winmm.lib") int main(int argc, _TCHAR*argv[]) { DWORD datasize = 48000; HWAVEIN mh; WAVEFORMATEX wf; wf.wFormatTag=WAVE_FORMAT_PCM; wf.nChannels=1; wf.nSamplesPerSec=8000; wf.nAvgBytesPerSec=8000; wf.nBlockAlign=1; wf.wBitsPerSample=8; wf.cbSize=0; int r;// = ; cout << "poo1"; int k = ::waveInOpen(&mh,WAVE_MAPPER,&wf,NULL,0L,CALLBACK_WINDOW); cout << k; cout << "poo2"; if (k == MMSYSERR_NOERROR) cout << "success"; else cout << "fail"; cout << "poo7"; cout << "poo4"; //waveInAddBuffer int i ; r= waveInGetNumDevs(); cout << "poo5"; cout << r ; cin >> i ; //cout << " " << endl; return 0; } Try out mythili
-
I met a strange problem. This is my code #include "stdafx.h" #include #include #include #pragma comment(lib, "winmm.lib") using namespace std; int _tmain(int argc, _TCHAR* argv[]) { DWORD datasize = 48000; HWAVEIN mh; WAVEFORMATEX wf; wf.wFormatTag=WAVE_FORMAT_PCM; wf.nChannels=1; wf.nSamplesPerSec=8000; wf.nAvgBytesPerSec=8000; wf.nBlockAlign=1; wf.wBitsPerSample=8; wf.cbSize=0; int r;// = ; cout << "poo1"; int k = waveInOpen(&mh,WAVE_MAPPER,&wf,NULL,0L,CALLBACK_WINDOW); cout << k; cout << "poo2"; if (k == MMSYSERR_NOERROR) cout << "success"; else cout << "fail"; cout << "poo7"; //WAVEHDR mp; //mp.dwFlags=0; //mp.dwUser=0; //mp.dwLoops=0; //mp.dwBytesRecorded=0; //mp.lpData = (char *)GlobalLock( GlobalAlloc(GMEM_MOVEABLE|GMEM_SHARE, datasize) ); //memset(mp.lpData, 0, datasize ); //mp.dwBufferLength = datasize; //int p = waveInPrepareHeader( mh, &mp, sizeof(WAVEHDR) ); //cout << p; cout << "poo4"; //waveInAddBuffer int i ; r= waveInGetNumDev(); cout << "poo5"; cout << r ; cin >> i ; //cout << " " << endl; return 0; } and It runs the result following poo0poosuccesspoo3 It's strange. I change the code, but the program dont know. Can somebody help me? minihotto
It's called caching. You need to end each of the
cout
statements withendl
.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb