mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -04:00
e81431bd21
Some checks are pending
Build / 🖥️ Windows (push) Waiting to run
Build / 🐧 Linux (push) Waiting to run
Build / 🍎 MacOS (push) Waiting to run
Inform Pages Repo / Generate Documentation (push) Waiting to run
Lint / 📝 Required Checks (push) Waiting to run
Lint / 📝 Optional Checks (push) Waiting to run
Lint / 📝 Formatting (push) Waiting to run
35 lines
948 B
C++
35 lines
948 B
C++
#include "sfxblock.h"
|
|
|
|
#include "blocksound_handler.h"
|
|
#include "sfxgrain.h"
|
|
|
|
#include "common/log/log.h"
|
|
|
|
namespace snd {
|
|
|
|
std::optional<std::unique_ptr<SoundHandler>> SFXBlock::MakeHandler(VoiceManager& vm,
|
|
u32 sound_id,
|
|
s32 vol,
|
|
s32 pan,
|
|
SndPlayParams& params) {
|
|
auto& SFX = Sounds[sound_id];
|
|
|
|
if (SFX.Grains.empty()) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
auto handler = std::make_unique<BlockSoundHandler>(*this, SFX, vm, vol, pan, params, sound_id);
|
|
return handler;
|
|
}
|
|
|
|
std::optional<u32> SFXBlock::GetSoundByName(const char* name) {
|
|
auto sound = Names.find(name);
|
|
if (sound != Names.end()) {
|
|
return sound->second;
|
|
}
|
|
|
|
return std::nullopt;
|
|
}
|
|
|
|
} // namespace snd
|