diff --git a/README.md b/README.md index c7278f145..6ae5becfb 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Install the dependencies using [Homebrew](https://brew.sh/): brew install cmake sdl2_mixer sdl2_ttf libsodium pkg-config ``` -### Cross-compiling using MinGW (work in progress, currently crashes) +### Cross-compiling using MinGW You `PATH` must contain `i686-w64-mingw32-gcc` and `i686-w64-mingw32-gcc`. Use the following cmake invocation: ``` cmake -DCMAKE_TOOLCHAIN_FILE=../CMake/mingwcc.cmake .. diff --git a/SourceS/miniwin.h b/SourceS/miniwin.h index 9ed020788..e43a08c1c 100644 --- a/SourceS/miniwin.h +++ b/SourceS/miniwin.h @@ -33,8 +33,5 @@ #ifdef DEVILUTION_ENGINE #include "miniwin_misc_macro.h" -//#include "miniwin_com_macro.h" -#include "miniwin_ddraw_macro.h" +#include "miniwin_com_macro.h" #endif - -#include "miniwin_com_macro.h" // fix later diff --git a/SourceS/miniwin_com.h b/SourceS/miniwin_com.h index b3611f3b8..faf472e4e 100644 --- a/SourceS/miniwin_com.h +++ b/SourceS/miniwin_com.h @@ -43,8 +43,8 @@ struct IUnknown { // clang-format on }; -#include "miniwin_ddraw.h" -#include "miniwin_dsound.h" +#include "miniwin_com_ddraw.h" +#include "miniwin_com_dsound.h" #ifndef DEVILUTION_ENGINE #pragma pop_macro("DECLARE_INTERFACE_") @@ -58,7 +58,11 @@ struct IUnknown { #undef DEVILUTION_MINIWIN_COM -static constexpr HRESULT DVL_E_FAIL = 0x80004005L; -static constexpr HRESULT DVL_S_OK = 0; +constexpr HRESULT DVL_E_FAIL = 0x80004005L; +constexpr HRESULT DVL_S_OK = 0; +constexpr auto DVL_SW_HIDE = 0; +constexpr auto DVL_SW_SHOWNORMAL = 1; +constexpr auto DVL_SM_CXSCREEN = 0; +constexpr auto DVL_SM_CYSCREEN = 1; } diff --git a/SourceS/miniwin_ddraw.h b/SourceS/miniwin_com_ddraw.h similarity index 100% rename from SourceS/miniwin_ddraw.h rename to SourceS/miniwin_com_ddraw.h diff --git a/SourceS/miniwin_dsound.h b/SourceS/miniwin_com_dsound.h similarity index 76% rename from SourceS/miniwin_dsound.h rename to SourceS/miniwin_com_dsound.h index d96966f3a..9ba23fde0 100644 --- a/SourceS/miniwin_dsound.h +++ b/SourceS/miniwin_com_dsound.h @@ -42,15 +42,6 @@ DECLARE_INTERFACE_(IDirectSoundBuffer, IUnknown) // clang-format on }; -#define DSBCAPS_PRIMARYBUFFER 0x00000001 -#define DSBCAPS_STATIC 0x00000002 -#define DSBCAPS_CTRLPAN 0x00000040 -#define DSBCAPS_CTRLVOLUME 0x00000080 - -#define WAVE_FORMAT_PCM 1 - -#define ERROR_SUCCESS 0L - typedef IDirectSoundBuffer *LPDIRECTSOUNDBUFFER; typedef void *LPUNKNOWN, *LPCGUID; @@ -95,19 +86,9 @@ DECLARE_INTERFACE_(IDirectSound, IUnknown) // clang-format on }; -#define _FACDS 0x878 -#define MAKE_DSHRESULT(code) MAKE_HRESULT(1, _FACDS, code) - -#define E_NOINTERFACE 0x80004002 -#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT(70) -#define DSERR_BADFORMAT MAKE_DSHRESULT(100) -#define DSERR_NODRIVER MAKE_DSHRESULT(120) -#define DSERR_ALREADYINITIALIZED MAKE_DSHRESULT(130) -#define DSERR_BUFFERLOST MAKE_DSHRESULT(150) -#define DS_OK 0 -#define DSERR_INVALIDCALL MAKE_DSHRESULT(50) -#define DSERR_NOAGGREGATION 0x80040110 -#define DSERR_OUTOFMEMORY 0x8007000E -#define DSERR_INVALIDPARAM 0x80070057 -#define DSERR_ALLOCATED MAKE_DSHRESULT(10) -#define DSERR_CONTROLUNAVAIL MAKE_DSHRESULT(30) +const auto DVL_DSBCAPS_PRIMARYBUFFER = 0x00000001; +const auto DVL_DSBCAPS_STATIC = 0x00000002; +const auto DVL_DSBCAPS_CTRLPAN = 0x00000040; +const auto DVL_DSBCAPS_CTRLVOLUME = 0x00000080; +const auto DVL_WAVE_FORMAT_PCM = 1; +const auto DVL_DS_OK = 0; diff --git a/SourceS/miniwin_com_macro.h b/SourceS/miniwin_com_macro.h index 5da86984d..2b84c713a 100644 --- a/SourceS/miniwin_com_macro.h +++ b/SourceS/miniwin_com_macro.h @@ -1,3 +1,5 @@ +#pragma once + #define CS_HREDRAW 0x0001 #define CS_VREDRAW 0x0002 @@ -5,8 +7,8 @@ #define CSIDL_STARTMENU 0x000b -#define SW_HIDE 0 -#define SW_SHOWNORMAL 1 +#define SW_HIDE DVL_SW_HIDE +#define SW_SHOWNORMAL DVL_SW_SHOWNORMAL #define BLACK_BRUSH 4 @@ -14,8 +16,8 @@ #define IMAGE_ICON 1 -#define SM_CXSCREEN 0 -#define SM_CYSCREEN 1 +#define SM_CXSCREEN DVL_SM_CXSCREEN +#define SM_CYSCREEN DVL_SM_CYSCREEN #define GW_HWNDNEXT 2 @@ -23,3 +25,6 @@ #define S_OK DVL_S_OK #define MAKE_HRESULT(sev, fac, code) ((HRESULT)(((uint32_t)(sev) << 31) | ((uint32_t)(fac) << 16) | ((uint32_t)(code)))) + +#include "miniwin_com_macro_ddraw.h" +#include "miniwin_com_macro_dsound.h" diff --git a/SourceS/miniwin_ddraw_macro.h b/SourceS/miniwin_com_macro_ddraw.h similarity index 99% rename from SourceS/miniwin_ddraw_macro.h rename to SourceS/miniwin_com_macro_ddraw.h index 53d2c9d72..1ef1eb5e7 100644 --- a/SourceS/miniwin_ddraw_macro.h +++ b/SourceS/miniwin_com_macro_ddraw.h @@ -1,3 +1,5 @@ +#pragma once + #define _FACDD 0x876 #define MAKE_DDHRESULT(code) MAKE_HRESULT(1, _FACDD, code) diff --git a/SourceS/miniwin_com_macro_dsound.h b/SourceS/miniwin_com_macro_dsound.h new file mode 100644 index 000000000..87dc166fd --- /dev/null +++ b/SourceS/miniwin_com_macro_dsound.h @@ -0,0 +1,27 @@ +#pragma once + +#define DSBCAPS_PRIMARYBUFFER DVL_DSBCAPS_PRIMARYBUFFER +#define DSBCAPS_STATIC DVL_DSBCAPS_STATIC +#define DSBCAPS_CTRLPAN DVL_DSBCAPS_CTRLPAN +#define DSBCAPS_CTRLVOLUME DVL_DSBCAPS_CTRLVOLUME + +#define WAVE_FORMAT_PCM DVL_WAVE_FORMAT_PCM + +#define ERROR_SUCCESS 0L + +#define _FACDS 0x878 +#define MAKE_DSHRESULT(code) MAKE_HRESULT(1, _FACDS, code) + +#define E_NOINTERFACE 0x80004002 +#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT(70) +#define DSERR_BADFORMAT MAKE_DSHRESULT(100) +#define DSERR_NODRIVER MAKE_DSHRESULT(120) +#define DSERR_ALREADYINITIALIZED MAKE_DSHRESULT(130) +#define DSERR_BUFFERLOST MAKE_DSHRESULT(150) +#define DS_OK DVL_DS_OK +#define DSERR_INVALIDCALL MAKE_DSHRESULT(50) +#define DSERR_NOAGGREGATION 0x80040110 +#define DSERR_OUTOFMEMORY 0x8007000E +#define DSERR_INVALIDPARAM 0x80070057 +#define DSERR_ALLOCATED MAKE_DSHRESULT(10) +#define DSERR_CONTROLUNAVAIL MAKE_DSHRESULT(30) diff --git a/SourceS/miniwin_misc.h b/SourceS/miniwin_misc.h index 7a7c93e05..a36050798 100644 --- a/SourceS/miniwin_misc.h +++ b/SourceS/miniwin_misc.h @@ -2,8 +2,8 @@ namespace dvl { -static constexpr auto DVL_OFS_MAXPATHNAME = 128; -static constexpr auto DVL_MAX_PATH = 260; +constexpr auto DVL_OFS_MAXPATHNAME = 128; +constexpr auto DVL_MAX_PATH = 260; typedef char CHAR; typedef uint16_t SHORT; @@ -668,108 +668,108 @@ extern void LoadAndPlaySound(char *FilePath, int lVolume, int lPan); extern void DrawArtWithMask(int SX, int SY, int SW, int SH, int nFrame, BYTE bMask, void *pBuffer); extern BOOL __cdecl LoadArtWithPal(char *pszFile, void **pBuffer, int frames, DWORD *data); -static constexpr auto DVL_WM_ACTIVATEAPP = 0x001C; -static const auto DVL_HFILE_ERROR = (HFILE)-1; -static constexpr auto DVL_DRIVE_CDROM = 5; -static constexpr auto DVL_WM_DESTROY = 0x0002; -static constexpr auto DVL_HORZRES = 8; -static constexpr auto DVL_VERTRES = 10; -static constexpr auto DVL_VER_PLATFORM_WIN32_NT = 2; - -static constexpr auto DVL_CREATE_ALWAYS = 2; -static constexpr auto DVL_GENERIC_READ = 0x80000000L; -static constexpr auto DVL_GENERIC_WRITE = 0x40000000L; -static constexpr auto DVL_OPEN_EXISTING = 3; -static constexpr auto DVL_FILE_BEGIN = 0; -static constexpr auto DVL_FILE_CURRENT = 1; -static constexpr auto DVL_ERROR_FILE_NOT_FOUND = 2; - -static constexpr auto DVL_PM_NOREMOVE = 0x0000; -static constexpr auto DVL_PM_REMOVE = 0x0001; -static constexpr auto DVL_WM_QUIT = 0x0012; -static constexpr auto DVL_INFINITE = 0xFFFFFFFF; +constexpr auto DVL_WM_ACTIVATEAPP = 0x001C; +const auto DVL_HFILE_ERROR = (HFILE)-1; +constexpr auto DVL_DRIVE_CDROM = 5; +constexpr auto DVL_WM_DESTROY = 0x0002; +constexpr auto DVL_HORZRES = 8; +constexpr auto DVL_VERTRES = 10; +constexpr auto DVL_VER_PLATFORM_WIN32_NT = 2; + +constexpr auto DVL_CREATE_ALWAYS = 2; +constexpr auto DVL_GENERIC_READ = 0x80000000L; +constexpr auto DVL_GENERIC_WRITE = 0x40000000L; +constexpr auto DVL_OPEN_EXISTING = 3; +constexpr auto DVL_FILE_BEGIN = 0; +constexpr auto DVL_FILE_CURRENT = 1; +constexpr auto DVL_ERROR_FILE_NOT_FOUND = 2; + +constexpr auto DVL_PM_NOREMOVE = 0x0000; +constexpr auto DVL_PM_REMOVE = 0x0001; +constexpr auto DVL_WM_QUIT = 0x0012; +constexpr auto DVL_INFINITE = 0xFFFFFFFF; // // Events // -static constexpr auto DVL_WM_MOUSEFIRST = 0x0200; -static constexpr auto DVL_WM_MOUSEMOVE = 0x0200; -static constexpr auto DVL_WM_LBUTTONDOWN = 0x0201; -static constexpr auto DVL_WM_LBUTTONUP = 0x0202; -static constexpr auto DVL_WM_RBUTTONDOWN = 0x0204; -static constexpr auto DVL_WM_RBUTTONUP = 0x0205; - -static constexpr auto DVL_WM_KEYFIRST = 0x0100; -static constexpr auto DVL_WM_KEYDOWN = 0x0100; -static constexpr auto DVL_WM_KEYUP = 0x0101; -static constexpr auto DVL_WM_SYSKEYDOWN = 0x0104; - -static constexpr auto DVL_WM_INITDIALOG = 0x0110; -static constexpr auto DVL_WM_COMMAND = 0x0111; -static constexpr auto DVL_WM_SYSCOMMAND = 0x0112; - -static constexpr auto DVL_WM_CHAR = 0x0102; -static constexpr auto DVL_WM_CAPTURECHANGED = 0x0215; - -static constexpr auto DVL_WM_CREATE = 0x0001; -static constexpr auto DVL_WM_PAINT = 0x000F; -static constexpr auto DVL_WM_CLOSE = 0x0010; -static constexpr auto DVL_WM_QUERYENDSESSION = 0x0011; -static constexpr auto DVL_WM_ERASEBKGND = 0x0014; -static constexpr auto DVL_WM_QUERYNEWPALETTE = 0x030F; -static constexpr auto DVL_WM_PALETTECHANGED = 0x0311; - -static constexpr auto DVL_SC_CLOSE = 0xF060; - -static constexpr auto DVL_VK_RETURN = 0x0D; -static constexpr auto DVL_VK_BACK = 0x08; -static constexpr auto DVL_VK_SHIFT = 0x10; -static constexpr auto DVL_VK_ESCAPE = 0x1B; -static constexpr auto DVL_VK_SPACE = 0x20; -static constexpr auto DVL_VK_LEFT = 0x25; -static constexpr auto DVL_VK_UP = 0x26; -static constexpr auto DVL_VK_RIGHT = 0x27; -static constexpr auto DVL_VK_DOWN = 0x28; - -static constexpr auto DVL_VK_F1 = 0x70; -static constexpr auto DVL_VK_F2 = 0x71; -static constexpr auto DVL_VK_F3 = 0x72; -static constexpr auto DVL_VK_F4 = 0x73; -static constexpr auto DVL_VK_F5 = 0x74; -static constexpr auto DVL_VK_F6 = 0x75; -static constexpr auto DVL_VK_F7 = 0x76; -static constexpr auto DVL_VK_F8 = 0x77; -static constexpr auto DVL_VK_F9 = 0x78; -static constexpr auto DVL_VK_F10 = 0x79; -static constexpr auto DVL_VK_F11 = 0x7A; -static constexpr auto DVL_VK_F12 = 0x7B; - -static constexpr auto DVL_VK_TAB = 0x09; -static constexpr auto DVL_VK_PAUSE = 0x13; -static constexpr auto DVL_VK_PRIOR = 0x21; -static constexpr auto DVL_VK_NEXT = 0x22; -static constexpr auto DVL_VK_SNAPSHOT = 0x2C; - -static constexpr auto DVL_VK_OEM_1 = 0xBA; -static constexpr auto DVL_VK_OEM_PLUS = 0xBB; -static constexpr auto DVL_VK_OEM_COMMA = 0xBC; -static constexpr auto DVL_VK_OEM_MINUS = 0xBD; -static constexpr auto DVL_VK_OEM_PERIOD = 0xBE; -static constexpr auto DVL_VK_OEM_2 = 0xBF; -static constexpr auto DVL_VK_OEM_3 = 0xC0; -static constexpr auto DVL_VK_OEM_4 = 0xDB; -static constexpr auto DVL_VK_OEM_5 = 0xDC; -static constexpr auto DVL_VK_OEM_6 = 0xDD; -static constexpr auto DVL_VK_OEM_7 = 0xDE; -//static constexpr auto DVL_VK_OEM_8 = 0xDF; -//static constexpr auto DVL_VK_OEM_102 = 0xE2; - -static constexpr auto DVL_MK_SHIFT = 0x0004; -static constexpr auto DVL_MK_LBUTTON = 0x0001; -static constexpr auto DVL_MK_RBUTTON = 0x0002; - -static constexpr auto DVL_MB_TASKMODAL = 0x00002000L; -static constexpr auto DVL_MB_ICONHAND = 0x00000010L; -static constexpr auto DVL_MB_ICONEXCLAMATION = 0x00000030L; +constexpr auto DVL_WM_MOUSEFIRST = 0x0200; +constexpr auto DVL_WM_MOUSEMOVE = 0x0200; +constexpr auto DVL_WM_LBUTTONDOWN = 0x0201; +constexpr auto DVL_WM_LBUTTONUP = 0x0202; +constexpr auto DVL_WM_RBUTTONDOWN = 0x0204; +constexpr auto DVL_WM_RBUTTONUP = 0x0205; + +constexpr auto DVL_WM_KEYFIRST = 0x0100; +constexpr auto DVL_WM_KEYDOWN = 0x0100; +constexpr auto DVL_WM_KEYUP = 0x0101; +constexpr auto DVL_WM_SYSKEYDOWN = 0x0104; + +constexpr auto DVL_WM_INITDIALOG = 0x0110; +constexpr auto DVL_WM_COMMAND = 0x0111; +constexpr auto DVL_WM_SYSCOMMAND = 0x0112; + +constexpr auto DVL_WM_CHAR = 0x0102; +constexpr auto DVL_WM_CAPTURECHANGED = 0x0215; + +constexpr auto DVL_WM_CREATE = 0x0001; +constexpr auto DVL_WM_PAINT = 0x000F; +constexpr auto DVL_WM_CLOSE = 0x0010; +constexpr auto DVL_WM_QUERYENDSESSION = 0x0011; +constexpr auto DVL_WM_ERASEBKGND = 0x0014; +constexpr auto DVL_WM_QUERYNEWPALETTE = 0x030F; +constexpr auto DVL_WM_PALETTECHANGED = 0x0311; + +constexpr auto DVL_SC_CLOSE = 0xF060; + +constexpr auto DVL_VK_RETURN = 0x0D; +constexpr auto DVL_VK_BACK = 0x08; +constexpr auto DVL_VK_SHIFT = 0x10; +constexpr auto DVL_VK_ESCAPE = 0x1B; +constexpr auto DVL_VK_SPACE = 0x20; +constexpr auto DVL_VK_LEFT = 0x25; +constexpr auto DVL_VK_UP = 0x26; +constexpr auto DVL_VK_RIGHT = 0x27; +constexpr auto DVL_VK_DOWN = 0x28; + +constexpr auto DVL_VK_F1 = 0x70; +constexpr auto DVL_VK_F2 = 0x71; +constexpr auto DVL_VK_F3 = 0x72; +constexpr auto DVL_VK_F4 = 0x73; +constexpr auto DVL_VK_F5 = 0x74; +constexpr auto DVL_VK_F6 = 0x75; +constexpr auto DVL_VK_F7 = 0x76; +constexpr auto DVL_VK_F8 = 0x77; +constexpr auto DVL_VK_F9 = 0x78; +constexpr auto DVL_VK_F10 = 0x79; +constexpr auto DVL_VK_F11 = 0x7A; +constexpr auto DVL_VK_F12 = 0x7B; + +constexpr auto DVL_VK_TAB = 0x09; +constexpr auto DVL_VK_PAUSE = 0x13; +constexpr auto DVL_VK_PRIOR = 0x21; +constexpr auto DVL_VK_NEXT = 0x22; +constexpr auto DVL_VK_SNAPSHOT = 0x2C; + +constexpr auto DVL_VK_OEM_1 = 0xBA; +constexpr auto DVL_VK_OEM_PLUS = 0xBB; +constexpr auto DVL_VK_OEM_COMMA = 0xBC; +constexpr auto DVL_VK_OEM_MINUS = 0xBD; +constexpr auto DVL_VK_OEM_PERIOD = 0xBE; +constexpr auto DVL_VK_OEM_2 = 0xBF; +constexpr auto DVL_VK_OEM_3 = 0xC0; +constexpr auto DVL_VK_OEM_4 = 0xDB; +constexpr auto DVL_VK_OEM_5 = 0xDC; +constexpr auto DVL_VK_OEM_6 = 0xDD; +constexpr auto DVL_VK_OEM_7 = 0xDE; +//constexpr auto DVL_VK_OEM_8 = 0xDF; +//constexpr auto DVL_VK_OEM_102 = 0xE2; + +constexpr auto DVL_MK_SHIFT = 0x0004; +constexpr auto DVL_MK_LBUTTON = 0x0001; +constexpr auto DVL_MK_RBUTTON = 0x0002; + +constexpr auto DVL_MB_TASKMODAL = 0x00002000L; +constexpr auto DVL_MB_ICONHAND = 0x00000010L; +constexpr auto DVL_MB_ICONEXCLAMATION = 0x00000030L; } diff --git a/SourceX/dvlnet/base.cpp b/SourceX/dvlnet/base.cpp index b9d6eae47..f78507588 100644 --- a/SourceX/dvlnet/base.cpp +++ b/SourceX/dvlnet/base.cpp @@ -162,7 +162,6 @@ bool base::SNetReceiveTurns(char** data, unsigned int* size, DWORD* status) } } } - printf("FALSEE!!\n"); return false; } } diff --git a/SourceX/miniwin.cpp b/SourceX/miniwin.cpp index 219a99387..80c9a444f 100644 --- a/SourceX/miniwin.cpp +++ b/SourceX/miniwin.cpp @@ -324,9 +324,9 @@ BOOL UpdateWindow(HWND hWnd) BOOL ShowWindow(HWND hWnd, int nCmdShow) { - if (nCmdShow == SW_HIDE) { + if (nCmdShow == DVL_SW_HIDE) { SDL_HideWindow(window); - } else if (nCmdShow == SW_SHOWNORMAL) { + } else if (nCmdShow == DVL_SW_SHOWNORMAL) { SDL_ShowWindow(window); } @@ -345,9 +345,9 @@ ATOM RegisterClassExA(const WNDCLASSEXA *lpwcx) int GetSystemMetrics(int nIndex) { switch (nIndex) { - case SM_CXSCREEN: + case DVL_SM_CXSCREEN: return SCREEN_WIDTH; - case SM_CYSCREEN: + case DVL_SM_CYSCREEN: return SCREEN_HEIGHT; } diff --git a/SourceX/sound.cpp b/SourceX/sound.cpp index 93d939b14..9d4d42d08 100644 --- a/SourceX/sound.cpp +++ b/SourceX/sound.cpp @@ -194,7 +194,7 @@ void sound_CreateSoundBuffer(TSnd *sound_file) DSB.dwBufferBytes = sound_file->chunk.dwSize; DSB.lpwfxFormat = &sound_file->fmt; DSB.dwSize = sizeof(DSBUFFERDESC); - DSB.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLPAN | DSBCAPS_STATIC; + DSB.dwFlags = DVL_DSBCAPS_CTRLVOLUME | DVL_DSBCAPS_CTRLPAN | DVL_DSBCAPS_STATIC; } void sound_file_cleanup(TSnd *sound_file) @@ -257,14 +257,14 @@ void sound_create_primary_buffer(HANDLE music_track) if (!music_track) { memset(&dsbuf, 0, sizeof(DSBUFFERDESC)); dsbuf.dwSize = sizeof(DSBUFFERDESC); - dsbuf.dwFlags = DSBCAPS_PRIMARYBUFFER; + dsbuf.dwFlags = DVL_DSBCAPS_PRIMARYBUFFER; #ifdef __cplusplus error_code = sglpDS->CreateSoundBuffer(&dsbuf, &sglpDSB, NULL); #else error_code = sglpDS->lpVtbl->CreateSoundBuffer(sglpDS, &dsbuf, &sglpDSB, NULL); #endif - if (error_code != DS_OK) + if (error_code != DVL_DS_OK) DSErrMsg(error_code, 375, "C:\\Src\\Diablo\\Source\\SOUND.CPP"); } @@ -277,12 +277,12 @@ void sound_create_primary_buffer(HANDLE music_track) #else error_code = sglpDS->lpVtbl->GetCaps(sglpDS, &dsbcaps); #endif - if (error_code != DS_OK) + if (error_code != DVL_DS_OK) DSErrMsg(error_code, 383, "C:\\Src\\Diablo\\Source\\SOUND.CPP"); if (!music_track || !LoadWaveFormat(music_track, &format)) { memset(&format, 0, sizeof(WAVEFORMATEX)); - format.wFormatTag = WAVE_FORMAT_PCM; + format.wFormatTag = DVL_WAVE_FORMAT_PCM; format.nSamplesPerSec = 22050; format.wBitsPerSample = 16; format.cbSize = 0;