proof of concept

This commit is contained in:
goeiecool9999 2023-12-17 02:50:00 +01:00
parent bab1616565
commit a7a116a6f1
9 changed files with 138 additions and 110 deletions

View file

@ -25,6 +25,8 @@
#include "util/helpers/Serializer.h"
#include <wx/msgdlg.h>
#include <audio/IAudioAPI.h>
#include <util/bootSound/BootSoundReader.h>
#if BOOST_OS_WINDOWS
#include <psapi.h>
@ -374,6 +376,25 @@ void LatteShaderCache_ShowProgress(const std::function <bool(void)>& loadUpdateF
auto lastFrameUpdate = tick_cached();
AudioAPIPtr audioDev;
const sint32 samplesPerBlock = 4800;
const sint32 audioBlockSize = samplesPerBlock * 2 * 2;
try
{
audioDev = IAudioAPI::CreateDeviceFromConfig(true, 48000, 2, samplesPerBlock, 16);
}
catch (const std::runtime_error& ex)
{
cemuLog_log(LogType::Force, "Failed to initialise audio device for bootup sound");
}
audioDev->Play();
std::string sndPath = fmt::format("{}/meta/{}", CafeSystem::GetMlcStoragePath(CafeSystem::GetForegroundTitleId()), "bootSound.btsnd");
sint32 fscStatus = FSC_STATUS_UNDEFINED;
static auto bootsndFile = fsc_open(sndPath.c_str(), FSC_ACCESS_FLAG::OPEN_FILE | FSC_ACCESS_FLAG::READ_PERMISSION, &fscStatus);
static BootSoundReader reader{bootsndFile, audioBlockSize};
while (true)
{
if (Latte_GetStopSignal())
@ -495,7 +516,15 @@ void LatteShaderCache_ShowProgress(const std::function <bool(void)>& loadUpdateF
// finish frame
g_renderer->SwapBuffers(true, true);
if(audioDev && bootsndFile)
{
if (audioDev->NeedAdditionalBlocks())
audioDev->FeedBlock(reader.getSamples());
}
}
audioDev->Stop();
}
void LatteShaderCache_LoadVulkanPipelineCache(uint64 cacheTitleId)