LPDIRECTSOUNDBUFFER pDSBuffer; DSBUFFERDESC dsbd; ZeroMemory(&dsbd, sizeof(DSBUFFERDESC)); dsbd.dwSize = sizeof(dsbd); dsbd.dwFlags = DSBCAPS_CTRLVOLUME; dsbd.dwBufferBytes = iBufferSize; dsbd.lpwfxFormat = &wfx; if(FAILED(pDSound->CreateSoundBuffer(&dsbd, &pDSBuffer, NULL))) return NULL;
LPDIRECTSOUNDBUFFER pDSBuffer; pDSBuffer->SetVolume(DSBVOLUME_MAX);This example shows how to set the volume of the sound buffer using the SetVolume method of the IDirectSoundBuffer interface. DSBVOLUME_MAX is a predefined constant which sets the maximum volume level (0dB). Package library: DirectX SDK.