mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-18 03:44:32 +01:00
WASAPI: Improve error handling and sysinfo display
This commit is contained in:
1 parent
0d2f7055fd
commit
2cc8e87389
6 files changed
+187
-40
No files matched your search
+34
-18
@@ -76,10 +76,14 @@ void SystemInfoScreen::CreateTabs() {
|
||||
using namespace UI;
|
||||
|
||||
auto si = GetI18NCategory(I18NCat::SYSINFO);
|
||||
auto ms = GetI18NCategory(I18NCat::MAINSETTINGS);
|
||||
|
||||
AddTab("Device Info", si->T("Device Info"), [this](UI::LinearLayout *parent) {
|
||||
CreateDeviceInfoTab(parent);
|
||||
});
|
||||
AddTab("Audio", ms->T("Audio"), [this](UI::LinearLayout *parent) {
|
||||
CreateAudioInfoTab(parent);
|
||||
});
|
||||
AddTab("Storage", si->T("Storage"), [this](UI::LinearLayout *parent) {
|
||||
CreateStorageTab(parent);
|
||||
});
|
||||
@@ -215,24 +219,6 @@ void SystemInfoScreen::CreateDeviceInfoTab(UI::LinearLayout *deviceSpecs) {
|
||||
#endif
|
||||
osInformation->Add(new InfoItem(si->T("PPSSPP build"), build));
|
||||
|
||||
CollapsibleSection *audioInformation = deviceSpecs->Add(new CollapsibleSection(si->T("Audio Information")));
|
||||
extern AudioBackend *g_audioBackend;
|
||||
if (g_audioBackend) {
|
||||
char fmtStr[256];
|
||||
g_audioBackend->DescribeOutputFormat(fmtStr, sizeof(fmtStr));
|
||||
audioInformation->Add(new InfoItem(si->T("Stream format"), fmtStr));
|
||||
} else {
|
||||
audioInformation->Add(new InfoItem(si->T("Sample rate"), StringFromFormat(si->T_cstr("%d Hz"), System_GetPropertyInt(SYSPROP_AUDIO_SAMPLE_RATE))));
|
||||
}
|
||||
int framesPerBuffer = System_GetPropertyInt(SYSPROP_AUDIO_FRAMES_PER_BUFFER);
|
||||
if (framesPerBuffer > 0) {
|
||||
audioInformation->Add(new InfoItem(si->T("Frames per buffer"), StringFromFormat("%d", framesPerBuffer)));
|
||||
}
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
audioInformation->Add(new InfoItem(si->T("Optimal sample rate"), StringFromFormat(si->T_cstr("%d Hz"), System_GetPropertyInt(SYSPROP_AUDIO_OPTIMAL_SAMPLE_RATE))));
|
||||
audioInformation->Add(new InfoItem(si->T("Optimal frames per buffer"), StringFromFormat("%d", System_GetPropertyInt(SYSPROP_AUDIO_OPTIMAL_FRAMES_PER_BUFFER))));
|
||||
#endif
|
||||
|
||||
CollapsibleSection *displayInfo = deviceSpecs->Add(new CollapsibleSection(si->T("Display Information")));
|
||||
#if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(UWP)
|
||||
displayInfo->Add(new InfoItem(si->T("Native resolution"), StringFromFormat("%dx%d",
|
||||
@@ -429,6 +415,36 @@ void SystemInfoScreen::CreateCPUExtensionsTab(UI::LinearLayout *cpuExtensions) {
|
||||
}
|
||||
}
|
||||
|
||||
void SystemInfoScreen::CreateAudioInfoTab(UI::LinearLayout *audio) {
|
||||
using namespace UI;
|
||||
|
||||
auto si = GetI18NCategory(I18NCat::SYSINFO);
|
||||
auto di = GetI18NCategory(I18NCat::DIALOG);
|
||||
auto a = GetI18NCategory(I18NCat::AUDIO);
|
||||
|
||||
CollapsibleSection *audioInformation = audio->Add(new CollapsibleSection(si->T("Audio Information")));
|
||||
extern AudioBackend *g_audioBackend;
|
||||
|
||||
if (g_audioBackend) {
|
||||
audioInformation->Add(new InfoItem(a->T("Device"), g_audioBackend->GetCurrentDeviceName()));
|
||||
char fmtStr[256];
|
||||
g_audioBackend->DescribeOutputFormat(fmtStr, sizeof(fmtStr));
|
||||
audioInformation->Add(new InfoItem(si->T("Stream format"), fmtStr));
|
||||
std::string error = g_audioBackend->GetErrorString();
|
||||
audioInformation->Add(new InfoItem(a->T("Audio Error"), error.empty() ? di->T("None") : error));
|
||||
} else {
|
||||
audioInformation->Add(new InfoItem(si->T("Sample rate"), StringFromFormat(si->T_cstr("%d Hz"), System_GetPropertyInt(SYSPROP_AUDIO_SAMPLE_RATE))));
|
||||
}
|
||||
int framesPerBuffer = System_GetPropertyInt(SYSPROP_AUDIO_FRAMES_PER_BUFFER);
|
||||
if (framesPerBuffer > 0) {
|
||||
audioInformation->Add(new InfoItem(si->T("Frames per buffer"), StringFromFormat("%d", framesPerBuffer)));
|
||||
}
|
||||
if (System_GetPropertyInt(SYSPROP_AUDIO_OPTIMAL_SAMPLE_RATE) > 0) {
|
||||
audioInformation->Add(new InfoItem(si->T("Optimal sample rate"), StringFromFormat(si->T_cstr("%d Hz"), System_GetPropertyInt(SYSPROP_AUDIO_OPTIMAL_SAMPLE_RATE))));
|
||||
audioInformation->Add(new InfoItem(si->T("Optimal frames per buffer"), StringFromFormat("%d", System_GetPropertyInt(SYSPROP_AUDIO_OPTIMAL_FRAMES_PER_BUFFER))));
|
||||
}
|
||||
}
|
||||
|
||||
void SystemInfoScreen::CreateDriverBugsTab(UI::LinearLayout *driverBugs) {
|
||||
using namespace UI;
|
||||
using namespace Draw;
|
||||
|
||||
Reference in new issue
Block a user