Skip to content

Commit

Permalink
Update for November 2020 DirectX Tool Kit
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Nov 14, 2020
1 parent 2e7af73 commit 49a84b9
Show file tree
Hide file tree
Showing 198 changed files with 1,500 additions and 93,710 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ ARM
Durango
"Generated Files"
Bin
DirectXTK/Src/Shaders/Compiled/XboxOne*.inc
DirectXTK/Src/Shaders/Compiled/XboxOne*.pdb
DirectXTK/Src/Shaders/Compiled/*.inc
DirectXTK/Src/Shaders/Compiled/*.pdb
ipch
Debug
Profile
Expand Down
34 changes: 30 additions & 4 deletions DirectXTK/Audio/AudioEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1426,10 +1426,12 @@ X3DAUDIO_HANDLE& AudioEngine::Get3DHandle() const noexcept


// Static methods.
#ifdef _XBOX_ONE
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)
#include <mmdeviceapi.h>
#elif defined(_XBOX_ONE)
#include <Windows.Media.Devices.h>
#include <wrl.h>
#elif defined(USING_XAUDIO2_REDIST)
#elif defined(USING_XAUDIO2_REDIST) || defined(_GAMING_DESKTOP)
#include <mmdeviceapi.h>
#include <functiondiscoverykeys_devpkey.h>
#elif (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
Expand All @@ -1445,7 +1447,31 @@ std::vector<AudioEngine::RendererDetail> AudioEngine::GetRendererDetails()
{
std::vector<RendererDetail> list;

#ifdef _XBOX_ONE
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)

ComPtr<IMMDeviceEnumerator> devEnum;
HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(devEnum.GetAddressOf()));
ThrowIfFailed(hr);

ComPtr<IMMDeviceCollection> devices;
hr = devEnum->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &devices);
ThrowIfFailed(hr);

ComPtr<IMMDevice> endpoint;
ThrowIfFailed(devices->Item(0, endpoint.GetAddressOf()));

LPWSTR id = nullptr;
ThrowIfFailed(endpoint->GetId(&id));

RendererDetail device;
device.deviceId = id;
device.description = L"Default";

CoTaskMemFree(id);

list.emplace_back(device);

#elif defined(_XBOX_ONE)

using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
Expand All @@ -1465,7 +1491,7 @@ std::vector<AudioEngine::RendererDetail> AudioEngine::GetRendererDetails()
device.description = L"Default";
list.emplace_back(device);

#elif defined(USING_XAUDIO2_REDIST)
#elif defined(USING_XAUDIO2_REDIST) || defined(_GAMING_DESKTOP)

ComPtr<IMMDeviceEnumerator> devEnum;
HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(devEnum.GetAddressOf()));
Expand Down
2 changes: 1 addition & 1 deletion DirectXTK/Audio/SoundCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define DIRECTX_ENABLE_XWMA
#endif

#if defined(_XBOX_ONE) && defined(_TITLE)
#if (defined(_XBOX_ONE) && defined(_TITLE)) || defined(_GAMING_XBOX)
#define DIRECTX_ENABLE_XMA2
#endif

Expand Down
2 changes: 1 addition & 1 deletion DirectXTK/Audio/SoundEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <list>

#if defined(_XBOX_ONE) && defined(_TITLE)
#if (defined(_XBOX_ONE) && defined(_TITLE)) || defined(_GAMING_XBOX)
#include <apu.h>
#include <shapexmacontext.h>
#endif
Expand Down
12 changes: 6 additions & 6 deletions DirectXTK/Audio/SoundStreamInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "PlatformHelpers.h"
#include "SoundCommon.h"

#if defined(_XBOX_ONE) && defined(_TITLE)
#if (defined(_XBOX_ONE) && defined(_TITLE)) || defined(_GAMING_XBOX)
#include <apu.h>
#include <shapexmacontext.h>
#endif
Expand Down Expand Up @@ -54,7 +54,7 @@ namespace
if (!wfx)
return 0;

size_t buffer = wfx->nAvgBytesPerSec * 2;
size_t buffer = size_t(wfx->nAvgBytesPerSec) * 2u;

#ifdef DIRECTX_ENABLE_XMA2
if (tag == WAVE_FORMAT_XMA2)
Expand Down Expand Up @@ -510,7 +510,7 @@ HRESULT SoundStreamInstance::Impl::ReadBuffers() noexcept
uint32_t readBuffer = mCurrentDiskReadBuffer;
for (uint32_t j = 0; j < MAX_BUFFER_COUNT; ++j)
{
uint32_t entry = (j + readBuffer) % MAX_BUFFER_COUNT;
uint32_t entry = (j + readBuffer) % uint32_t(MAX_BUFFER_COUNT);
if (mPackets[entry].state == State::FREE)
{
if (mCurrentPosition < mLengthInBytes)
Expand All @@ -533,7 +533,7 @@ HRESULT SoundStreamInstance::Impl::ReadBuffers() noexcept

mCurrentPosition += cbValid;

mCurrentDiskReadBuffer = (entry + 1) % MAX_BUFFER_COUNT;
mCurrentDiskReadBuffer = (entry + 1) % uint32_t(MAX_BUFFER_COUNT);

mPackets[entry].state = State::PENDING;

Expand Down Expand Up @@ -689,7 +689,7 @@ HRESULT SoundStreamInstance::Impl::PlayBuffers() noexcept
uint32_t seekOffset = mPackets[mCurrentPlayBuffer].startPosition / mBlockAlign;
if (seekOffset > MAX_STREAMING_SEEK_PACKETS)
{
DebugTrace("ERROR: xWMA packet seek count exceeds %u\n", MAX_STREAMING_SEEK_PACKETS);
DebugTrace("ERROR: xWMA packet seek count exceeds %zu\n", MAX_STREAMING_SEEK_PACKETS);
return E_FAIL;
}
else if (seekOffset > 0)
Expand All @@ -716,7 +716,7 @@ HRESULT SoundStreamInstance::Impl::PlayBuffers() noexcept
}

mPackets[mCurrentPlayBuffer].state = State::PLAYING;
mCurrentPlayBuffer = (mCurrentPlayBuffer + 1) % MAX_BUFFER_COUNT;
mCurrentPlayBuffer = (mCurrentPlayBuffer + 1) % uint32_t(MAX_BUFFER_COUNT);
}

return S_OK;
Expand Down
2 changes: 1 addition & 1 deletion DirectXTK/Audio/WAVFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ namespace
{
// Return 'forward' loop
*pLoopStart = loops[j].start;
*pLoopLength = loops[j].end + loops[j].start + 1;
*pLoopLength = loops[j].end - loops[j].start + 1;
return S_OK;
}
}
Expand Down
2 changes: 1 addition & 1 deletion DirectXTK/Audio/WaveBankReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "PlatformHelpers.h"
#include "SoundCommon.h"

#if defined(_XBOX_ONE) && defined(_TITLE)
#if (defined(_XBOX_ONE) && defined(_TITLE)) || defined(_GAMING_XBOX)
#include <apu.h>
#include <shapexmacontext.h>
#endif
Expand Down
2 changes: 1 addition & 1 deletion DirectXTK/Audio/WaveBankReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace DirectX
bool HasNames() const noexcept;
bool IsStreamingBank() const noexcept;

#if defined(_XBOX_ONE) && defined(_TITLE)
#if (defined(_XBOX_ONE) && defined(_TITLE)) || defined(_GAMING_XBOX)
bool HasXMA() const noexcept;
#endif

Expand Down
Loading

0 comments on commit 49a84b9

Please sign in to comment.