More work. Audio driver works enough to play music now.

This commit is contained in:
elasota
2019-12-11 00:51:42 -05:00
parent b1e8e11a56
commit e368cf7235
141 changed files with 8996 additions and 1117 deletions

View File

@@ -0,0 +1,8 @@
#pragma once
enum EGpAudioDriverType
{
EGpAudioDriverType_XAudio2,
EGpAudioDriverType_Count,
};

View File

@@ -0,0 +1,8 @@
#pragma once
enum EGpDisplayDriverType
{
EGpDisplayDriverType_D3D11,
EGpDisplayDriverType_Count,
};

View File

@@ -0,0 +1,13 @@
#pragma once
#include "EGpAudioDriverType.h"
class IGpAudioDriver;
struct GpAudioDriverProperties
{
EGpAudioDriverType m_type;
unsigned int m_sampleRate;
bool m_debug;
};

25
GpCommon/GpCoreDefs.h Normal file
View File

@@ -0,0 +1,25 @@
#pragma once
#if __cplusplus >= 199711L
#define GP_IS_CPP11 1
#else
#define GP_IS_CPP11 0
#endif
#if GP_IS_CPP11
#define GP_DELETED = delete
#else
#ifndef nullptr
#define nullptr 0
#endif
#ifndef override
#define override
#endif
#ifndef final
#define final
#endif
#define GP_DELETED
#endif

View File

@@ -0,0 +1,26 @@
#pragma once
#include "EGpDisplayDriverType.h"
class IGpDisplayDriver;
class GpFiber;
struct GpDisplayDriverProperties
{
typedef void(*TickFunc_t)(void *context, GpFiber *vosFiber);
EGpDisplayDriverType m_type;
unsigned int m_frameTimeLockNumerator;
unsigned int m_frameTimeLockDenominator;
unsigned int m_frameTimeLockMinNumerator;
unsigned int m_frameTimeLockMinDenominator;
unsigned int m_frameTimeLockMaxNumerator;
unsigned int m_frameTimeLockMaxDenominator;
// Tick function and context to call when a frame needs to be served.
TickFunc_t m_tickFunc;
void *m_tickFuncContext;
};

16
GpCommon/GpWindows.h Normal file
View File

@@ -0,0 +1,16 @@
#pragma once
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
struct GPWindowsGlobals
{
HINSTANCE m_hInstance;
HINSTANCE m_hPrevInstance;
LPSTR m_cmdLine;
int m_nCmdShow;
};
extern GPWindowsGlobals g_gpWindowsGlobals;

View File

@@ -0,0 +1,10 @@
#pragma once
struct IGpAudioChannelCallbacks;
struct IGpAudioChannel
{
virtual void SetAudioChannelContext(IGpAudioChannelCallbacks *callbacks) = 0;
virtual void PostBuffer(const void *buffer, size_t bufferSize) = 0;
virtual void Destroy() = 0;
};

View File

@@ -0,0 +1,6 @@
#pragma once
struct IGpAudioChannelCallbacks
{
virtual void NotifyBufferFinished() = 0;
};

13
GpCommon/IGpAudioDriver.h Normal file
View File

@@ -0,0 +1,13 @@
#pragma once
struct IGpAudioChannel;
class IGpAudioDriver
{
public:
virtual ~IGpAudioDriver() {}
virtual IGpAudioChannel *CreateChannel() = 0;
virtual void Shutdown() = 0;
};

View File

@@ -0,0 +1,15 @@
#pragma once
#include "PixelFormat.h"
// Display drivers are responsible for timing and calling the game tick function.
class IGpDisplayDriver
{
public:
virtual ~IGpDisplayDriver() {}
virtual void Run() = 0;
virtual void Shutdown() = 0;
virtual void GetDisplayResolution(unsigned int *width, unsigned int *height, PortabilityLayer::PixelFormat *bpp) = 0;
};