From 1a1fe84a60d00a315b4e1549d1276ca93b74baf8 Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Wed, 24 Dec 2025 11:11:02 -0600 Subject: [PATCH] DirectSound: normal buffers require a window --- main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index 2403c7d..a208b6e 100644 --- a/main.cpp +++ b/main.cpp @@ -259,7 +259,8 @@ HRESULT InitDirectSound(HWND hwnd) DSBUFFERDESC desc = {}; desc.dwSize = (sizeof (DSBUFFERDESC)); - desc.dwFlags = DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY; + //desc.dwFlags = DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY; + desc.dwFlags = 0; desc.dwBufferBytes = 4 * wfx.nAvgBytesPerSec; desc.guid3DAlgorithm = DS3DALG_DEFAULT; desc.lpwfxFormat = &wfx; @@ -284,16 +285,17 @@ HRESULT InitDirectSound(HWND hwnd) pDsb->Unlock(pBuffer, dwBufferSize, NULL, 0); + printf("Play\n"); pDsb->Play(0, 0, DSBPLAY_LOOPING); - while (1); + return S_OK; } int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) { AttachConsole(ATTACH_PARENT_PROCESS); - if (1) { + if (0) { HRESULT hr; hr = InitDirectInput(hInstance); if (FAILED(hr)) { @@ -337,8 +339,8 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine } if (0) { + printf("direct sound\n"); InitDirectSound(hwnd); - return 0; } if (!SUCCEEDED(InitDirect3D(hwnd)))