Waitrud Weber’s blog

things and reminders for memories

sounds: windowsapi: basic api in windows.

mciSendCommand can sound wave-files and we can use buffer alternatively for sounds.

 (20210412)

buffer specification is not recognised today at 20210412.


.\WindowsProject8.cpp  Sat Apr 10 19:56:39 2021

  1 :// WindowsProject8.cpp : Defines the entry point for the application.
  2 ://
  3 :
  4 :#include "framework.h"
  5 :#include "WindowsProject8.h"
  6 :
  7 :#include 
  8 :
  9 :#include 
 10 :#include 
 11 :#pragma comment(lib,"winmm.lib")
 12 :
 13 :#define MSG(m) {\
 14 :    MessageBoxA(NULL,m,NULL,MB_OK);}
...
 60 :    for (i = 0; i < 10; i++) {
 61 :        result = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID | MCI_OPEN_ELEMENT,
 62 :            (DWORD_PTR)&open);
 63 :        result = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID | MCI_OPEN_ELEMENT,
 64 :            (DWORD_PTR)&open3);
 65 :
 66 :        if (result) {
 67 :            mciGetErrorStringA(result, (LPSTR)buf, sizeof(buf));
 68 :            MessageBoxA(NULL, (LPSTR)buf, NULL, MB_OK);
 69 :            if (i >= 9) {
 70 :                PostQuitMessage(0);
 71 :                return -1;
 72 :            }
 73 :            Sleep(1000);
 74 :        }
 75 :    }


File format and buffer depend on type of structure in this case, which the type of open3. And there are overlay.
Written as overlay:

https://docs.microsoft.com/en-us/windows/win32/multimedia/mci-save 

typedef struct tagMCI_VCR_SETAUDIO_PARMS {
  DWORD_PTR dwCallback;
  DWORD     dwTrack;
  DWORD     dwTo;
  DWORD     dwNumber;
} MCI_VCR_SETAUDIO_PARMS;

willinglytranslate.blogspot.com