Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. strange problem (audio)

strange problem (audio)

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    minihotto
    wrote on last edited by
    #1

    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

    J D 2 Replies Last reply
    0
    • M 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

      J Offline
      J Offline
      janisha
      wrote on last edited by
      #2

      :) #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

      M 1 Reply Last reply
      0
      • J janisha

        :) #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

        M Offline
        M Offline
        minihotto
        wrote on last edited by
        #3

        Thanks^^ I know where is the problem.

        1 Reply Last reply
        0
        • M 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

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          It's called caching. You need to end each of the cout statements with endl.


          "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

          "Judge not by the eye but by the heart." - Native American Proverb

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups