Skip to content

Commit

Permalink
add user track manager debug module
Browse files Browse the repository at this point in the history
  • Loading branch information
yukani committed Aug 2, 2023
1 parent b8c7908 commit 34cb895
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
40 changes: 40 additions & 0 deletions source/toolsmenu/DebugModules/Audio/UserRadioTrackDebugModule.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include "StdInc.h"
#include "imgui.h"

#include "AEUserRadioTrackManager.h"
#include "UserRadioTrackDebugModule.h"

using namespace ImGui;

constexpr const char* AudioTypeFileNames[] = {"Unknown", "Vorbis", "WAV", "WMA", "QuickTime (MediaFoundation)", "FLAC"};

void UserRadioTrackDebugModule::RenderWindow() {
const notsa::ui::ScopedWindow window{"User Track Audio Manager", {860.f, 290.f}, m_IsOpen};
if (!m_IsOpen) {
return;
}

BeginGroup();

Text("Supported decoders:\n");
for (auto i = 1u; i < TOTAL_AUDIO_FILE_TYPE; i++) {
Text("\t%s: %s\n", AudioTypeFileNames[i], AEUserRadioTrackManager.m_baDecodersSupported[i] ? "Supported" : "Unsupported");
}

Text("\nNum tracks loaded: %u\n", AEUserRadioTrackManager.m_nUserTracksCount);
Text("User tracks:\n");
const auto& trackSpan = std::span{AEUserRadioTrackManager.m_pUserTracksInfo, (size_t)AEUserRadioTrackManager.m_nUserTracksCount};
for (auto&& [i, track] : notsa::enumerate(trackSpan)) {
Text(
"Track %u\n\tFormat: %s\n\tPath: '%s'",
i,
AudioTypeFileNames[track.fileType],
fs::path{AEUserRadioTrackManager.GetTrackPath(i)}.filename().string().c_str()
);
}
EndGroup();
}

void UserRadioTrackDebugModule::RenderMenuEntry() {
notsa::ui::DoNestedMenuIL({"Extra", "Audio"}, [&] { ImGui::MenuItem("User Track", nullptr, &m_IsOpen); });
}
12 changes: 12 additions & 0 deletions source/toolsmenu/DebugModules/Audio/UserRadioTrackDebugModule.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once

#include "DebugModule.h"

class UserRadioTrackDebugModule : public DebugModule {
public:
void RenderWindow() override final;
void RenderMenuEntry() override final;

private:
bool m_IsOpen{};
};
2 changes: 2 additions & 0 deletions source/toolsmenu/DebugModules/DebugModules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "./Audio/CutsceneTrackManagerDebugModule.h"
#include "./Audio/AmbienceTrackManagerDebugModule.h"
#include "./Audio/PoliceScannerAudioEntityDebugModule.h"
#include "./Audio/UserRadioTrackDebugModule.h"
#include "./CStreamingDebugModule.h"
#include "./CPickupsDebugModule.h"
#include "./CDarkelDebugModule.h"
Expand Down Expand Up @@ -84,6 +85,7 @@ void DebugModules::CreateModules() {
Add<PoliceScannerAudioEntityDebugModule>();
Add<AmbienceTrackManagerDebugModule>();
Add<CutsceneTrackManagerDebugModule>();
Add<UserRadioTrackDebugModule>();
Add<notsa::debugmodules::ScriptDebugModule>();
Add<notsa::debugmodules::CloudsDebugModule>();

Expand Down

0 comments on commit 34cb895

Please sign in to comment.