mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 15:28:11 -05:00
chore: restructure sound curve loader to load generic 2D graphs instead
This commit is contained in:
23
src/ObjLoading/Sound/SoundCurveLoader.cpp
Normal file
23
src/ObjLoading/Sound/SoundCurveLoader.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include "SoundCurveLoader.h"
|
||||
|
||||
#include "Parsing/Graph2D/Graph2DReader.h"
|
||||
|
||||
#include <format>
|
||||
#include <iostream>
|
||||
|
||||
namespace sound_curve
|
||||
{
|
||||
std::unique_ptr<GenericGraph2D> LoadSoundCurve(const IAssetLoadingManager* manager, const std::string& soundCurveName)
|
||||
{
|
||||
auto* searchPath = manager->GetAssetLoadingContext()->m_raw_search_path;
|
||||
const auto fileName = std::format("soundaliases/{}.vfcurve", soundCurveName);
|
||||
const auto file = searchPath->Open(fileName);
|
||||
if (!file.IsOpen())
|
||||
{
|
||||
std::cerr << std::format("Failed to open file for sound curve \"{}\"\n", soundCurveName);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return graph2d::Read("sound curve", "SNDCURVE", *file.m_stream, fileName, soundCurveName);
|
||||
}
|
||||
} // namespace sound_curve
|
11
src/ObjLoading/Sound/SoundCurveLoader.h
Normal file
11
src/ObjLoading/Sound/SoundCurveLoader.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "AssetLoading/IAssetLoadingManager.h"
|
||||
#include "Parsing/GenericGraph2D.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace sound_curve
|
||||
{
|
||||
std::unique_ptr<GenericGraph2D> LoadSoundCurve(const IAssetLoadingManager* manager, const std::string& soundCurveName);
|
||||
}
|
Reference in New Issue
Block a user