mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
code review comments
This commit is contained in:
parent
15669fd58c
commit
53a3c71847
@ -3,7 +3,6 @@
|
||||
#include "Csv/CsvStream.h"
|
||||
#include "ObjContainer/SoundBank/SoundBank.h"
|
||||
#include "Sound/WavWriter.h"
|
||||
#include "Utils/ClassUtils.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
@ -81,23 +80,25 @@ namespace
|
||||
"snapshot",
|
||||
};
|
||||
|
||||
const std::string REVERB_HEADERS[]{"name",
|
||||
"smoothing",
|
||||
"earlyTime",
|
||||
"lateTime",
|
||||
"earlyGain",
|
||||
"lateGain",
|
||||
"returnGain",
|
||||
"earlyLpf",
|
||||
"lateLpf",
|
||||
"inputLpf",
|
||||
"dampLpf",
|
||||
"wallReflect",
|
||||
"dryGain",
|
||||
"earlySize",
|
||||
"lateSize",
|
||||
"diffusion",
|
||||
"returnHighpass"};
|
||||
const std::string REVERB_HEADERS[]{
|
||||
"name",
|
||||
"smoothing",
|
||||
"earlyTime",
|
||||
"lateTime",
|
||||
"earlyGain",
|
||||
"lateGain",
|
||||
"returnGain",
|
||||
"earlyLpf",
|
||||
"lateLpf",
|
||||
"inputLpf",
|
||||
"dampLpf",
|
||||
"wallReflect",
|
||||
"dryGain",
|
||||
"earlySize",
|
||||
"lateSize",
|
||||
"diffusion",
|
||||
"returnHighpass",
|
||||
};
|
||||
|
||||
const std::string PREFIXES_TO_DROP[]{
|
||||
"raw/",
|
||||
@ -116,52 +117,56 @@ namespace
|
||||
192000,
|
||||
};
|
||||
|
||||
const std::string GROUPS_ENUM[]{"grp_reference",
|
||||
"grp_master",
|
||||
"grp_wpn_lfe",
|
||||
"grp_lfe",
|
||||
"grp_hdrfx",
|
||||
"grp_music",
|
||||
"grp_voice",
|
||||
"grp_set_piece",
|
||||
"grp_igc",
|
||||
"grp_mp_game",
|
||||
"grp_explosion",
|
||||
"grp_player_impacts",
|
||||
"grp_scripted_moment",
|
||||
"grp_menu",
|
||||
"grp_whizby",
|
||||
"grp_weapon",
|
||||
"grp_vehicle",
|
||||
"grp_impacts",
|
||||
"grp_foley",
|
||||
"grp_destructible",
|
||||
"grp_physics",
|
||||
"grp_ambience",
|
||||
"grp_alerts",
|
||||
"grp_air",
|
||||
"grp_bink",
|
||||
"grp_announcer",
|
||||
""};
|
||||
const std::string GROUPS_ENUM[]{
|
||||
"grp_reference",
|
||||
"grp_master",
|
||||
"grp_wpn_lfe",
|
||||
"grp_lfe",
|
||||
"grp_hdrfx",
|
||||
"grp_music",
|
||||
"grp_voice",
|
||||
"grp_set_piece",
|
||||
"grp_igc",
|
||||
"grp_mp_game",
|
||||
"grp_explosion",
|
||||
"grp_player_impacts",
|
||||
"grp_scripted_moment",
|
||||
"grp_menu",
|
||||
"grp_whizby",
|
||||
"grp_weapon",
|
||||
"grp_vehicle",
|
||||
"grp_impacts",
|
||||
"grp_foley",
|
||||
"grp_destructible",
|
||||
"grp_physics",
|
||||
"grp_ambience",
|
||||
"grp_alerts",
|
||||
"grp_air",
|
||||
"grp_bink",
|
||||
"grp_announcer",
|
||||
"",
|
||||
};
|
||||
|
||||
const std::string CURVES_ENUM[]{"default",
|
||||
"defaultmin",
|
||||
"allon",
|
||||
"alloff",
|
||||
"rcurve0",
|
||||
"rcurve1",
|
||||
"rcurve2",
|
||||
"rcurve3",
|
||||
"rcurve4",
|
||||
"rcurve5",
|
||||
"steep",
|
||||
"sindelay",
|
||||
"cosdelay",
|
||||
"sin",
|
||||
"cos",
|
||||
"rev60",
|
||||
"rev65",
|
||||
""};
|
||||
const std::string CURVES_ENUM[]{
|
||||
"default",
|
||||
"defaultmin",
|
||||
"allon",
|
||||
"alloff",
|
||||
"rcurve0",
|
||||
"rcurve1",
|
||||
"rcurve2",
|
||||
"rcurve3",
|
||||
"rcurve4",
|
||||
"rcurve5",
|
||||
"steep",
|
||||
"sindelay",
|
||||
"cosdelay",
|
||||
"sin",
|
||||
"cos",
|
||||
"rev60",
|
||||
"rev65",
|
||||
"",
|
||||
};
|
||||
|
||||
const std::unordered_map<unsigned int, std::string> CURVES_MAP{
|
||||
{4135636924, CURVES_ENUM[0] }, // "default"
|
||||
@ -218,16 +223,44 @@ namespace
|
||||
"snp_x3",
|
||||
};
|
||||
|
||||
const std::string LOOP_TYPES_ENUM[]{"nonlooping", "looping"};
|
||||
const std::string LIMIT_TYPES_ENUM[]{
|
||||
"none",
|
||||
"oldest",
|
||||
"reject",
|
||||
"priority",
|
||||
};
|
||||
|
||||
const std::string LIMIT_TYPES_ENUM[]{"none", "oldest", "reject", "priority"};
|
||||
const std::string MOVE_TYPES_ENUM[]{
|
||||
"none",
|
||||
"left_player",
|
||||
"center_player",
|
||||
"right_player",
|
||||
"random",
|
||||
"left_shot",
|
||||
"center_shot",
|
||||
"right_shot",
|
||||
};
|
||||
|
||||
const std::string MOVE_TYPES_ENUM[]{"none", "left_player", "center_player", "right_player", "random", "left_shot", "center_shot", "right_shot"};
|
||||
|
||||
const std::string LOAD_TYPES_ENUM[]{"unknown", "loaded", "streamed", "primed"};
|
||||
const std::string LOAD_TYPES_ENUM[]{
|
||||
"unknown",
|
||||
"loaded",
|
||||
"streamed",
|
||||
"primed",
|
||||
};
|
||||
|
||||
const std::string BUS_IDS_ENUM[]{
|
||||
"bus_reverb", "bus_fx", "bus_voice", "bus_pfutz", "bus_hdrfx", "bus_ui", "bus_reference", "bus_music", "bus_movie", "bus_reference", ""};
|
||||
"bus_reverb",
|
||||
"bus_fx",
|
||||
"bus_voice",
|
||||
"bus_pfutz",
|
||||
"bus_hdrfx",
|
||||
"bus_ui",
|
||||
"bus_reference",
|
||||
"bus_music",
|
||||
"bus_movie",
|
||||
"bus_reference",
|
||||
"",
|
||||
};
|
||||
} // namespace
|
||||
|
||||
class AssetDumperSndBank::Internal
|
||||
@ -460,7 +493,7 @@ class AssetDumperSndBank::Internal
|
||||
stream.WriteColumn(((alias->flags0 >> 1) & 0x1) == 0 ? "no" : "yes");
|
||||
|
||||
// futz",
|
||||
stream.WriteColumn("");
|
||||
stream.WriteColumn(std::to_string(alias->futzPatch));
|
||||
|
||||
// context_type",
|
||||
stream.WriteColumn(std::to_string(alias->contextType));
|
||||
@ -599,7 +632,7 @@ class AssetDumperSndBank::Internal
|
||||
{
|
||||
std::unordered_set<unsigned> dumpedAssets;
|
||||
|
||||
const auto outFile = OpenAssetOutputFile("soundbank\\" + std::string(sndBank->name) + ".aliases", ".csv");
|
||||
const auto outFile = OpenAssetOutputFile("soundbank/" + std::string(sndBank->name) + ".aliases", ".csv");
|
||||
if (!outFile)
|
||||
{
|
||||
std::cerr << "Failed to open sound alias output file: \"" << sndBank->name << "\"\n";
|
||||
@ -635,7 +668,7 @@ class AssetDumperSndBank::Internal
|
||||
return;
|
||||
}
|
||||
|
||||
const auto outFile = OpenAssetOutputFile("soundbank\\" + std::string(sndBank->name) + ".reverbs", ".csv");
|
||||
const auto outFile = OpenAssetOutputFile("soundbank/" + std::string(sndBank->name) + ".reverbs", ".csv");
|
||||
if (!outFile)
|
||||
{
|
||||
std::cerr << "Failed to open sound reverb output file: \"" << sndBank->name << "\"\n";
|
||||
@ -676,7 +709,7 @@ class AssetDumperSndBank::Internal
|
||||
return;
|
||||
}
|
||||
|
||||
const auto outFile = OpenAssetOutputFile("soundbank\\" + std::string(sndBank->name) + ".ducklist", ".csv");
|
||||
const auto outFile = OpenAssetOutputFile("soundbank/" + std::string(sndBank->name) + ".ducklist", ".csv");
|
||||
if (!outFile)
|
||||
{
|
||||
std::cerr << "Failed to open sound reverb output file: \"" << sndBank->name << "\"\n";
|
||||
@ -693,7 +726,7 @@ class AssetDumperSndBank::Internal
|
||||
csvStream.WriteColumn(duck.name);
|
||||
csvStream.NextRow();
|
||||
|
||||
const auto duckFile = OpenAssetOutputFile("soundbank\\ducks\\" + std::string(duck.name), ".duk");
|
||||
const auto duckFile = OpenAssetOutputFile("soundbank/ducks/" + std::string(duck.name), ".duk");
|
||||
if (!outFile)
|
||||
{
|
||||
std::cerr << "Failed to open sound duck output file: \"" << duck.name << "\"\n";
|
||||
|
@ -2,55 +2,102 @@
|
||||
|
||||
#include "Csv/CsvStream.h"
|
||||
#include "ObjContainer/SoundBank/SoundBank.h"
|
||||
#include "Utils/ClassUtils.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace T6;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
class AssetDumperSndDriverGlobals::Internal
|
||||
{
|
||||
AssetDumpingContext& m_context;
|
||||
|
||||
inline static const std::string GROUPS_HEADERS[]{"name", "attenuationSp", "attenuationMp", "category", "parent", "id"};
|
||||
inline static const std::string GROUPS_HEADERS[]{
|
||||
"name",
|
||||
"attenuationSp",
|
||||
"attenuationMp",
|
||||
"category",
|
||||
"parent",
|
||||
"id",
|
||||
};
|
||||
|
||||
inline static const std::string GROUPS_CATEGORIES[]{"sfx", "music", "void", "ui", "cinematic", "id"};
|
||||
inline static const std::string GROUPS_CATEGORIES[]{
|
||||
"sfx",
|
||||
"music",
|
||||
"void",
|
||||
"ui",
|
||||
"cinematic",
|
||||
"id",
|
||||
};
|
||||
|
||||
inline static const std::string CURVE_HEADERS[]{
|
||||
"name", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "x4", "y4", "x5", "y5", "x6", "y6", "x7", "y7", "id"};
|
||||
"name",
|
||||
"x0",
|
||||
"y0",
|
||||
"x1",
|
||||
"y1",
|
||||
"x2",
|
||||
"y2",
|
||||
"x3",
|
||||
"y3",
|
||||
"x4",
|
||||
"y4",
|
||||
"x5",
|
||||
"y5",
|
||||
"x6",
|
||||
"y6",
|
||||
"x7",
|
||||
"y7",
|
||||
"id",
|
||||
};
|
||||
|
||||
inline static const std::string PAN_HEADERS[]{"name", "front", "back", "center", "lfe", "left", "right", "id"};
|
||||
inline static const std::string PAN_HEADERS[]{
|
||||
"name",
|
||||
"front",
|
||||
"back",
|
||||
"center",
|
||||
"lfe",
|
||||
"left",
|
||||
"right",
|
||||
"id",
|
||||
};
|
||||
|
||||
inline static const std::string MASTER_HEADERS[]{
|
||||
"name", "lowE", "lowG", "lowF", "lowQ", "peak1E", "peak1G", "peak1F", "peak1Q", "peak2E", "peak2G",
|
||||
"peak2F", "peak2Q", "hiE", "hiG", "hiF", "hiQ", "eqG", "compE", "compPG", "compMG", "compT",
|
||||
"compR", "compTA", "compTR", "limitE", "limitPG", "limitMG", "limitT", "limitR", "limitTA", "limitTR", "busReverbG",
|
||||
"busFxG", "busVoiceG", "busPfutzG", "busHdrfxG", "busUiG", "busMusicG", "busMovieG", "busVcsG", "busReverbE", "busFxE", "busVoiceE",
|
||||
"busPfutzE", "busHdrfxE", "busUiE", "busMusicE", "busMovieE", "hdrfxCompE", "voiceEqE", "voiceCompE", "id"};
|
||||
"busPfutzE", "busHdrfxE", "busUiE", "busMusicE", "busMovieE", "hdrfxCompE", "voiceEqE", "voiceCompE", "id",
|
||||
};
|
||||
|
||||
inline static const std::string SIDECHAIN_HEADERS[]{"name", "g", "f", "q", "ta", "tr", "tf", "id"};
|
||||
inline static const std::string SIDECHAIN_HEADERS[]{
|
||||
"name",
|
||||
"g",
|
||||
"f",
|
||||
"q",
|
||||
"ta",
|
||||
"tr",
|
||||
"tf",
|
||||
"id",
|
||||
};
|
||||
|
||||
inline static const std::string FUTZ_HEADERS[]{"name",
|
||||
"bpfF",
|
||||
"bpfQ",
|
||||
"lsG",
|
||||
"lsF",
|
||||
"lsQ",
|
||||
"dist",
|
||||
"preG",
|
||||
"postG",
|
||||
"th",
|
||||
"tg",
|
||||
"clippre",
|
||||
"clippost",
|
||||
"blend",
|
||||
"startAliasId",
|
||||
"stopAliasId",
|
||||
"loopAliasId",
|
||||
"id"};
|
||||
inline static const std::string FUTZ_HEADERS[]{
|
||||
"name",
|
||||
"bpfF",
|
||||
"bpfQ",
|
||||
"lsG",
|
||||
"lsF",
|
||||
"lsQ",
|
||||
"dist",
|
||||
"preG",
|
||||
"postG",
|
||||
"th",
|
||||
"tg",
|
||||
"clippre",
|
||||
"clippost",
|
||||
"blend",
|
||||
"startAliasId",
|
||||
"stopAliasId",
|
||||
"loopAliasId",
|
||||
"id",
|
||||
};
|
||||
|
||||
std::unique_ptr<std::ostream> OpenAssetFile(const std::string& filename)
|
||||
{
|
||||
@ -75,12 +122,12 @@ class AssetDumperSndDriverGlobals::Internal
|
||||
|
||||
void DumpSndVolumesGroups(const SndVolumeGroup* groups, const size_t count)
|
||||
{
|
||||
const auto outputFile = this->OpenAssetFile("soundbank\\globals\\group.csv");
|
||||
const auto outputFile = this->OpenAssetFile("soundbank/globals/group.csv");
|
||||
|
||||
if (outputFile != nullptr)
|
||||
{
|
||||
CsvOutputStream csvStream(*outputFile);
|
||||
WriteFileHeader(csvStream, GROUPS_HEADERS, 6);
|
||||
WriteFileHeader(csvStream, GROUPS_HEADERS, std::extent_v<decltype(GROUPS_HEADERS)>);
|
||||
|
||||
for (auto i = 0u; i < count; i++)
|
||||
{
|
||||
@ -98,12 +145,12 @@ class AssetDumperSndDriverGlobals::Internal
|
||||
|
||||
void DumpSndCurves(const SndCurve* curves, const size_t count)
|
||||
{
|
||||
const auto outputFile = this->OpenAssetFile("soundbank\\globals\\curves.csv");
|
||||
const auto outputFile = this->OpenAssetFile("soundbank/globals/curves.csv");
|
||||
|
||||
if (outputFile != nullptr)
|
||||
{
|
||||
CsvOutputStream csvStream(*outputFile);
|
||||
WriteFileHeader(csvStream, CURVE_HEADERS, 18);
|
||||
WriteFileHeader(csvStream, CURVE_HEADERS, std::extent_v<decltype(CURVE_HEADERS)>);
|
||||
|
||||
for (auto i = 0u; i < count; i++)
|
||||
{
|
||||
@ -125,12 +172,12 @@ class AssetDumperSndDriverGlobals::Internal
|
||||
|
||||
void DumpSndPans(const SndPan* pans, const size_t count)
|
||||
{
|
||||
const auto outputFile = this->OpenAssetFile("soundbank\\globals\\pan.csv");
|
||||
const auto outputFile = this->OpenAssetFile("soundbank/globals/pan.csv");
|
||||
|
||||
if (outputFile != nullptr)
|
||||
{
|
||||
CsvOutputStream csvStream(*outputFile);
|
||||
WriteFileHeader(csvStream, PAN_HEADERS, 8);
|
||||
WriteFileHeader(csvStream, PAN_HEADERS, std::extent_v<decltype(PAN_HEADERS)>);
|
||||
|
||||
for (auto i = 0u; i < count; i++)
|
||||
{
|
||||
@ -150,12 +197,13 @@ class AssetDumperSndDriverGlobals::Internal
|
||||
|
||||
void DumpSndDuckGroups(const SndDuckGroup* duckGroups, const size_t count)
|
||||
{
|
||||
const auto outputFile = this->OpenAssetFile("soundbank\\globals\\duck_groups.csv");
|
||||
const auto outputFile = this->OpenAssetFile("soundbank/globals/duck_groups.csv");
|
||||
|
||||
if (outputFile != nullptr)
|
||||
{
|
||||
CsvOutputStream csvStream(*outputFile);
|
||||
csvStream.WriteColumn("name");
|
||||
csvStream.WriteColumn("id");
|
||||
csvStream.NextRow();
|
||||
|
||||
for (auto i = 0u; i < count; i++)
|
||||
@ -170,12 +218,12 @@ class AssetDumperSndDriverGlobals::Internal
|
||||
|
||||
void DumpSndMasters(const SndMaster* masters, const size_t count)
|
||||
{
|
||||
const auto outputFile = this->OpenAssetFile("soundbank\\globals\\master.csv");
|
||||
const auto outputFile = this->OpenAssetFile("soundbank/globals/master.csv");
|
||||
|
||||
if (outputFile != nullptr)
|
||||
{
|
||||
CsvOutputStream csvStream(*outputFile);
|
||||
WriteFileHeader(csvStream, MASTER_HEADERS, 53);
|
||||
WriteFileHeader(csvStream, MASTER_HEADERS, std::extent_v<decltype(MASTER_HEADERS)>);
|
||||
|
||||
for (auto i = 0u; i < count; i++)
|
||||
{
|
||||
@ -240,12 +288,12 @@ class AssetDumperSndDriverGlobals::Internal
|
||||
|
||||
void DumpSndSidechainDucks(const SndSidechainDuck* sidechains, const size_t count)
|
||||
{
|
||||
const auto outputFile = this->OpenAssetFile("soundbank\\globals\\sidechain_duck.csv");
|
||||
const auto outputFile = this->OpenAssetFile("soundbank/globals/sidechain_duck.csv");
|
||||
|
||||
if (outputFile != nullptr)
|
||||
{
|
||||
CsvOutputStream csvStream(*outputFile);
|
||||
WriteFileHeader(csvStream, SIDECHAIN_HEADERS, 8);
|
||||
WriteFileHeader(csvStream, SIDECHAIN_HEADERS, std::extent_v<decltype(SIDECHAIN_HEADERS)>);
|
||||
|
||||
for (auto i = 0u; i < count; i++)
|
||||
{
|
||||
@ -265,12 +313,12 @@ class AssetDumperSndDriverGlobals::Internal
|
||||
|
||||
void DumpSndFutz(const SndFutz* futzes, const size_t count)
|
||||
{
|
||||
const auto outputFile = this->OpenAssetFile("soundbank\\globals\\futz.csv");
|
||||
const auto outputFile = this->OpenAssetFile("soundbank/globals/futz.csv");
|
||||
|
||||
if (outputFile != nullptr)
|
||||
{
|
||||
CsvOutputStream csvStream(*outputFile);
|
||||
WriteFileHeader(csvStream, FUTZ_HEADERS, 18);
|
||||
WriteFileHeader(csvStream, FUTZ_HEADERS, std::extent_v<decltype(FUTZ_HEADERS)>);
|
||||
|
||||
for (auto i = 0u; i < count; i++)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user