mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
code review comments
This commit is contained in:
parent
15669fd58c
commit
53a3c71847
@ -3,7 +3,6 @@
|
|||||||
#include "Csv/CsvStream.h"
|
#include "Csv/CsvStream.h"
|
||||||
#include "ObjContainer/SoundBank/SoundBank.h"
|
#include "ObjContainer/SoundBank/SoundBank.h"
|
||||||
#include "Sound/WavWriter.h"
|
#include "Sound/WavWriter.h"
|
||||||
#include "Utils/ClassUtils.h"
|
|
||||||
#include "nlohmann/json.hpp"
|
#include "nlohmann/json.hpp"
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
@ -81,7 +80,8 @@ namespace
|
|||||||
"snapshot",
|
"snapshot",
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string REVERB_HEADERS[]{"name",
|
const std::string REVERB_HEADERS[]{
|
||||||
|
"name",
|
||||||
"smoothing",
|
"smoothing",
|
||||||
"earlyTime",
|
"earlyTime",
|
||||||
"lateTime",
|
"lateTime",
|
||||||
@ -97,7 +97,8 @@ namespace
|
|||||||
"earlySize",
|
"earlySize",
|
||||||
"lateSize",
|
"lateSize",
|
||||||
"diffusion",
|
"diffusion",
|
||||||
"returnHighpass"};
|
"returnHighpass",
|
||||||
|
};
|
||||||
|
|
||||||
const std::string PREFIXES_TO_DROP[]{
|
const std::string PREFIXES_TO_DROP[]{
|
||||||
"raw/",
|
"raw/",
|
||||||
@ -116,7 +117,8 @@ namespace
|
|||||||
192000,
|
192000,
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string GROUPS_ENUM[]{"grp_reference",
|
const std::string GROUPS_ENUM[]{
|
||||||
|
"grp_reference",
|
||||||
"grp_master",
|
"grp_master",
|
||||||
"grp_wpn_lfe",
|
"grp_wpn_lfe",
|
||||||
"grp_lfe",
|
"grp_lfe",
|
||||||
@ -142,9 +144,11 @@ namespace
|
|||||||
"grp_air",
|
"grp_air",
|
||||||
"grp_bink",
|
"grp_bink",
|
||||||
"grp_announcer",
|
"grp_announcer",
|
||||||
""};
|
"",
|
||||||
|
};
|
||||||
|
|
||||||
const std::string CURVES_ENUM[]{"default",
|
const std::string CURVES_ENUM[]{
|
||||||
|
"default",
|
||||||
"defaultmin",
|
"defaultmin",
|
||||||
"allon",
|
"allon",
|
||||||
"alloff",
|
"alloff",
|
||||||
@ -161,7 +165,8 @@ namespace
|
|||||||
"cos",
|
"cos",
|
||||||
"rev60",
|
"rev60",
|
||||||
"rev65",
|
"rev65",
|
||||||
""};
|
"",
|
||||||
|
};
|
||||||
|
|
||||||
const std::unordered_map<unsigned int, std::string> CURVES_MAP{
|
const std::unordered_map<unsigned int, std::string> CURVES_MAP{
|
||||||
{4135636924, CURVES_ENUM[0] }, // "default"
|
{4135636924, CURVES_ENUM[0] }, // "default"
|
||||||
@ -218,16 +223,44 @@ namespace
|
|||||||
"snp_x3",
|
"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",
|
||||||
const std::string LOAD_TYPES_ENUM[]{"unknown", "loaded", "streamed", "primed"};
|
"loaded",
|
||||||
|
"streamed",
|
||||||
|
"primed",
|
||||||
|
};
|
||||||
|
|
||||||
const std::string BUS_IDS_ENUM[]{
|
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
|
} // namespace
|
||||||
|
|
||||||
class AssetDumperSndBank::Internal
|
class AssetDumperSndBank::Internal
|
||||||
@ -460,7 +493,7 @@ class AssetDumperSndBank::Internal
|
|||||||
stream.WriteColumn(((alias->flags0 >> 1) & 0x1) == 0 ? "no" : "yes");
|
stream.WriteColumn(((alias->flags0 >> 1) & 0x1) == 0 ? "no" : "yes");
|
||||||
|
|
||||||
// futz",
|
// futz",
|
||||||
stream.WriteColumn("");
|
stream.WriteColumn(std::to_string(alias->futzPatch));
|
||||||
|
|
||||||
// context_type",
|
// context_type",
|
||||||
stream.WriteColumn(std::to_string(alias->contextType));
|
stream.WriteColumn(std::to_string(alias->contextType));
|
||||||
@ -599,7 +632,7 @@ class AssetDumperSndBank::Internal
|
|||||||
{
|
{
|
||||||
std::unordered_set<unsigned> dumpedAssets;
|
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)
|
if (!outFile)
|
||||||
{
|
{
|
||||||
std::cerr << "Failed to open sound alias output file: \"" << sndBank->name << "\"\n";
|
std::cerr << "Failed to open sound alias output file: \"" << sndBank->name << "\"\n";
|
||||||
@ -635,7 +668,7 @@ class AssetDumperSndBank::Internal
|
|||||||
return;
|
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)
|
if (!outFile)
|
||||||
{
|
{
|
||||||
std::cerr << "Failed to open sound reverb output file: \"" << sndBank->name << "\"\n";
|
std::cerr << "Failed to open sound reverb output file: \"" << sndBank->name << "\"\n";
|
||||||
@ -676,7 +709,7 @@ class AssetDumperSndBank::Internal
|
|||||||
return;
|
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)
|
if (!outFile)
|
||||||
{
|
{
|
||||||
std::cerr << "Failed to open sound reverb output file: \"" << sndBank->name << "\"\n";
|
std::cerr << "Failed to open sound reverb output file: \"" << sndBank->name << "\"\n";
|
||||||
@ -693,7 +726,7 @@ class AssetDumperSndBank::Internal
|
|||||||
csvStream.WriteColumn(duck.name);
|
csvStream.WriteColumn(duck.name);
|
||||||
csvStream.NextRow();
|
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)
|
if (!outFile)
|
||||||
{
|
{
|
||||||
std::cerr << "Failed to open sound duck output file: \"" << duck.name << "\"\n";
|
std::cerr << "Failed to open sound duck output file: \"" << duck.name << "\"\n";
|
||||||
|
@ -2,38 +2,84 @@
|
|||||||
|
|
||||||
#include "Csv/CsvStream.h"
|
#include "Csv/CsvStream.h"
|
||||||
#include "ObjContainer/SoundBank/SoundBank.h"
|
#include "ObjContainer/SoundBank/SoundBank.h"
|
||||||
#include "Utils/ClassUtils.h"
|
|
||||||
|
|
||||||
#include <filesystem>
|
|
||||||
#include <fstream>
|
|
||||||
#include <unordered_map>
|
|
||||||
|
|
||||||
using namespace T6;
|
using namespace T6;
|
||||||
namespace fs = std::filesystem;
|
|
||||||
|
|
||||||
class AssetDumperSndDriverGlobals::Internal
|
class AssetDumperSndDriverGlobals::Internal
|
||||||
{
|
{
|
||||||
AssetDumpingContext& m_context;
|
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[]{
|
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[]{
|
inline static const std::string MASTER_HEADERS[]{
|
||||||
"name", "lowE", "lowG", "lowF", "lowQ", "peak1E", "peak1G", "peak1F", "peak1Q", "peak2E", "peak2G",
|
"name", "lowE", "lowG", "lowF", "lowQ", "peak1E", "peak1G", "peak1F", "peak1Q", "peak2E", "peak2G",
|
||||||
"peak2F", "peak2Q", "hiE", "hiG", "hiF", "hiQ", "eqG", "compE", "compPG", "compMG", "compT",
|
"peak2F", "peak2Q", "hiE", "hiG", "hiF", "hiQ", "eqG", "compE", "compPG", "compMG", "compT",
|
||||||
"compR", "compTA", "compTR", "limitE", "limitPG", "limitMG", "limitT", "limitR", "limitTA", "limitTR", "busReverbG",
|
"compR", "compTA", "compTR", "limitE", "limitPG", "limitMG", "limitT", "limitR", "limitTA", "limitTR", "busReverbG",
|
||||||
"busFxG", "busVoiceG", "busPfutzG", "busHdrfxG", "busUiG", "busMusicG", "busMovieG", "busVcsG", "busReverbE", "busFxE", "busVoiceE",
|
"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",
|
inline static const std::string FUTZ_HEADERS[]{
|
||||||
|
"name",
|
||||||
"bpfF",
|
"bpfF",
|
||||||
"bpfQ",
|
"bpfQ",
|
||||||
"lsG",
|
"lsG",
|
||||||
@ -50,7 +96,8 @@ class AssetDumperSndDriverGlobals::Internal
|
|||||||
"startAliasId",
|
"startAliasId",
|
||||||
"stopAliasId",
|
"stopAliasId",
|
||||||
"loopAliasId",
|
"loopAliasId",
|
||||||
"id"};
|
"id",
|
||||||
|
};
|
||||||
|
|
||||||
std::unique_ptr<std::ostream> OpenAssetFile(const std::string& filename)
|
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)
|
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)
|
if (outputFile != nullptr)
|
||||||
{
|
{
|
||||||
CsvOutputStream csvStream(*outputFile);
|
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++)
|
for (auto i = 0u; i < count; i++)
|
||||||
{
|
{
|
||||||
@ -98,12 +145,12 @@ class AssetDumperSndDriverGlobals::Internal
|
|||||||
|
|
||||||
void DumpSndCurves(const SndCurve* curves, const size_t count)
|
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)
|
if (outputFile != nullptr)
|
||||||
{
|
{
|
||||||
CsvOutputStream csvStream(*outputFile);
|
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++)
|
for (auto i = 0u; i < count; i++)
|
||||||
{
|
{
|
||||||
@ -125,12 +172,12 @@ class AssetDumperSndDriverGlobals::Internal
|
|||||||
|
|
||||||
void DumpSndPans(const SndPan* pans, const size_t count)
|
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)
|
if (outputFile != nullptr)
|
||||||
{
|
{
|
||||||
CsvOutputStream csvStream(*outputFile);
|
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++)
|
for (auto i = 0u; i < count; i++)
|
||||||
{
|
{
|
||||||
@ -150,12 +197,13 @@ class AssetDumperSndDriverGlobals::Internal
|
|||||||
|
|
||||||
void DumpSndDuckGroups(const SndDuckGroup* duckGroups, const size_t count)
|
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)
|
if (outputFile != nullptr)
|
||||||
{
|
{
|
||||||
CsvOutputStream csvStream(*outputFile);
|
CsvOutputStream csvStream(*outputFile);
|
||||||
csvStream.WriteColumn("name");
|
csvStream.WriteColumn("name");
|
||||||
|
csvStream.WriteColumn("id");
|
||||||
csvStream.NextRow();
|
csvStream.NextRow();
|
||||||
|
|
||||||
for (auto i = 0u; i < count; i++)
|
for (auto i = 0u; i < count; i++)
|
||||||
@ -170,12 +218,12 @@ class AssetDumperSndDriverGlobals::Internal
|
|||||||
|
|
||||||
void DumpSndMasters(const SndMaster* masters, const size_t count)
|
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)
|
if (outputFile != nullptr)
|
||||||
{
|
{
|
||||||
CsvOutputStream csvStream(*outputFile);
|
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++)
|
for (auto i = 0u; i < count; i++)
|
||||||
{
|
{
|
||||||
@ -240,12 +288,12 @@ class AssetDumperSndDriverGlobals::Internal
|
|||||||
|
|
||||||
void DumpSndSidechainDucks(const SndSidechainDuck* sidechains, const size_t count)
|
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)
|
if (outputFile != nullptr)
|
||||||
{
|
{
|
||||||
CsvOutputStream csvStream(*outputFile);
|
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++)
|
for (auto i = 0u; i < count; i++)
|
||||||
{
|
{
|
||||||
@ -265,12 +313,12 @@ class AssetDumperSndDriverGlobals::Internal
|
|||||||
|
|
||||||
void DumpSndFutz(const SndFutz* futzes, const size_t count)
|
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)
|
if (outputFile != nullptr)
|
||||||
{
|
{
|
||||||
CsvOutputStream csvStream(*outputFile);
|
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++)
|
for (auto i = 0u; i < count; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user