1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#include <windows.h>
int main(int argc, char *argv[])
{
int volume = 10;
WORD wPas = 65535/100;
DWORD Xvol = MAKEWPARAM(volume * wPas ,volume * wPas);
HWAVEOUT phwo;
MMRESULT BmRetour;
WAVEFORMATEX pwfx;
pwfx.wFormatTag = WAVE_FORMAT_PCM;
pwfx.nChannels = 2;
pwfx.nSamplesPerSec = 44100;
pwfx.cbSize = 0;
pwfx.wBitsPerSample = 16;
pwfx.nBlockAlign = (pwfx.wBitsPerSample >> 3) * pwfx.nChannels;
pwfx.nAvgBytesPerSec = pwfx.nSamplesPerSec * pwfx.nBlockAlign;
BmRetour = waveOutOpen(&phwo, 0, &pwfx, 0 , 0, WAVE_MAPPED);
if (BmRetour != MMSYSERR_NOERROR)
{
MessageBox(0, "Erreur ouverture audio.", 0, 0x10);
return EXIT_SUCCESS;
}
BmRetour = waveOutSetVolume(phwo, Xvol);
if (BmRetour != MMSYSERR_NOERROR)
{
MessageBox(0, "Erreur réglage du son", 0, 0x10);
return EXIT_SUCCESS;
}
MessageBox(NULL, "OK", "Test BmGetFile", 0);
waveOutClose(phwo);
return EXIT_SUCCESS;
} |
Partager