mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-05-11 21:39:56 -05:00
Installer sounds and embedded player. (#29)
* Embedded player implementation. * Rework embedded sound player to support simultaneous playback. * Add more embedded sounds. * Update submodule. * Update. * Move engine initialization. * Use guest audio configuration values in embedded player. * Miniaudio submodule on dev branch. * Implement libvorbis. * Update resources submodule. --------- Co-authored-by: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com>
This commit is contained in:
@@ -1,11 +1,25 @@
|
||||
#include <stdafx.h>
|
||||
|
||||
#include <bit>
|
||||
|
||||
#include "audio.h"
|
||||
#include "cpu/code_cache.h"
|
||||
|
||||
#define AUDIO_DRIVER_KEY (uint32_t)('DAUD')
|
||||
|
||||
// Use to dump raw audio captures to the game folder.
|
||||
//#define AUDIO_DUMP_SAMPLES_PATH "audio.pcm"
|
||||
|
||||
#ifdef AUDIO_DUMP_SAMPLES_PATH
|
||||
std::ofstream g_audioDumpStream;
|
||||
#endif
|
||||
|
||||
uint32_t XAudioRegisterRenderDriverClient(XLPDWORD callback, XLPDWORD driver)
|
||||
{
|
||||
#ifdef AUDIO_DUMP_SAMPLES_PATH
|
||||
g_audioDumpStream.open(AUDIO_DUMP_SAMPLES_PATH, std::ios::binary);
|
||||
#endif
|
||||
|
||||
*driver = AUDIO_DRIVER_KEY;
|
||||
XAudioRegisterClient(KeFindHostFunction(*callback), callback[1]);
|
||||
return 0;
|
||||
@@ -18,6 +32,19 @@ uint32_t XAudioUnregisterRenderDriverClient(DWORD driver)
|
||||
|
||||
uint32_t XAudioSubmitRenderDriverFrame(uint32_t driver, void* samples)
|
||||
{
|
||||
#ifdef AUDIO_DUMP_SAMPLES_PATH
|
||||
static uint32_t xaudioSamplesBuffer[XAUDIO_NUM_SAMPLES * XAUDIO_NUM_CHANNELS];
|
||||
for (size_t i = 0; i < XAUDIO_NUM_SAMPLES; i++)
|
||||
{
|
||||
for (size_t j = 0; j < XAUDIO_NUM_CHANNELS; j++)
|
||||
{
|
||||
xaudioSamplesBuffer[i * XAUDIO_NUM_CHANNELS + j] = std::byteswap(((uint32_t *)samples)[j * XAUDIO_NUM_SAMPLES + i]);
|
||||
}
|
||||
}
|
||||
|
||||
g_audioDumpStream.write((const char *)(xaudioSamplesBuffer), sizeof(xaudioSamplesBuffer));
|
||||
#endif
|
||||
|
||||
XAudioSubmitFrame(samples);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user