mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-20 00:59:19 +02:00
build 170810. multi-texture materials, reflection map support
This commit is contained in:
40
Sound.cpp
40
Sound.cpp
@@ -244,50 +244,14 @@ bool TSoundsManager::Init(HWND hWnd) {
|
||||
pDS = nullptr;
|
||||
pDSNotify = nullptr;
|
||||
|
||||
HRESULT hr; //=222;
|
||||
LPDIRECTSOUNDBUFFER pDSBPrimary = nullptr;
|
||||
|
||||
// Create IDirectSound using the primary sound device
|
||||
hr = DirectSoundCreate(NULL, &pDS, NULL);
|
||||
auto hr = ::DirectSoundCreate(NULL, &pDS, NULL);
|
||||
if (hr != DS_OK) {
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
// Set coop level to DSSCL_PRIORITY
|
||||
// if( FAILED( hr = pDS->SetCooperativeLevel( hWnd, DSSCL_PRIORITY ) ) );
|
||||
// return ;
|
||||
pDS->SetCooperativeLevel(hWnd, DSSCL_PRIORITY);
|
||||
|
||||
// Get the primary buffer
|
||||
DSBUFFERDESC dsbd;
|
||||
ZeroMemory(&dsbd, sizeof(DSBUFFERDESC));
|
||||
dsbd.dwSize = sizeof(DSBUFFERDESC);
|
||||
dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER;
|
||||
if (!Global::bInactivePause) // jeśli przełączony w tło ma nadal działać
|
||||
dsbd.dwFlags |= DSBCAPS_GLOBALFOCUS; // to dźwięki mają być również słyszalne
|
||||
dsbd.dwBufferBytes = 0;
|
||||
dsbd.lpwfxFormat = NULL;
|
||||
|
||||
if( FAILED( hr = pDS->CreateSoundBuffer( &dsbd, &pDSBPrimary, NULL ) ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set primary buffer format to 22kHz and 16-bit output.
|
||||
WAVEFORMATEX wfx;
|
||||
ZeroMemory(&wfx, sizeof(WAVEFORMATEX));
|
||||
wfx.wFormatTag = WAVE_FORMAT_PCM;
|
||||
wfx.nChannels = 2;
|
||||
wfx.nSamplesPerSec = 44100;
|
||||
wfx.wBitsPerSample = 16;
|
||||
wfx.nBlockAlign = wfx.wBitsPerSample / 8 * wfx.nChannels;
|
||||
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
|
||||
|
||||
if( FAILED( hr = pDSBPrimary->SetFormat( &wfx ) ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SAFE_RELEASE(pDSBPrimary);
|
||||
pDS->SetCooperativeLevel(hWnd, DSSCL_NORMAL);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user