Files
jak-project/game/sound/989snd/musicbank.cpp
Hat Kid 8a73c3e997 989snd/overlord: implement PLUGIN_MESSAGE grain and STRV plugin system (#4319)
This implements the functionality for the `PLUGIN_MESSAGE` grain and the
989snd VAG plugin system, allowing sounds to queue up VAG streams.

Closes #2582
2026-06-30 21:21:34 +02:00

54 lines
2.0 KiB
C++

#include "musicbank.h"
#include "ame_handler.h"
#include "midi_handler.h"
#include "common/log/log.h"
namespace snd {
std::optional<std::unique_ptr<SoundHandler>> MusicBank::MakeHandler(VoiceManager& vm,
u32 sound_id,
s32 vol,
s32 pan,
s32 pm,
s32 pb,
s32 tick,
u32 owner) {
auto& sound = Sounds[sound_id];
// FIXME: global midi list
// search only local bank for now
// (always the case in jak games anyway)
if (sound.Type == 4) {
auto& midi = std::get<Midi>(MidiData);
if (sound.MIDIID == midi.ID) {
return std::make_unique<MidiHandler>(&midi, vm, sound, vol, pan, *this);
}
return std::nullopt;
} else if (sound.Type == 5) {
auto& midi = std::get<MultiMidi>(MidiData);
if (sound.MIDIID == midi.ID) {
return std::make_unique<AmeHandler>(&midi, vm, sound, vol, pan, *this);
}
return std::nullopt;
} else {
lg::error("Invalid music sound type");
return std::nullopt;
// error
}
}
std::optional<std::unique_ptr<SoundHandler>> MusicBank::MakeHandler(VoiceManager& vm,
u32 sound_id,
s32 vol,
s32 pan,
SndPlayParams& params,
s32 tick,
u32 owner) {
return std::nullopt;
}
} // namespace snd