MFC winxp volume setting Sound Control

MASTER FULL
DWORD dwVolume = 0xFFFFFFFF;

LEFT MUTE
DWORD dwVolume = 0x0000FFFF;

RIGHT MUTE
DWORD dwVolume = 0xFFFF0000;


BOOL CAudioHelper::SetWinXPAudioMasterFullVolume(void)

{

    HWAVEOUT hwo;

    DWORD dwVolume = 0xFFFFFFFF;

 

    WAVEFORMATEX wf;

    wf.wFormatTag = WAVE_FORMAT_PCM;

    wf.nChannels = 2;

    wf.nSamplesPerSec = 44100;

    wf.wBitsPerSample = 16;

    wf.nBlockAlign = wf.nChannels * wf.wBitsPerSample / 8;

    wf.nAvgBytesPerSec = wf.nSamplesPerSec * wf.nBlockAlign;

    wf.cbSize = 0;

 

    //Device를 검색하는 거죠 .. Device의 갯수를 가지고와서 open 해보고 open 되면 볼륨을 조절하는 겁니다.

    for (UINT id = 0; id < waveOutGetNumDevs(); id++)

    {

        if (waveOutOpen(&hwo, id, &wf, 0, 0, CALLBACK_NULL) == MMSYSERR_NOERROR)

        {

            waveOutSetVolume(hwo, dwVolume);

            waveOutClose(hwo);

            break;

        }

    }

 

    return TRUE;

}


덧글

댓글 입력 영역


통계 위젯 (블랙)

034
134
410270