DarkShadow44

waveOutOpen test

Jan 28th, 2024
1,054
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.04 KB | None | 0 0
  1. /* WATCOM=/opt/watcom PATH=$WATCOM/binl:$PATH INCLUDE=$WATCOM/h:$WATCOM/h/win LIB=$WATCOM/lib286:$WATCOM/lib286/dos wcl -bcl=windows main.c -q mmsystem.lib */
  2.  
  3. #include <windows.h>
  4. #include <mmsystem.h>
  5. #include <stdlib.h>
  6.  
  7. void error(const char* str)
  8. {
  9.     MessageBox(0, str, "", 0);
  10.     exit(1);
  11. }
  12.  
  13. void CALLBACK _export waveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
  14. {
  15. }
  16.  
  17. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  18. {
  19.     HWAVEOUT hout;
  20.     PCMWAVEFORMAT format;
  21.     int result;
  22.     FARPROC callback;
  23.  
  24.     callback = MakeProcInstance((FARPROC)waveOutProc, hInstance);
  25.     if (callback == NULL)
  26.     {
  27.         error("MakeProcInstance failed");
  28.     }
  29.  
  30.     if ((result = waveOutOpen(&hout, WAVE_MAPPER, (LPWAVEFORMAT)&format, (DWORD)callback, 0, CALLBACK_FUNCTION)) != MMSYSERR_NOERROR)
  31.     {
  32.         char errorMsg[256];
  33.         waveOutGetErrorText(result, errorMsg, sizeof(errorMsg));
  34.         error(errorMsg);
  35.     }
  36.     error("Success");
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment