|
@@ -3,21 +3,9 @@ |
|
|
#include <Xinput.h> |
|
|
#include <Xinput.h> |
|
|
#include <dsound.h> |
|
|
#include <dsound.h> |
|
|
|
|
|
|
|
|
|
|
|
#include "win32_handmade.h" |
|
|
#include "handmade.cpp" |
|
|
#include "handmade.cpp" |
|
|
|
|
|
|
|
|
struct Win32OffscreenBuffer { |
|
|
|
|
|
BITMAPINFO info; |
|
|
|
|
|
void *memory; |
|
|
|
|
|
int width; |
|
|
|
|
|
int height; |
|
|
|
|
|
int bytesPerPixel; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
struct Win32WindowDimensions { |
|
|
|
|
|
int width; |
|
|
|
|
|
int height; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
global ATOM HH_CTRLW; |
|
|
global ATOM HH_CTRLW; |
|
|
global bool running; |
|
|
global bool running; |
|
|
global Win32OffscreenBuffer globalBackBuffer; |
|
|
global Win32OffscreenBuffer globalBackBuffer; |
|
@@ -216,18 +204,6 @@ LRESULT mainWindowCallback( |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
struct Win32SoundOutput { |
|
|
|
|
|
int samplesPerSecond; |
|
|
|
|
|
int toneHz; |
|
|
|
|
|
int wavePeriod; |
|
|
|
|
|
int16 toneVolume; |
|
|
|
|
|
uint32 runningSampleIndex; |
|
|
|
|
|
int bytesPerSample; |
|
|
|
|
|
int secondaryBufferSize; |
|
|
|
|
|
real32 tSine; |
|
|
|
|
|
int latencySampleCount; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
internal void win32ClearBuffer(Win32SoundOutput *soundOutput) { |
|
|
internal void win32ClearBuffer(Win32SoundOutput *soundOutput) { |
|
|
VOID *region1; |
|
|
VOID *region1; |
|
|
DWORD region1Size; |
|
|
DWORD region1Size; |
|
@@ -321,9 +297,7 @@ int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, PSTR commandLin |
|
|
// sound test |
|
|
// sound test |
|
|
Win32SoundOutput soundOutput = {}; |
|
|
Win32SoundOutput soundOutput = {}; |
|
|
soundOutput.samplesPerSecond = 48000; |
|
|
soundOutput.samplesPerSecond = 48000; |
|
|
soundOutput.toneHz = 440; // A above middle C |
|
|
|
|
|
soundOutput.wavePeriod = soundOutput.samplesPerSecond / soundOutput.toneHz; |
|
|
soundOutput.wavePeriod = soundOutput.samplesPerSecond / soundOutput.toneHz; |
|
|
soundOutput.toneVolume = 6000; |
|
|
|
|
|
soundOutput.runningSampleIndex = 0; |
|
|
soundOutput.runningSampleIndex = 0; |
|
|
soundOutput.bytesPerSample = sizeof(int16)*2; |
|
|
soundOutput.bytesPerSample = sizeof(int16)*2; |
|
|
soundOutput.secondaryBufferSize = soundOutput.samplesPerSecond*soundOutput.bytesPerSample; |
|
|
soundOutput.secondaryBufferSize = soundOutput.samplesPerSecond*soundOutput.bytesPerSample; |
|
|