2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-08-30 21:53:15 +00:00

refactor: streamline sound dumping

This commit is contained in:
Jan Laupetin
2025-07-31 20:57:13 +01:00
parent 566f3994e3
commit 58de885ebe
27 changed files with 638 additions and 617 deletions

View File

@@ -403,7 +403,7 @@ namespace T6
collection.AddAssetCreator(CreateMaterialLoader(memory, searchPath));
// collection.AddAssetCreator(std::make_unique<AssetLoaderTechniqueSet>(memory));
collection.AddAssetCreator(CreateImageLoader(memory, searchPath));
collection.AddAssetCreator(CreateSoundBankLoader(memory, searchPath));
collection.AddAssetCreator(sound::CreateSoundBankLoader(memory, searchPath));
// collection.AddAssetCreator(std::make_unique<AssetLoaderSoundPatch>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderClipMapPvs>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderComWorld>(memory));

View File

@@ -1079,7 +1079,7 @@ namespace
};
} // namespace
namespace T6
namespace T6::sound
{
std::unique_ptr<AssetCreator<AssetSoundBank>> CreateSoundBankLoader(MemoryManager& memory, ISearchPath& searchPath)
{

View File

@@ -7,7 +7,7 @@
#include <memory>
namespace T6
namespace T6::sound
{
std::unique_ptr<AssetCreator<AssetSoundBank>> CreateSoundBankLoader(MemoryManager& memory, ISearchPath& searchPath);
} // namespace T6

View File

@@ -8,7 +8,7 @@
#include "Maps/MapEntsDumperIW3.h"
#include "ObjWriting.h"
#include "RawFile/RawFileDumperIW3.h"
#include "Sound/AssetDumperLoadedSound.h"
#include "Sound/LoadedSoundDumperIW3.h"
#include "StringTable/StringTableDumperIW3.h"
#include "Weapon/AssetDumperWeapon.h"
@@ -33,7 +33,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
DUMP_ASSET_POOL(image::Dumper, m_image, ASSET_TYPE_IMAGE)
// DUMP_ASSET_POOL(AssetDumpersnd_alias_list_t, m_sound, ASSET_TYPE_SOUND)
// DUMP_ASSET_POOL(AssetDumperSndCurve, m_sound_curve, ASSET_TYPE_SOUND_CURVE)
DUMP_ASSET_POOL(AssetDumperLoadedSound, m_loaded_sound, ASSET_TYPE_LOADED_SOUND)
DUMP_ASSET_POOL(sound::LoadedSoundDumper, m_loaded_sound, ASSET_TYPE_LOADED_SOUND)
// DUMP_ASSET_POOL(AssetDumperClipMap, m_clip_map, ASSET_TYPE_CLIPMAP_PVS)
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
// DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp, ASSET_TYPE_GAMEWORLD_SP)

View File

@@ -1,46 +0,0 @@
#include "AssetDumperLoadedSound.h"
#include "Sound/WavTypes.h"
#include "Sound/WavWriter.h"
#include <format>
using namespace IW3;
bool AssetDumperLoadedSound::ShouldDump(XAssetInfo<LoadedSound>* asset)
{
return true;
}
void AssetDumperLoadedSound::DumpWavPcm(const LoadedSound* asset, std::ostream& stream)
{
const WavWriter writer(stream);
const WavMetaData metaData{.channelCount = static_cast<unsigned>(asset->sound.info.channels),
.samplesPerSec = static_cast<unsigned>(asset->sound.info.rate),
.bitsPerSample = static_cast<unsigned>(asset->sound.info.bits)};
writer.WritePcmHeader(metaData, asset->sound.info.data_len);
writer.WritePcmData(asset->sound.data, asset->sound.info.data_len);
}
void AssetDumperLoadedSound::DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset)
{
const auto* loadedSound = asset->Asset();
const auto assetFile = context.OpenAssetFile(std::format("sound/{}", asset->m_name));
if (!assetFile)
return;
auto& stream = *assetFile;
switch (static_cast<WavFormat>(loadedSound->sound.info.format))
{
case WavFormat::PCM:
DumpWavPcm(loadedSound, stream);
break;
default:
std::cerr << std::format("Unknown format {} for loaded sound: {}\n", loadedSound->sound.info.format, loadedSound->name);
break;
}
}

View File

@@ -0,0 +1,52 @@
#include "LoadedSoundDumperIW3.h"
#include "Sound/WavTypes.h"
#include "Sound/WavWriter.h"
#include <format>
using namespace IW3;
namespace
{
void DumpWavPcm(const LoadedSound* asset, std::ostream& stream)
{
const WavWriter writer(stream);
const WavMetaData metaData{.channelCount = static_cast<unsigned>(asset->sound.info.channels),
.samplesPerSec = static_cast<unsigned>(asset->sound.info.rate),
.bitsPerSample = static_cast<unsigned>(asset->sound.info.bits)};
writer.WritePcmHeader(metaData, asset->sound.info.data_len);
writer.WritePcmData(asset->sound.data, asset->sound.info.data_len);
}
} // namespace
namespace IW3::sound
{
bool LoadedSoundDumper::ShouldDump(XAssetInfo<LoadedSound>* asset)
{
return true;
}
void LoadedSoundDumper::DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset)
{
const auto* loadedSound = asset->Asset();
const auto assetFile = context.OpenAssetFile(std::format("sound/{}", asset->m_name));
if (!assetFile)
return;
auto& stream = *assetFile;
switch (static_cast<WavFormat>(loadedSound->sound.info.format))
{
case WavFormat::PCM:
DumpWavPcm(loadedSound, stream);
break;
default:
std::cerr << std::format("Unknown format {} for loaded sound: {}\n", loadedSound->sound.info.format, loadedSound->name);
break;
}
}
} // namespace IW3::sound

View File

@@ -3,14 +3,12 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW3/IW3.h"
namespace IW3
namespace IW3::sound
{
class AssetDumperLoadedSound final : public AbstractAssetDumper<LoadedSound>
class LoadedSoundDumper final : public AbstractAssetDumper<LoadedSound>
{
static void DumpWavPcm(const LoadedSound* asset, std::ostream& stream);
protected:
bool ShouldDump(XAssetInfo<LoadedSound>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset) override;
};
} // namespace IW3
} // namespace IW3::sound

View File

@@ -17,8 +17,8 @@
#include "RawFile/RawFileDumperIW4.h"
#include "Shader/AssetDumperPixelShader.h"
#include "Shader/AssetDumperVertexShader.h"
#include "Sound/AssetDumperLoadedSound.h"
#include "Sound/AssetDumperSndCurve.h"
#include "Sound/LoadedSoundDumperIW4.h"
#include "Sound/SndCurveDumperIW4.h"
#include "StringTable/StringTableDumperIW4.h"
#include "StructuredDataDef/AssetDumperStructuredDataDefSet.h"
#include "Techset/TechsetDumperIW4.h"
@@ -52,8 +52,8 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
DUMP_ASSET_POOL(techset::Dumper, m_technique_set, ASSET_TYPE_TECHNIQUE_SET)
DUMP_ASSET_POOL(image::Dumper, m_image, ASSET_TYPE_IMAGE)
// DUMP_ASSET_POOL(AssetDumpersnd_alias_list_t, m_sound, ASSET_TYPE_SOUND)
DUMP_ASSET_POOL(AssetDumperSndCurve, m_sound_curve, ASSET_TYPE_SOUND_CURVE)
DUMP_ASSET_POOL(AssetDumperLoadedSound, m_loaded_sound, ASSET_TYPE_LOADED_SOUND)
DUMP_ASSET_POOL(sound::SndCurveDumper, m_sound_curve, ASSET_TYPE_SOUND_CURVE)
DUMP_ASSET_POOL(sound::LoadedSoundDumper, m_loaded_sound, ASSET_TYPE_LOADED_SOUND)
// DUMP_ASSET_POOL(AssetDumperClipMap, m_clip_map, ASSET_TYPE_CLIPMAP_MP)
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
// DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp, ASSET_TYPE_GAMEWORLD_SP)

View File

@@ -1,46 +0,0 @@
#include "AssetDumperLoadedSound.h"
#include "Sound/WavTypes.h"
#include "Sound/WavWriter.h"
#include <format>
using namespace IW4;
bool AssetDumperLoadedSound::ShouldDump(XAssetInfo<LoadedSound>* asset)
{
return true;
}
void AssetDumperLoadedSound::DumpWavPcm(const LoadedSound* asset, std::ostream& stream)
{
const WavWriter writer(stream);
const WavMetaData metaData{.channelCount = static_cast<unsigned>(asset->sound.info.channels),
.samplesPerSec = static_cast<unsigned>(asset->sound.info.rate),
.bitsPerSample = static_cast<unsigned>(asset->sound.info.bits)};
writer.WritePcmHeader(metaData, asset->sound.info.data_len);
writer.WritePcmData(asset->sound.data, asset->sound.info.data_len);
}
void AssetDumperLoadedSound::DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset)
{
const auto* loadedSound = asset->Asset();
const auto assetFile = context.OpenAssetFile(std::format("sound/{}", asset->m_name));
if (!assetFile)
return;
auto& stream = *assetFile;
switch (static_cast<WavFormat>(loadedSound->sound.info.format))
{
case WavFormat::PCM:
DumpWavPcm(loadedSound, stream);
break;
default:
std::cerr << std::format("Unknown format {} for loaded sound: {}\n", loadedSound->sound.info.format, loadedSound->name);
break;
}
}

View File

@@ -1,39 +0,0 @@
#include "AssetDumperSndCurve.h"
#include "Dumping/SndCurve/SndCurveDumper.h"
#include <sstream>
using namespace IW4;
std::string AssetDumperSndCurve::GetAssetFilename(const std::string& assetName)
{
std::ostringstream ss;
ss << "soundaliases/" << assetName << ".vfcurve";
return ss.str();
}
bool AssetDumperSndCurve::ShouldDump(XAssetInfo<SndCurve>* asset)
{
return true;
}
void AssetDumperSndCurve::DumpAsset(AssetDumpingContext& context, XAssetInfo<SndCurve>* asset)
{
const auto* sndCurve = asset->Asset();
const auto assetFile = context.OpenAssetFile(GetAssetFilename(sndCurve->filename));
if (!assetFile)
return;
SndCurveDumper dumper(*assetFile);
const auto knotCount = std::min(static_cast<size_t>(sndCurve->knotCount), std::extent_v<decltype(SndCurve::knots)>);
dumper.Init(knotCount);
for (auto i = 0u; i < knotCount; i++)
dumper.WriteKnot(sndCurve->knots[i][0], sndCurve->knots[i][1]);
}

View File

@@ -0,0 +1,52 @@
#include "LoadedSoundDumperIW4.h"
#include "Sound/WavTypes.h"
#include "Sound/WavWriter.h"
#include <format>
using namespace IW4;
namespace
{
void DumpWavPcm(const LoadedSound* asset, std::ostream& stream)
{
const WavWriter writer(stream);
const WavMetaData metaData{.channelCount = static_cast<unsigned>(asset->sound.info.channels),
.samplesPerSec = static_cast<unsigned>(asset->sound.info.rate),
.bitsPerSample = static_cast<unsigned>(asset->sound.info.bits)};
writer.WritePcmHeader(metaData, asset->sound.info.data_len);
writer.WritePcmData(asset->sound.data, asset->sound.info.data_len);
}
} // namespace
namespace IW4::sound
{
bool LoadedSoundDumper::ShouldDump(XAssetInfo<LoadedSound>* asset)
{
return true;
}
void LoadedSoundDumper::DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset)
{
const auto* loadedSound = asset->Asset();
const auto assetFile = context.OpenAssetFile(std::format("sound/{}", asset->m_name));
if (!assetFile)
return;
auto& stream = *assetFile;
switch (static_cast<WavFormat>(loadedSound->sound.info.format))
{
case WavFormat::PCM:
DumpWavPcm(loadedSound, stream);
break;
default:
std::cerr << std::format("Unknown format {} for loaded sound: {}\n", loadedSound->sound.info.format, loadedSound->name);
break;
}
}
} // namespace IW4::sound

View File

@@ -3,14 +3,12 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
namespace IW4
namespace IW4::sound
{
class AssetDumperLoadedSound final : public AbstractAssetDumper<LoadedSound>
class LoadedSoundDumper final : public AbstractAssetDumper<LoadedSound>
{
static void DumpWavPcm(const LoadedSound* asset, std::ostream& stream);
protected:
bool ShouldDump(XAssetInfo<LoadedSound>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset) override;
};
} // namespace IW4
} // namespace IW4::sound

View File

@@ -0,0 +1,45 @@
#include "SndCurveDumperIW4.h"
#include "Dumping/SndCurve/SndCurveDumper.h"
#include <sstream>
using namespace IW4;
namespace
{
std::string GetAssetFilename(const std::string& assetName)
{
std::ostringstream ss;
ss << "soundaliases/" << assetName << ".vfcurve";
return ss.str();
}
} // namespace
namespace IW4::sound
{
bool SndCurveDumper::ShouldDump(XAssetInfo<SndCurve>* asset)
{
return true;
}
void SndCurveDumper::DumpAsset(AssetDumpingContext& context, XAssetInfo<SndCurve>* asset)
{
const auto* sndCurve = asset->Asset();
const auto assetFile = context.OpenAssetFile(GetAssetFilename(sndCurve->filename));
if (!assetFile)
return;
::SndCurveDumper dumper(*assetFile);
const auto knotCount = std::min(static_cast<size_t>(sndCurve->knotCount), std::extent_v<decltype(SndCurve::knots)>);
dumper.Init(knotCount);
for (auto i = 0u; i < knotCount; i++)
dumper.WriteKnot(sndCurve->knots[i][0], sndCurve->knots[i][1]);
}
} // namespace IW4::sound

View File

@@ -3,14 +3,12 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
namespace IW4
namespace IW4::sound
{
class AssetDumperSndCurve final : public AbstractAssetDumper<SndCurve>
class SndCurveDumper final : public AbstractAssetDumper<SndCurve>
{
static std::string GetAssetFilename(const std::string& assetName);
protected:
bool ShouldDump(XAssetInfo<SndCurve>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<SndCurve>* asset) override;
};
} // namespace IW4
} // namespace IW4::sound

View File

@@ -12,7 +12,7 @@
#include "ObjWriting.h"
#include "RawFile/RawFileDumperIW5.h"
#include "Script/ScriptDumperIW5.h"
#include "Sound/AssetDumperLoadedSound.h"
#include "Sound/LoadedSoundDumperIW5.h"
#include "StringTable/StringTableDumperIW5.h"
#include "Weapon/AssetDumperWeapon.h"
#include "Weapon/AssetDumperWeaponAttachment.h"
@@ -42,7 +42,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
DUMP_ASSET_POOL(image::Dumper, m_image, ASSET_TYPE_IMAGE)
// DUMP_ASSET_POOL(AssetDumpersnd_alias_list_t, m_sound, ASSET_TYPE_SOUND)
// DUMP_ASSET_POOL(AssetDumperSndCurve, m_sound_curve, ASSET_TYPE_SOUND_CURVE)
DUMP_ASSET_POOL(AssetDumperLoadedSound, m_loaded_sound, ASSET_TYPE_LOADED_SOUND)
DUMP_ASSET_POOL(sound::LoadedSoundDumper, m_loaded_sound, ASSET_TYPE_LOADED_SOUND)
// DUMP_ASSET_POOL(AssetDumperclipMap_t, m_clip_map, ASSET_TYPE_CLIPMAP)
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
// DUMP_ASSET_POOL(AssetDumperGlassWorld, m_glass_world, ASSET_TYPE_GLASSWORLD)

View File

@@ -1,46 +0,0 @@
#include "AssetDumperLoadedSound.h"
#include "Sound/WavTypes.h"
#include "Sound/WavWriter.h"
#include <format>
using namespace IW5;
bool AssetDumperLoadedSound::ShouldDump(XAssetInfo<LoadedSound>* asset)
{
return true;
}
void AssetDumperLoadedSound::DumpWavPcm(const LoadedSound* asset, std::ostream& stream)
{
const WavWriter writer(stream);
const WavMetaData metaData{.channelCount = static_cast<unsigned>(asset->sound.info.channels),
.samplesPerSec = static_cast<unsigned>(asset->sound.info.rate),
.bitsPerSample = static_cast<unsigned>(asset->sound.info.bits)};
writer.WritePcmHeader(metaData, asset->sound.info.data_len);
writer.WritePcmData(asset->sound.data, asset->sound.info.data_len);
}
void AssetDumperLoadedSound::DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset)
{
const auto* loadedSound = asset->Asset();
const auto assetFile = context.OpenAssetFile(std::format("sound/{}", asset->m_name));
if (!assetFile)
return;
auto& stream = *assetFile;
switch (static_cast<WavFormat>(loadedSound->sound.info.format))
{
case WavFormat::PCM:
DumpWavPcm(loadedSound, stream);
break;
default:
std::cerr << std::format("Unknown format {} for loaded sound: {}\n", loadedSound->sound.info.format, loadedSound->name);
break;
}
}

View File

@@ -0,0 +1,52 @@
#include "LoadedSoundDumperIW5.h"
#include "Sound/WavTypes.h"
#include "Sound/WavWriter.h"
#include <format>
using namespace IW5;
namespace
{
void DumpWavPcm(const LoadedSound* asset, std::ostream& stream)
{
const WavWriter writer(stream);
const WavMetaData metaData{.channelCount = static_cast<unsigned>(asset->sound.info.channels),
.samplesPerSec = static_cast<unsigned>(asset->sound.info.rate),
.bitsPerSample = static_cast<unsigned>(asset->sound.info.bits)};
writer.WritePcmHeader(metaData, asset->sound.info.data_len);
writer.WritePcmData(asset->sound.data, asset->sound.info.data_len);
}
} // namespace
namespace IW5::sound
{
bool LoadedSoundDumper::ShouldDump(XAssetInfo<LoadedSound>* asset)
{
return true;
}
void LoadedSoundDumper::DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset)
{
const auto* loadedSound = asset->Asset();
const auto assetFile = context.OpenAssetFile(std::format("sound/{}", asset->m_name));
if (!assetFile)
return;
auto& stream = *assetFile;
switch (static_cast<WavFormat>(loadedSound->sound.info.format))
{
case WavFormat::PCM:
DumpWavPcm(loadedSound, stream);
break;
default:
std::cerr << std::format("Unknown format {} for loaded sound: {}\n", loadedSound->sound.info.format, loadedSound->name);
break;
}
}
} // namespace IW5::sound

View File

@@ -3,14 +3,12 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW5/IW5.h"
namespace IW5
namespace IW5::sound
{
class AssetDumperLoadedSound final : public AbstractAssetDumper<LoadedSound>
class LoadedSoundDumper final : public AbstractAssetDumper<LoadedSound>
{
static void DumpWavPcm(const LoadedSound* asset, std::ostream& stream);
protected:
bool ShouldDump(XAssetInfo<LoadedSound>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset) override;
};
} // namespace IW5
} // namespace IW5::sound

View File

@@ -7,7 +7,6 @@
#include "Localize/LocalizeDumperT5.h"
#include "ObjWriting.h"
#include "RawFile/RawFileDumperT5.h"
#include "Sound/AssetDumperSndBank.h"
#include "StringTable/StringTableDumperT5.h"
#include "Weapon/AssetDumperWeapon.h"

View File

@@ -15,8 +15,8 @@
#include "RawFile/RawFileDumperT6.h"
#include "Script/ScriptDumperT6.h"
#include "Slug/SlugDumperT6.h"
#include "Sound/AssetDumperSndBank.h"
#include "Sound/AssetDumperSndDriverGlobals.h"
#include "Sound/SndBankDumperT6.h"
#include "Sound/SndDriverGlobalsDumperT6.h"
#include "StringTable/StringTableDumperT6.h"
#include "Techset/TechsetDumperT6.h"
#include "Tracer/TracerDumperT6.h"
@@ -54,7 +54,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
DUMP_ASSET_POOL(material::JsonDumper, m_material, ASSET_TYPE_MATERIAL)
DUMP_ASSET_POOL(techset::Dumper, m_technique_set, ASSET_TYPE_TECHNIQUE_SET)
DUMP_ASSET_POOL(image::Dumper, m_image, ASSET_TYPE_IMAGE)
DUMP_ASSET_POOL(AssetDumperSndBank, m_sound_bank, ASSET_TYPE_SOUND)
DUMP_ASSET_POOL(sound::SndBankDumper, m_sound_bank, ASSET_TYPE_SOUND)
// DUMP_ASSET_POOL(AssetDumperSndPatch, m_sound_patch, ASSET_TYPE_SOUND_PATCH)
// DUMP_ASSET_POOL(AssetDumperClipMap, m_clip_map, ASSET_TYPE_CLIPMAP_PVS)
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
@@ -72,7 +72,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
DUMP_ASSET_POOL(AssetDumperWeaponAttachment, m_attachment, ASSET_TYPE_ATTACHMENT)
DUMP_ASSET_POOL(AssetDumperWeaponAttachmentUnique, m_attachment_unique, ASSET_TYPE_ATTACHMENT_UNIQUE)
DUMP_ASSET_POOL(AssetDumperWeaponCamo, m_camo, ASSET_TYPE_WEAPON_CAMO)
DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS)
DUMP_ASSET_POOL(sound::SndDriverGlobalsDumper, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS)
// DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX)
// DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table, ASSET_TYPE_IMPACT_FX)
DUMP_ASSET_POOL(raw_file::Dumper, m_raw_file, ASSET_TYPE_RAWFILE)

View File

@@ -1,385 +0,0 @@
#include "AssetDumperSndDriverGlobals.h"
#include "Csv/CsvStream.h"
#include "ObjContainer/SoundBank/SoundBank.h"
using namespace T6;
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_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",
};
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",
};
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",
};
std::unique_ptr<std::ostream> OpenAssetFile(const std::string& filename)
{
auto outputFile = this->m_context.OpenAssetFile(filename);
if (outputFile == nullptr)
{
std::cout << "Failed to open sound driver globals output file for: \"" << filename << "\"\n";
}
return outputFile;
}
static void WriteFileHeader(CsvOutputStream& stream, const std::string* headers, size_t count)
{
for (auto i = 0u; i < count; i++)
{
stream.WriteColumn(headers[i]);
}
stream.NextRow();
}
void DumpSndVolumesGroups(const SndVolumeGroup* groups, const size_t count)
{
const auto outputFile = this->OpenAssetFile("soundbank/globals/group.csv");
if (outputFile != nullptr)
{
CsvOutputStream csvStream(*outputFile);
WriteFileHeader(csvStream, GROUPS_HEADERS, std::extent_v<decltype(GROUPS_HEADERS)>);
for (auto i = 0u; i < count; i++)
{
const auto& group = groups[i];
csvStream.WriteColumn(group.name);
csvStream.WriteColumn(std::to_string(group.attenuationSp));
csvStream.WriteColumn(std::to_string(group.attenuationMp));
csvStream.WriteColumn(GROUPS_CATEGORIES[group.category]);
csvStream.WriteColumn(group.parentName);
csvStream.WriteColumn(std::to_string(group.id));
csvStream.NextRow();
}
}
}
void DumpSndCurves(const SndCurve* curves, const size_t count)
{
const auto outputFile = this->OpenAssetFile("soundbank/globals/curves.csv");
if (outputFile != nullptr)
{
CsvOutputStream csvStream(*outputFile);
WriteFileHeader(csvStream, CURVE_HEADERS, std::extent_v<decltype(CURVE_HEADERS)>);
for (auto i = 0u; i < count; i++)
{
const auto& curve = curves[i];
csvStream.WriteColumn(curve.name);
for (auto j = 0u; j < 8; j++)
{
csvStream.WriteColumn(std::to_string(curve.points[j].x));
csvStream.WriteColumn(std::to_string(curve.points[j].y));
}
csvStream.WriteColumn(std::to_string(curve.id));
csvStream.NextRow();
}
}
}
void DumpSndPans(const SndPan* pans, const size_t count)
{
const auto outputFile = this->OpenAssetFile("soundbank/globals/pan.csv");
if (outputFile != nullptr)
{
CsvOutputStream csvStream(*outputFile);
WriteFileHeader(csvStream, PAN_HEADERS, std::extent_v<decltype(PAN_HEADERS)>);
for (auto i = 0u; i < count; i++)
{
const auto& pan = pans[i];
csvStream.WriteColumn(pan.name);
csvStream.WriteColumn(std::to_string(pan.front));
csvStream.WriteColumn(std::to_string(pan.back));
csvStream.WriteColumn(std::to_string(pan.center));
csvStream.WriteColumn(std::to_string(pan.lfe));
csvStream.WriteColumn(std::to_string(pan.left));
csvStream.WriteColumn(std::to_string(pan.right));
csvStream.WriteColumn(std::to_string(pan.id));
csvStream.NextRow();
}
}
}
void DumpSndDuckGroups(const SndDuckGroup* duckGroups, const size_t count)
{
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++)
{
const auto& duckGroup = duckGroups[i];
csvStream.WriteColumn(duckGroup.name);
csvStream.WriteColumn(std::to_string(duckGroup.id));
csvStream.NextRow();
}
}
}
void DumpSndMasters(const SndMaster* masters, const size_t count)
{
const auto outputFile = this->OpenAssetFile("soundbank/globals/master.csv");
if (outputFile != nullptr)
{
CsvOutputStream csvStream(*outputFile);
WriteFileHeader(csvStream, MASTER_HEADERS, std::extent_v<decltype(MASTER_HEADERS)>);
for (auto i = 0u; i < count; i++)
{
const auto& master = masters[i];
csvStream.WriteColumn(master.name);
csvStream.WriteColumn(std::to_string(master.lowE));
csvStream.WriteColumn(std::to_string(master.lowG));
csvStream.WriteColumn(std::to_string(master.lowF));
csvStream.WriteColumn(std::to_string(master.lowQ));
csvStream.WriteColumn(std::to_string(master.peak1E));
csvStream.WriteColumn(std::to_string(master.peak1G));
csvStream.WriteColumn(std::to_string(master.peak1F));
csvStream.WriteColumn(std::to_string(master.peak1Q));
csvStream.WriteColumn(std::to_string(master.peak2E));
csvStream.WriteColumn(std::to_string(master.peak2G));
csvStream.WriteColumn(std::to_string(master.peak2F));
csvStream.WriteColumn(std::to_string(master.peak2Q));
csvStream.WriteColumn(std::to_string(master.hiE));
csvStream.WriteColumn(std::to_string(master.hiG));
csvStream.WriteColumn(std::to_string(master.hiF));
csvStream.WriteColumn(std::to_string(master.hiQ));
csvStream.WriteColumn(std::to_string(master.eqG));
csvStream.WriteColumn(std::to_string(master.compE));
csvStream.WriteColumn(std::to_string(master.compPG));
csvStream.WriteColumn(std::to_string(master.compMG));
csvStream.WriteColumn(std::to_string(master.compT));
csvStream.WriteColumn(std::to_string(master.compR));
csvStream.WriteColumn(std::to_string(master.compTA));
csvStream.WriteColumn(std::to_string(master.compTR));
csvStream.WriteColumn(std::to_string(master.limitE));
csvStream.WriteColumn(std::to_string(master.limitPG));
csvStream.WriteColumn(std::to_string(master.limitMG));
csvStream.WriteColumn(std::to_string(master.limitT));
csvStream.WriteColumn(std::to_string(master.limitR));
csvStream.WriteColumn(std::to_string(master.limitTA));
csvStream.WriteColumn(std::to_string(master.limitTR));
csvStream.WriteColumn(std::to_string(master.busReverbG));
csvStream.WriteColumn(std::to_string(master.busFxG));
csvStream.WriteColumn(std::to_string(master.busVoiceG));
csvStream.WriteColumn(std::to_string(master.busPfutzG));
csvStream.WriteColumn(std::to_string(master.busHdrfxG));
csvStream.WriteColumn(std::to_string(master.busUiG));
csvStream.WriteColumn(std::to_string(master.busMusicG));
csvStream.WriteColumn(std::to_string(master.busMovieG));
csvStream.WriteColumn(std::to_string(master.busVcsG));
csvStream.WriteColumn(std::to_string(master.busReverbE));
csvStream.WriteColumn(std::to_string(master.busFxE));
csvStream.WriteColumn(std::to_string(master.busVoiceE));
csvStream.WriteColumn(std::to_string(master.busPfutzE));
csvStream.WriteColumn(std::to_string(master.busHdrfxE));
csvStream.WriteColumn(std::to_string(master.busUiE));
csvStream.WriteColumn(std::to_string(master.busMusicE));
csvStream.WriteColumn(std::to_string(master.busMovieE));
csvStream.WriteColumn(std::to_string(master.hdrfxCompE));
csvStream.WriteColumn(std::to_string(master.voiceEqE));
csvStream.WriteColumn(std::to_string(master.voiceCompE));
csvStream.WriteColumn(std::to_string(master.id));
csvStream.NextRow();
}
}
}
void DumpSndSidechainDucks(const SndSidechainDuck* sidechains, const size_t count)
{
const auto outputFile = this->OpenAssetFile("soundbank/globals/sidechain_duck.csv");
if (outputFile != nullptr)
{
CsvOutputStream csvStream(*outputFile);
WriteFileHeader(csvStream, SIDECHAIN_HEADERS, std::extent_v<decltype(SIDECHAIN_HEADERS)>);
for (auto i = 0u; i < count; i++)
{
const auto& sidechain = sidechains[i];
csvStream.WriteColumn(sidechain.name);
csvStream.WriteColumn(std::to_string(sidechain.g));
csvStream.WriteColumn(std::to_string(sidechain.f));
csvStream.WriteColumn(std::to_string(sidechain.q));
csvStream.WriteColumn(std::to_string(sidechain.ta));
csvStream.WriteColumn(std::to_string(sidechain.tr));
csvStream.WriteColumn(std::to_string(sidechain.tf));
csvStream.WriteColumn(std::to_string(sidechain.id));
csvStream.NextRow();
}
}
}
void DumpSndFutz(const SndFutz* futzes, const size_t count)
{
const auto outputFile = this->OpenAssetFile("soundbank/globals/futz.csv");
if (outputFile != nullptr)
{
CsvOutputStream csvStream(*outputFile);
WriteFileHeader(csvStream, FUTZ_HEADERS, std::extent_v<decltype(FUTZ_HEADERS)>);
for (auto i = 0u; i < count; i++)
{
const auto& futz = futzes[i];
csvStream.WriteColumn(futz.name);
csvStream.WriteColumn(std::to_string(futz.bpfF));
csvStream.WriteColumn(std::to_string(futz.bpfQ));
csvStream.WriteColumn(std::to_string(futz.lsG));
csvStream.WriteColumn(std::to_string(futz.lsF));
csvStream.WriteColumn(std::to_string(futz.lsQ));
csvStream.WriteColumn(std::to_string(futz.dist));
csvStream.WriteColumn(std::to_string(futz.preG));
csvStream.WriteColumn(std::to_string(futz.postG));
csvStream.WriteColumn(std::to_string(futz.th));
csvStream.WriteColumn(std::to_string(futz.tg));
csvStream.WriteColumn(std::to_string(futz.clippre));
csvStream.WriteColumn(std::to_string(futz.clippost));
csvStream.WriteColumn(std::to_string(futz.blend));
csvStream.WriteColumn(std::to_string(futz.startAliasId));
csvStream.WriteColumn(std::to_string(futz.stopAliasId));
csvStream.WriteColumn(std::to_string(futz.loopAliasId));
csvStream.WriteColumn(std::to_string(futz.id));
csvStream.NextRow();
}
}
}
void DumpSndDriverGlobals(const XAssetInfo<SndDriverGlobals>* sndDriverGlobalsInfo)
{
const auto* sndDriverGlobals = sndDriverGlobalsInfo->Asset();
DumpSndVolumesGroups(sndDriverGlobals->groups, sndDriverGlobals->groupCount);
DumpSndCurves(sndDriverGlobals->curves, sndDriverGlobals->curveCount);
DumpSndPans(sndDriverGlobals->pans, sndDriverGlobals->panCount);
DumpSndDuckGroups(sndDriverGlobals->duckGroups, sndDriverGlobals->duckGroupCount);
// DumpSndContexts(sndDriverGlobals->contexts, sndDriverGlobals->contextCount);
DumpSndMasters(sndDriverGlobals->masters, sndDriverGlobals->masterCount);
DumpSndSidechainDucks(sndDriverGlobals->voiceDucks, sndDriverGlobals->voiceDuckCount);
DumpSndFutz(sndDriverGlobals->futzes, sndDriverGlobals->futzCount);
}
public:
explicit Internal(AssetDumpingContext& context)
: m_context(context)
{
}
void DumpPool(AssetPool<SndDriverGlobals>* pool)
{
for (const auto* assetInfo : *pool)
{
if (!assetInfo->m_name.empty() && assetInfo->m_name[0] == ',')
continue;
DumpSndDriverGlobals(assetInfo);
}
}
};
void AssetDumperSndDriverGlobals::DumpPool(AssetDumpingContext& context, AssetPool<SndDriverGlobals>* pool)
{
Internal internal(context);
internal.DumpPool(pool);
}

View File

@@ -1,4 +1,4 @@
#include "AssetDumperSndBank.h"
#include "SndBankDumperT6.h"
#include "Csv/CsvStream.h"
#include "Game/T6/CommonT6.h"
@@ -910,15 +910,18 @@ namespace
}
} // namespace
void AssetDumperSndBank::DumpPool(AssetDumpingContext& context, AssetPool<SndBank>* pool)
namespace T6::sound
{
LoadedSoundBankHashes soundBankHashes;
soundBankHashes.Initialize();
for (const auto* assetInfo : *pool)
void SndBankDumper::DumpPool(AssetDumpingContext& context, AssetPool<SndBank>* pool)
{
if (!assetInfo->m_name.empty() && assetInfo->m_name[0] == ',')
continue;
LoadedSoundBankHashes soundBankHashes;
soundBankHashes.Initialize();
for (const auto* assetInfo : *pool)
{
if (!assetInfo->m_name.empty() && assetInfo->m_name[0] == ',')
continue;
DumpSndBank(context, soundBankHashes, *assetInfo);
DumpSndBank(context, soundBankHashes, *assetInfo);
}
}
}
} // namespace T6::sound

View File

@@ -3,13 +3,11 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
namespace T6
namespace T6::sound
{
class AssetDumperSndBank final : public IAssetDumper<SndBank>
class SndBankDumper final : public IAssetDumper<SndBank>
{
class Internal;
public:
void DumpPool(AssetDumpingContext& context, AssetPool<SndBank>* pool) override;
};
} // namespace T6
} // namespace T6::sound

View File

@@ -0,0 +1,392 @@
#include "SndDriverGlobalsDumperT6.h"
#include "Csv/CsvStream.h"
#include "ObjContainer/SoundBank/SoundBank.h"
#include <format>
using namespace T6;
namespace
{
const std::string GROUPS_HEADERS[]{
"name",
"attenuationSp",
"attenuationMp",
"category",
"parent",
"id",
};
const std::string GROUPS_CATEGORIES[]{
"sfx",
"music",
"void",
"ui",
"cinematic",
"id",
};
const std::string CURVE_HEADERS[]{
"name",
"x0",
"y0",
"x1",
"y1",
"x2",
"y2",
"x3",
"y3",
"x4",
"y4",
"x5",
"y5",
"x6",
"y6",
"x7",
"y7",
"id",
};
const std::string PAN_HEADERS[]{
"name",
"front",
"back",
"center",
"lfe",
"left",
"right",
"id",
};
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",
};
const std::string SIDECHAIN_HEADERS[]{
"name",
"g",
"f",
"q",
"ta",
"tr",
"tf",
"id",
};
const std::string FUTZ_HEADERS[]{
"name",
"bpfF",
"bpfQ",
"lsG",
"lsF",
"lsQ",
"dist",
"preG",
"postG",
"th",
"tg",
"clippre",
"clippost",
"blend",
"startAliasId",
"stopAliasId",
"loopAliasId",
"id",
};
class Internal
{
public:
explicit Internal(AssetDumpingContext& context)
: m_context(context)
{
}
void DumpPool(AssetPool<SndDriverGlobals>* pool)
{
for (const auto* assetInfo : *pool)
{
if (!assetInfo->m_name.empty() && assetInfo->m_name[0] == ',')
continue;
DumpSndDriverGlobals(assetInfo);
}
}
private:
std::unique_ptr<std::ostream> OpenAssetFile(const std::string& filename)
{
auto outputFile = this->m_context.OpenAssetFile(filename);
if (outputFile == nullptr)
std::cerr << std::format("Failed to open sound driver globals output file for: \"{}\"\n", filename);
return outputFile;
}
static void WriteFileHeader(CsvOutputStream& stream, const std::string* headers, size_t count)
{
for (auto i = 0u; i < count; i++)
{
stream.WriteColumn(headers[i]);
}
stream.NextRow();
}
void DumpSndVolumesGroups(const SndVolumeGroup* groups, const size_t count)
{
const auto outputFile = this->OpenAssetFile("soundbank/globals/group.csv");
if (outputFile != nullptr)
{
CsvOutputStream csvStream(*outputFile);
WriteFileHeader(csvStream, GROUPS_HEADERS, std::extent_v<decltype(GROUPS_HEADERS)>);
for (auto i = 0u; i < count; i++)
{
const auto& group = groups[i];
csvStream.WriteColumn(group.name);
csvStream.WriteColumn(std::to_string(group.attenuationSp));
csvStream.WriteColumn(std::to_string(group.attenuationMp));
csvStream.WriteColumn(GROUPS_CATEGORIES[group.category]);
csvStream.WriteColumn(group.parentName);
csvStream.WriteColumn(std::to_string(group.id));
csvStream.NextRow();
}
}
}
void DumpSndCurves(const SndCurve* curves, const size_t count)
{
const auto outputFile = this->OpenAssetFile("soundbank/globals/curves.csv");
if (outputFile != nullptr)
{
CsvOutputStream csvStream(*outputFile);
WriteFileHeader(csvStream, CURVE_HEADERS, std::extent_v<decltype(CURVE_HEADERS)>);
for (auto i = 0u; i < count; i++)
{
const auto& curve = curves[i];
csvStream.WriteColumn(curve.name);
for (auto j = 0u; j < 8; j++)
{
csvStream.WriteColumn(std::to_string(curve.points[j].x));
csvStream.WriteColumn(std::to_string(curve.points[j].y));
}
csvStream.WriteColumn(std::to_string(curve.id));
csvStream.NextRow();
}
}
}
void DumpSndPans(const SndPan* pans, const size_t count)
{
const auto outputFile = this->OpenAssetFile("soundbank/globals/pan.csv");
if (outputFile != nullptr)
{
CsvOutputStream csvStream(*outputFile);
WriteFileHeader(csvStream, PAN_HEADERS, std::extent_v<decltype(PAN_HEADERS)>);
for (auto i = 0u; i < count; i++)
{
const auto& pan = pans[i];
csvStream.WriteColumn(pan.name);
csvStream.WriteColumn(std::to_string(pan.front));
csvStream.WriteColumn(std::to_string(pan.back));
csvStream.WriteColumn(std::to_string(pan.center));
csvStream.WriteColumn(std::to_string(pan.lfe));
csvStream.WriteColumn(std::to_string(pan.left));
csvStream.WriteColumn(std::to_string(pan.right));
csvStream.WriteColumn(std::to_string(pan.id));
csvStream.NextRow();
}
}
}
void DumpSndDuckGroups(const SndDuckGroup* duckGroups, const size_t count)
{
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++)
{
const auto& duckGroup = duckGroups[i];
csvStream.WriteColumn(duckGroup.name);
csvStream.WriteColumn(std::to_string(duckGroup.id));
csvStream.NextRow();
}
}
}
void DumpSndMasters(const SndMaster* masters, const size_t count)
{
const auto outputFile = this->OpenAssetFile("soundbank/globals/master.csv");
if (outputFile != nullptr)
{
CsvOutputStream csvStream(*outputFile);
WriteFileHeader(csvStream, MASTER_HEADERS, std::extent_v<decltype(MASTER_HEADERS)>);
for (auto i = 0u; i < count; i++)
{
const auto& master = masters[i];
csvStream.WriteColumn(master.name);
csvStream.WriteColumn(std::to_string(master.lowE));
csvStream.WriteColumn(std::to_string(master.lowG));
csvStream.WriteColumn(std::to_string(master.lowF));
csvStream.WriteColumn(std::to_string(master.lowQ));
csvStream.WriteColumn(std::to_string(master.peak1E));
csvStream.WriteColumn(std::to_string(master.peak1G));
csvStream.WriteColumn(std::to_string(master.peak1F));
csvStream.WriteColumn(std::to_string(master.peak1Q));
csvStream.WriteColumn(std::to_string(master.peak2E));
csvStream.WriteColumn(std::to_string(master.peak2G));
csvStream.WriteColumn(std::to_string(master.peak2F));
csvStream.WriteColumn(std::to_string(master.peak2Q));
csvStream.WriteColumn(std::to_string(master.hiE));
csvStream.WriteColumn(std::to_string(master.hiG));
csvStream.WriteColumn(std::to_string(master.hiF));
csvStream.WriteColumn(std::to_string(master.hiQ));
csvStream.WriteColumn(std::to_string(master.eqG));
csvStream.WriteColumn(std::to_string(master.compE));
csvStream.WriteColumn(std::to_string(master.compPG));
csvStream.WriteColumn(std::to_string(master.compMG));
csvStream.WriteColumn(std::to_string(master.compT));
csvStream.WriteColumn(std::to_string(master.compR));
csvStream.WriteColumn(std::to_string(master.compTA));
csvStream.WriteColumn(std::to_string(master.compTR));
csvStream.WriteColumn(std::to_string(master.limitE));
csvStream.WriteColumn(std::to_string(master.limitPG));
csvStream.WriteColumn(std::to_string(master.limitMG));
csvStream.WriteColumn(std::to_string(master.limitT));
csvStream.WriteColumn(std::to_string(master.limitR));
csvStream.WriteColumn(std::to_string(master.limitTA));
csvStream.WriteColumn(std::to_string(master.limitTR));
csvStream.WriteColumn(std::to_string(master.busReverbG));
csvStream.WriteColumn(std::to_string(master.busFxG));
csvStream.WriteColumn(std::to_string(master.busVoiceG));
csvStream.WriteColumn(std::to_string(master.busPfutzG));
csvStream.WriteColumn(std::to_string(master.busHdrfxG));
csvStream.WriteColumn(std::to_string(master.busUiG));
csvStream.WriteColumn(std::to_string(master.busMusicG));
csvStream.WriteColumn(std::to_string(master.busMovieG));
csvStream.WriteColumn(std::to_string(master.busVcsG));
csvStream.WriteColumn(std::to_string(master.busReverbE));
csvStream.WriteColumn(std::to_string(master.busFxE));
csvStream.WriteColumn(std::to_string(master.busVoiceE));
csvStream.WriteColumn(std::to_string(master.busPfutzE));
csvStream.WriteColumn(std::to_string(master.busHdrfxE));
csvStream.WriteColumn(std::to_string(master.busUiE));
csvStream.WriteColumn(std::to_string(master.busMusicE));
csvStream.WriteColumn(std::to_string(master.busMovieE));
csvStream.WriteColumn(std::to_string(master.hdrfxCompE));
csvStream.WriteColumn(std::to_string(master.voiceEqE));
csvStream.WriteColumn(std::to_string(master.voiceCompE));
csvStream.WriteColumn(std::to_string(master.id));
csvStream.NextRow();
}
}
}
void DumpSndSidechainDucks(const SndSidechainDuck* sidechains, const size_t count)
{
const auto outputFile = this->OpenAssetFile("soundbank/globals/sidechain_duck.csv");
if (outputFile != nullptr)
{
CsvOutputStream csvStream(*outputFile);
WriteFileHeader(csvStream, SIDECHAIN_HEADERS, std::extent_v<decltype(SIDECHAIN_HEADERS)>);
for (auto i = 0u; i < count; i++)
{
const auto& sidechain = sidechains[i];
csvStream.WriteColumn(sidechain.name);
csvStream.WriteColumn(std::to_string(sidechain.g));
csvStream.WriteColumn(std::to_string(sidechain.f));
csvStream.WriteColumn(std::to_string(sidechain.q));
csvStream.WriteColumn(std::to_string(sidechain.ta));
csvStream.WriteColumn(std::to_string(sidechain.tr));
csvStream.WriteColumn(std::to_string(sidechain.tf));
csvStream.WriteColumn(std::to_string(sidechain.id));
csvStream.NextRow();
}
}
}
void DumpSndFutz(const SndFutz* futzes, const size_t count)
{
const auto outputFile = this->OpenAssetFile("soundbank/globals/futz.csv");
if (outputFile != nullptr)
{
CsvOutputStream csvStream(*outputFile);
WriteFileHeader(csvStream, FUTZ_HEADERS, std::extent_v<decltype(FUTZ_HEADERS)>);
for (auto i = 0u; i < count; i++)
{
const auto& futz = futzes[i];
csvStream.WriteColumn(futz.name);
csvStream.WriteColumn(std::to_string(futz.bpfF));
csvStream.WriteColumn(std::to_string(futz.bpfQ));
csvStream.WriteColumn(std::to_string(futz.lsG));
csvStream.WriteColumn(std::to_string(futz.lsF));
csvStream.WriteColumn(std::to_string(futz.lsQ));
csvStream.WriteColumn(std::to_string(futz.dist));
csvStream.WriteColumn(std::to_string(futz.preG));
csvStream.WriteColumn(std::to_string(futz.postG));
csvStream.WriteColumn(std::to_string(futz.th));
csvStream.WriteColumn(std::to_string(futz.tg));
csvStream.WriteColumn(std::to_string(futz.clippre));
csvStream.WriteColumn(std::to_string(futz.clippost));
csvStream.WriteColumn(std::to_string(futz.blend));
csvStream.WriteColumn(std::to_string(futz.startAliasId));
csvStream.WriteColumn(std::to_string(futz.stopAliasId));
csvStream.WriteColumn(std::to_string(futz.loopAliasId));
csvStream.WriteColumn(std::to_string(futz.id));
csvStream.NextRow();
}
}
}
void DumpSndDriverGlobals(const XAssetInfo<SndDriverGlobals>* sndDriverGlobalsInfo)
{
const auto* sndDriverGlobals = sndDriverGlobalsInfo->Asset();
DumpSndVolumesGroups(sndDriverGlobals->groups, sndDriverGlobals->groupCount);
DumpSndCurves(sndDriverGlobals->curves, sndDriverGlobals->curveCount);
DumpSndPans(sndDriverGlobals->pans, sndDriverGlobals->panCount);
DumpSndDuckGroups(sndDriverGlobals->duckGroups, sndDriverGlobals->duckGroupCount);
// DumpSndContexts(sndDriverGlobals->contexts, sndDriverGlobals->contextCount);
DumpSndMasters(sndDriverGlobals->masters, sndDriverGlobals->masterCount);
DumpSndSidechainDucks(sndDriverGlobals->voiceDucks, sndDriverGlobals->voiceDuckCount);
DumpSndFutz(sndDriverGlobals->futzes, sndDriverGlobals->futzCount);
}
AssetDumpingContext& m_context;
};
} // namespace
namespace T6::sound
{
void SndDriverGlobalsDumper::DumpPool(AssetDumpingContext& context, AssetPool<SndDriverGlobals>* pool)
{
Internal internal(context);
internal.DumpPool(pool);
}
} // namespace T6::sound

View File

@@ -3,13 +3,11 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
namespace T6
namespace T6::sound
{
class AssetDumperSndDriverGlobals final : public IAssetDumper<SndDriverGlobals>
class SndDriverGlobalsDumper final : public IAssetDumper<SndDriverGlobals>
{
class Internal;
public:
void DumpPool(AssetDumpingContext& context, AssetPool<SndDriverGlobals>* pool) override;
};
} // namespace T6
} // namespace T6::sound