mirror of https://github.com/AxioDL/metaforce.git
Remove amuse, and compile fixes
This commit is contained in:
parent
e9cfa6aff4
commit
137e4c19a3
|
@ -2,10 +2,6 @@
|
|||
path = extern/nod
|
||||
url = ../nod.git
|
||||
branch = master
|
||||
[submodule "extern/amuse"]
|
||||
path = extern/amuse
|
||||
url = ../amuse.git
|
||||
branch = master
|
||||
[submodule "extern/kabufuda"]
|
||||
path = extern/kabufuda
|
||||
url = ../kabufuda.git
|
||||
|
|
|
@ -287,8 +287,8 @@ void CNESEmulator::InitializeEmulator() {
|
|||
|
||||
// double useFreq = 223740;
|
||||
double useFreq = apuGetFrequency();
|
||||
m_booVoice = CAudioSys::GetVoiceEngine()->allocateNewStereoVoice(useFreq, this);
|
||||
m_booVoice->start();
|
||||
//m_booVoice = CAudioSys::GetVoiceEngine()->allocateNewStereoVoice(useFreq, this);
|
||||
//m_booVoice->start();
|
||||
uint32_t apuBufSz = apuGetMaxBufSize();
|
||||
m_audioBufBlock.reset(new u8[apuBufSz * NUM_AUDIO_BUFFERS]);
|
||||
memset(m_audioBufBlock.get(), 0, apuBufSz * NUM_AUDIO_BUFFERS);
|
||||
|
@ -301,8 +301,8 @@ void CNESEmulator::InitializeEmulator() {
|
|||
void CNESEmulator::DeinitializeEmulator() {
|
||||
// printf("\n");
|
||||
emuRenderFrame = false;
|
||||
m_booVoice->stop();
|
||||
m_booVoice.reset();
|
||||
//m_booVoice->stop();
|
||||
//m_booVoice.reset();
|
||||
apuDeinitBufs();
|
||||
if (emuNesROM != NULL) {
|
||||
if (!nesEmuNSFPlayback && (audioExpansion & EXP_FDS)) {
|
||||
|
@ -345,63 +345,63 @@ CNESEmulator::~CNESEmulator() {
|
|||
}
|
||||
|
||||
int CNESEmulator::audioUpdate() {
|
||||
int origProcBufs = m_procBufs;
|
||||
|
||||
uint8_t* data = apuGetBuf();
|
||||
if (data != NULL && m_procBufs) {
|
||||
uint32_t apuBufSz = apuGetMaxBufSize();
|
||||
uint32_t remBytes = apuGetBufSize();
|
||||
while (remBytes != 0) {
|
||||
size_t thisBytes = std::min(remBytes, apuBufSz - m_posInHeadBuf);
|
||||
memmove(m_audioBufs[m_headBuf] + m_posInHeadBuf, data, thisBytes);
|
||||
data += thisBytes;
|
||||
m_posInHeadBuf += thisBytes;
|
||||
if (m_posInHeadBuf == apuBufSz) {
|
||||
m_posInHeadBuf = 0;
|
||||
--m_procBufs;
|
||||
++m_headBuf;
|
||||
if (m_headBuf == NUM_AUDIO_BUFFERS)
|
||||
m_headBuf = 0;
|
||||
// printf("PUSH\n");
|
||||
}
|
||||
remBytes -= thisBytes;
|
||||
}
|
||||
}
|
||||
|
||||
// if (!origProcBufs)
|
||||
// printf("OVERRUN\n");
|
||||
|
||||
return origProcBufs;
|
||||
// int origProcBufs = m_procBufs;
|
||||
//
|
||||
// uint8_t* data = apuGetBuf();
|
||||
// if (data != NULL && m_procBufs) {
|
||||
// uint32_t apuBufSz = apuGetMaxBufSize();
|
||||
// uint32_t remBytes = apuGetBufSize();
|
||||
// while (remBytes != 0) {
|
||||
// size_t thisBytes = std::min(remBytes, apuBufSz - m_posInHeadBuf);
|
||||
// memmove(m_audioBufs[m_headBuf] + m_posInHeadBuf, data, thisBytes);
|
||||
// data += thisBytes;
|
||||
// m_posInHeadBuf += thisBytes;
|
||||
// if (m_posInHeadBuf == apuBufSz) {
|
||||
// m_posInHeadBuf = 0;
|
||||
// --m_procBufs;
|
||||
// ++m_headBuf;
|
||||
// if (m_headBuf == NUM_AUDIO_BUFFERS)
|
||||
// m_headBuf = 0;
|
||||
// // printf("PUSH\n");
|
||||
// }
|
||||
// remBytes -= thisBytes;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // if (!origProcBufs)
|
||||
// // printf("OVERRUN\n");
|
||||
//
|
||||
// return origProcBufs;
|
||||
}
|
||||
|
||||
static constexpr uint32_t AudioFrameSz = 2 * sizeof(int16_t);
|
||||
|
||||
size_t CNESEmulator::supplyAudio(boo::IAudioVoice& voice, size_t frames, int16_t* data) {
|
||||
uint32_t remFrames = uint32_t(frames);
|
||||
while (remFrames) {
|
||||
if (m_posInTailBuf == apuGetMaxBufSize()) {
|
||||
++m_tailBuf;
|
||||
if (m_tailBuf == NUM_AUDIO_BUFFERS)
|
||||
m_tailBuf = 0;
|
||||
m_posInTailBuf = 0;
|
||||
++m_procBufs;
|
||||
// printf("POP\n");
|
||||
}
|
||||
|
||||
if (m_procBufs == NUM_AUDIO_BUFFERS) {
|
||||
memset(data, 0, remFrames * AudioFrameSz);
|
||||
// printf("UNDERRUN\n");
|
||||
return frames;
|
||||
}
|
||||
|
||||
size_t copySz = std::min(apuGetMaxBufSize() - m_posInTailBuf, remFrames * AudioFrameSz);
|
||||
memmove(data, m_audioBufs[m_tailBuf] + m_posInTailBuf, copySz);
|
||||
data += copySz / sizeof(int16_t);
|
||||
m_posInTailBuf += copySz;
|
||||
remFrames -= copySz / AudioFrameSz;
|
||||
}
|
||||
return frames;
|
||||
}
|
||||
//size_t CNESEmulator::supplyAudio(boo::IAudioVoice& voice, size_t frames, int16_t* data) {
|
||||
// uint32_t remFrames = uint32_t(frames);
|
||||
// while (remFrames) {
|
||||
// if (m_posInTailBuf == apuGetMaxBufSize()) {
|
||||
// ++m_tailBuf;
|
||||
// if (m_tailBuf == NUM_AUDIO_BUFFERS)
|
||||
// m_tailBuf = 0;
|
||||
// m_posInTailBuf = 0;
|
||||
// ++m_procBufs;
|
||||
// // printf("POP\n");
|
||||
// }
|
||||
//
|
||||
// if (m_procBufs == NUM_AUDIO_BUFFERS) {
|
||||
// memset(data, 0, remFrames * AudioFrameSz);
|
||||
// // printf("UNDERRUN\n");
|
||||
// return frames;
|
||||
// }
|
||||
//
|
||||
// size_t copySz = std::min(apuGetMaxBufSize() - m_posInTailBuf, remFrames * AudioFrameSz);
|
||||
// memmove(data, m_audioBufs[m_tailBuf] + m_posInTailBuf, copySz);
|
||||
// data += copySz / sizeof(int16_t);
|
||||
// m_posInTailBuf += copySz;
|
||||
// remFrames -= copySz / AudioFrameSz;
|
||||
// }
|
||||
// return frames;
|
||||
//}
|
||||
|
||||
void CNESEmulator::NesEmuMainLoop(bool forceDraw) {
|
||||
// int start = GetTickCount();
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "RetroTypes.hpp"
|
||||
#include "zeus/CColor.hpp"
|
||||
//#include "boo/graphicsdev/IGraphicsDataFactory.hpp"
|
||||
#include "boo/audiodev/IAudioVoice.hpp"
|
||||
#include "zeus/CMatrix4f.hpp"
|
||||
#include "Runtime/Graphics/CGraphics.hpp"
|
||||
|
||||
|
@ -15,7 +14,7 @@ namespace MP1 {
|
|||
|
||||
#define NUM_AUDIO_BUFFERS 4
|
||||
|
||||
class CNESEmulator final : public boo::IAudioVoiceCallback {
|
||||
class CNESEmulator final {
|
||||
public:
|
||||
enum class EPasswordEntryState { NotPasswordScreen, NotEntered, Entered };
|
||||
|
||||
|
@ -47,7 +46,7 @@ private:
|
|||
uint32_t m_procBufs = NUM_AUDIO_BUFFERS;
|
||||
uint32_t m_posInHeadBuf = 0;
|
||||
uint32_t m_posInTailBuf = 0;
|
||||
boo::ObjToken<boo::IAudioVoice> m_booVoice;
|
||||
//boo::ObjToken<boo::IAudioVoice> m_booVoice;
|
||||
|
||||
// void* x4_loadBuf;
|
||||
// void* x8_rom;
|
||||
|
@ -82,8 +81,8 @@ public:
|
|||
EPasswordEntryState GetPasswordEntryState() const { return x34_passwordEntryState; }
|
||||
|
||||
int audioUpdate();
|
||||
void preSupplyAudio(boo::IAudioVoice& voice, double dt) {}
|
||||
size_t supplyAudio(boo::IAudioVoice& voice, size_t frames, int16_t* data);
|
||||
//void preSupplyAudio(boo::IAudioVoice& voice, double dt) {}
|
||||
//size_t supplyAudio(boo::IAudioVoice& voice, size_t frames, int16_t* data);
|
||||
};
|
||||
|
||||
} // namespace MP1
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <cstring>
|
||||
|
||||
namespace metaforce {
|
||||
|
||||
/*
|
||||
amuse::AudioGroupData CAudioGroupSet::LoadData() {
|
||||
const auto readU32 = [](const u8* ptr) {
|
||||
uint32_t value;
|
||||
|
@ -30,8 +30,8 @@ amuse::AudioGroupData CAudioGroupSet::LoadData() {
|
|||
|
||||
return {proj, projLen, pool, poolLen, sdir, sdirLen, samp, sampLen, amuse::GCNDataTag{}};
|
||||
}
|
||||
|
||||
CAudioGroupSet::CAudioGroupSet(std::unique_ptr<u8[]>&& in) : m_buffer(std::move(in)), m_data(LoadData()) {}
|
||||
*/
|
||||
CAudioGroupSet::CAudioGroupSet(std::unique_ptr<u8[]>&& in) : m_buffer(std::move(in)) {}
|
||||
|
||||
CFactoryFnReturn FAudioGroupSetDataFactory(const metaforce::SObjectTag& tag, std::unique_ptr<u8[]>&& in, u32 len,
|
||||
const metaforce::CVParamTransfer& vparms, CObjectReference* selfRef) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "Runtime/IObj.hpp"
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
|
||||
#include <amuse/AudioGroupData.hpp>
|
||||
//#include <amuse/AudioGroupData.hpp>
|
||||
|
||||
namespace metaforce {
|
||||
|
||||
|
@ -17,12 +17,12 @@ class CAudioGroupSet {
|
|||
std::unique_ptr<u8[]> m_buffer;
|
||||
std::string x10_baseName;
|
||||
std::string x20_name;
|
||||
amuse::AudioGroupData m_data;
|
||||
amuse::AudioGroupData LoadData();
|
||||
// amuse::AudioGroupData m_data;
|
||||
// amuse::AudioGroupData LoadData();
|
||||
|
||||
public:
|
||||
explicit CAudioGroupSet(std::unique_ptr<u8[]>&& in);
|
||||
const amuse::AudioGroupData& GetAudioGroupData() const { return m_data; }
|
||||
//const amuse::AudioGroupData& GetAudioGroupData() const { return m_data; }
|
||||
std::string_view GetName() const { return x20_name; }
|
||||
};
|
||||
|
||||
|
|
|
@ -69,16 +69,12 @@ void CAudioSys::SysUnloadAudioGroupSet(std::string_view name) {
|
|||
bool CAudioSys::SysIsGroupSetLoaded(std::string_view name) { return FindGroupSet(name).operator bool(); }
|
||||
|
||||
void CAudioSys::SysAddGroupIntoAmuse(std::string_view name) {
|
||||
if (auto set = FindGroupSet(name))
|
||||
AddAudioGroup(set->GetAudioGroupData());
|
||||
}
|
||||
|
||||
void CAudioSys::SysRemoveGroupFromAmuse(std::string_view name) {
|
||||
if (auto set = FindGroupSet(name))
|
||||
RemoveAudioGroup(set->GetAudioGroupData());
|
||||
}
|
||||
|
||||
void CAudioSys::_UpdateVolume() { GetAmuseEngine().setVolume(s_MasterVol * s_SfxVol); }
|
||||
void CAudioSys::_UpdateVolume() { }
|
||||
|
||||
void CAudioSys::SysSetVolume(u8 volume) {
|
||||
s_MasterVol = volume / 127.f;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
#include "Runtime/GCNTypes.hpp"
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
|
||||
#include <amuse/amuse.hpp>
|
||||
#include <boo/audiodev/IAudioVoiceEngine.hpp>
|
||||
//#include <amuse/amuse.hpp>
|
||||
//#include <boo/audiodev/IAudioVoiceEngine.hpp>
|
||||
#include <zeus/CVector3f.hpp>
|
||||
|
||||
namespace metaforce {
|
||||
|
@ -21,8 +21,6 @@ public:
|
|||
|
||||
private:
|
||||
static CAudioSys* g_SharedSys;
|
||||
boo::IAudioVoiceEngine* m_voiceEngine;
|
||||
amuse::Engine m_engine;
|
||||
static void _UpdateVolume();
|
||||
|
||||
public:
|
||||
|
@ -38,16 +36,11 @@ public:
|
|||
bool x28_important; // Can't be allocated over, regardless of priority
|
||||
u8 x29_prio;
|
||||
};
|
||||
CAudioSys(boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend, u8, u8, u8, u8, u32)
|
||||
: m_voiceEngine(voiceEngine), m_engine(backend) {
|
||||
CAudioSys(u8, u8, u8, u8, u32) {
|
||||
g_SharedSys = this;
|
||||
}
|
||||
~CAudioSys() { g_SharedSys = nullptr; }
|
||||
|
||||
static void AddAudioGroup(const amuse::AudioGroupData& data) { g_SharedSys->m_engine.addAudioGroup(data); }
|
||||
static void RemoveAudioGroup(const amuse::AudioGroupData& data) { g_SharedSys->m_engine.removeAudioGroup(data); }
|
||||
static boo::IAudioVoiceEngine* GetVoiceEngine() { return g_SharedSys->m_voiceEngine; }
|
||||
static amuse::Engine& GetAmuseEngine() { return g_SharedSys->m_engine; }
|
||||
static void SetSurroundMode(ESurroundModes mode) {}
|
||||
static TLockedToken<CAudioGroupSet> FindGroupSet(std::string_view name);
|
||||
static std::string_view SysGetGroupSetName(CAssetId id);
|
||||
|
|
|
@ -12,14 +12,14 @@ void CMidiManager::StopAll() {
|
|||
}
|
||||
|
||||
void CMidiManager::Stop(const CMidiHandle& handle, float fadeTime) {
|
||||
handle->GetAudioSysHandle()->stopSong(fadeTime);
|
||||
m_MidiWrappers.erase(handle);
|
||||
// handle->GetAudioSysHandle()->stopSong(fadeTime);
|
||||
// m_MidiWrappers.erase(handle);
|
||||
}
|
||||
|
||||
std::unordered_set<CMidiHandle>::iterator CMidiManager::Stop(std::unordered_set<CMidiHandle>::iterator handle,
|
||||
float fadeTime) {
|
||||
const CMidiHandle& h = *handle;
|
||||
h->GetAudioSysHandle()->stopSong(fadeTime);
|
||||
// const CMidiHandle& h = *handle;
|
||||
// h->GetAudioSysHandle()->stopSong(fadeTime);
|
||||
return m_MidiWrappers.erase(handle);
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,10 @@ CMidiHandle CMidiManager::Play(const CMidiData& data, float fadeTime, bool stopE
|
|||
it = Stop(it, fadeTime);
|
||||
|
||||
CMidiHandle handle = *m_MidiWrappers.insert(std::make_shared<CMidiWrapper>()).first;
|
||||
handle->SetAudioSysHandle(
|
||||
CAudioSys::GetAmuseEngine().seqPlay(data.GetGroupId(), data.GetSetupId(), data.GetArrData()));
|
||||
handle->GetAudioSysHandle()->setVolume(volume, fadeTime);
|
||||
handle->SetSongId(data.GetSetupId());
|
||||
// handle->SetAudioSysHandle(
|
||||
// CAudioSys::GetAmuseEngine().seqPlay(data.GetGroupId(), data.GetSetupId(), data.GetArrData()));
|
||||
// handle->GetAudioSysHandle()->setVolume(volume, fadeTime);
|
||||
// handle->SetSongId(data.GetSetupId());
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,14 @@ public:
|
|||
};
|
||||
|
||||
class CMidiWrapper {
|
||||
amuse::ObjToken<amuse::Sequencer> x0_sequencer;
|
||||
//amuse::ObjToken<amuse::Sequencer> x0_sequencer;
|
||||
// CSfxHandle x4_handle;
|
||||
u16 x8_songId;
|
||||
bool xa_available = true;
|
||||
|
||||
public:
|
||||
amuse::ObjToken<amuse::Sequencer> GetAudioSysHandle() const { return x0_sequencer; }
|
||||
void SetAudioSysHandle(amuse::ObjToken<amuse::Sequencer> sequencer) { x0_sequencer = std::move(sequencer); }
|
||||
//amuse::ObjToken<amuse::Sequencer> GetAudioSysHandle() const { return x0_sequencer; }
|
||||
//void SetAudioSysHandle(amuse::ObjToken<amuse::Sequencer> sequencer) { x0_sequencer = std::move(sequencer); }
|
||||
// const CSfxHandle& GetManagerHandle() const { return x4_handle; }
|
||||
// void SetMidiHandle(const CSfxHandle& handle) { x4_handle = handle; }
|
||||
bool IsAvailable() const { return xa_available; }
|
||||
|
|
|
@ -7,15 +7,15 @@ namespace metaforce {
|
|||
static TLockedToken<std::vector<u16>> mpSfxTranslationTableTok;
|
||||
std::vector<u16>* CSfxManager::mpSfxTranslationTable = nullptr;
|
||||
|
||||
static amuse::EffectReverbHiInfo s_ReverbHiQueued;
|
||||
static amuse::EffectChorusInfo s_ChorusQueued;
|
||||
static amuse::EffectReverbStdInfo s_ReverbStdQueued;
|
||||
static amuse::EffectDelayInfo s_DelayQueued;
|
||||
|
||||
static amuse::EffectReverbHi* s_ReverbHiState = nullptr;
|
||||
static amuse::EffectChorus* s_ChorusState = nullptr;
|
||||
static amuse::EffectReverbStd* s_ReverbStdState = nullptr;
|
||||
static amuse::EffectDelay* s_DelayState = nullptr;
|
||||
//static amuse::EffectReverbHiInfo s_ReverbHiQueued;
|
||||
//static amuse::EffectChorusInfo s_ChorusQueued;
|
||||
//static amuse::EffectReverbStdInfo s_ReverbStdQueued;
|
||||
//static amuse::EffectDelayInfo s_DelayQueued;
|
||||
//
|
||||
//static amuse::EffectReverbHi* s_ReverbHiState = nullptr;
|
||||
//static amuse::EffectChorus* s_ChorusState = nullptr;
|
||||
//static amuse::EffectReverbStd* s_ReverbStdState = nullptr;
|
||||
//static amuse::EffectDelay* s_DelayState = nullptr;
|
||||
|
||||
CFactoryFnReturn FAudioTranslationTableFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms,
|
||||
CObjectReference* selfRef) {
|
||||
|
@ -36,7 +36,7 @@ bool CSfxManager::m_auxProcessingEnabled = false;
|
|||
float CSfxManager::m_reverbAmount = 1.f;
|
||||
CSfxManager::EAuxEffect CSfxManager::m_activeEffect = CSfxManager::EAuxEffect::None;
|
||||
CSfxManager::EAuxEffect CSfxManager::m_nextEffect = CSfxManager::EAuxEffect::None;
|
||||
amuse::ObjToken<amuse::Listener> CSfxManager::m_listener;
|
||||
//amuse::ObjToken<amuse::Listener> CSfxManager::m_listener;
|
||||
|
||||
u16 CSfxManager::kMaxPriority;
|
||||
u16 CSfxManager::kMedPriority;
|
||||
|
@ -54,27 +54,27 @@ bool CSfxManager::LoadTranslationTable(CSimplePool* pool, const SObjectTag* tag)
|
|||
}
|
||||
|
||||
bool CSfxManager::CSfxWrapper::IsPlaying() const {
|
||||
if (CBaseSfxWrapper::IsPlaying() && x1c_voiceHandle)
|
||||
return x1c_voiceHandle->state() == amuse::VoiceState::Playing;
|
||||
// if (CBaseSfxWrapper::IsPlaying() && x1c_voiceHandle)
|
||||
// return x1c_voiceHandle->state() == amuse::VoiceState::Playing;
|
||||
return false;
|
||||
}
|
||||
|
||||
void CSfxManager::CSfxWrapper::Play() {
|
||||
x1c_voiceHandle = CAudioSys::GetAmuseEngine().fxStart(x18_sfxId, x20_vol, x22_pan);
|
||||
if (x1c_voiceHandle) {
|
||||
if (CSfxManager::IsAuxProcessingEnabled() && UseAcoustics())
|
||||
x1c_voiceHandle->setReverbVol(m_reverbAmount);
|
||||
SetPlaying(true);
|
||||
}
|
||||
// x1c_voiceHandle = CAudioSys::GetAmuseEngine().fxStart(x18_sfxId, x20_vol, x22_pan);
|
||||
// if (x1c_voiceHandle) {
|
||||
// if (CSfxManager::IsAuxProcessingEnabled() && UseAcoustics())
|
||||
// x1c_voiceHandle->setReverbVol(m_reverbAmount);
|
||||
// SetPlaying(true);
|
||||
// }
|
||||
x24_ready = false;
|
||||
}
|
||||
|
||||
void CSfxManager::CSfxWrapper::Stop() {
|
||||
if (x1c_voiceHandle) {
|
||||
x1c_voiceHandle->keyOff();
|
||||
SetPlaying(false);
|
||||
x1c_voiceHandle.reset();
|
||||
}
|
||||
// if (x1c_voiceHandle) {
|
||||
// x1c_voiceHandle->keyOff();
|
||||
// SetPlaying(false);
|
||||
// x1c_voiceHandle.reset();
|
||||
// }
|
||||
}
|
||||
|
||||
bool CSfxManager::CSfxWrapper::Ready() {
|
||||
|
@ -86,25 +86,25 @@ bool CSfxManager::CSfxWrapper::Ready() {
|
|||
u16 CSfxManager::CSfxWrapper::GetSfxId() const { return x18_sfxId; }
|
||||
|
||||
void CSfxManager::CSfxWrapper::UpdateEmitterSilent() {
|
||||
if (x1c_voiceHandle)
|
||||
x1c_voiceHandle->setVolume(1.f / 127.f);
|
||||
// if (x1c_voiceHandle)
|
||||
// x1c_voiceHandle->setVolume(1.f / 127.f);
|
||||
}
|
||||
|
||||
void CSfxManager::CSfxWrapper::UpdateEmitter() {
|
||||
if (x1c_voiceHandle)
|
||||
x1c_voiceHandle->setVolume(x20_vol);
|
||||
// if (x1c_voiceHandle)
|
||||
// x1c_voiceHandle->setVolume(x20_vol);
|
||||
}
|
||||
|
||||
void CSfxManager::CSfxWrapper::SetReverb(float rev) {
|
||||
if (x1c_voiceHandle && IsAuxProcessingEnabled() && UseAcoustics())
|
||||
x1c_voiceHandle->setReverbVol(rev);
|
||||
// if (x1c_voiceHandle && IsAuxProcessingEnabled() && UseAcoustics())
|
||||
// x1c_voiceHandle->setReverbVol(rev);
|
||||
}
|
||||
|
||||
bool CSfxManager::CSfxEmitterWrapper::IsPlaying() const {
|
||||
if (IsLooped())
|
||||
return CBaseSfxWrapper::IsPlaying();
|
||||
if (CBaseSfxWrapper::IsPlaying() && x50_emitterHandle)
|
||||
return x50_emitterHandle->getVoice()->state() == amuse::VoiceState::Playing;
|
||||
// if (CBaseSfxWrapper::IsPlaying() && x50_emitterHandle)
|
||||
// return x50_emitterHandle->getVoice()->state() == amuse::VoiceState::Playing;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -114,23 +114,23 @@ void CSfxManager::CSfxEmitterWrapper::Play() {
|
|||
else
|
||||
x1a_reverb = 0.f;
|
||||
|
||||
zeus::simd_floats pos(x24_parmData.x0_pos.mSimd);
|
||||
zeus::simd_floats dir(x24_parmData.xc_dir.mSimd);
|
||||
x50_emitterHandle = CAudioSys::GetAmuseEngine().addEmitter(
|
||||
pos.data(), dir.data(), x24_parmData.x18_maxDist, x24_parmData.x1c_distComp, x24_parmData.x24_sfxId,
|
||||
x24_parmData.x27_minVol, x24_parmData.x26_maxVol, (x24_parmData.x20_flags & 0x8) != 0);
|
||||
|
||||
if (x50_emitterHandle)
|
||||
SetPlaying(true);
|
||||
// zeus::simd_floats pos(x24_parmData.x0_pos.mSimd);
|
||||
// zeus::simd_floats dir(x24_parmData.xc_dir.mSimd);
|
||||
// x50_emitterHandle = CAudioSys::GetAmuseEngine().addEmitter(
|
||||
// pos.data(), dir.data(), x24_parmData.x18_maxDist, x24_parmData.x1c_distComp, x24_parmData.x24_sfxId,
|
||||
// x24_parmData.x27_minVol, x24_parmData.x26_maxVol, (x24_parmData.x20_flags & 0x8) != 0);
|
||||
//
|
||||
// if (x50_emitterHandle)
|
||||
// SetPlaying(true);
|
||||
x54_ready = false;
|
||||
}
|
||||
|
||||
void CSfxManager::CSfxEmitterWrapper::Stop() {
|
||||
if (x50_emitterHandle) {
|
||||
x50_emitterHandle->getVoice()->keyOff();
|
||||
SetPlaying(false);
|
||||
x50_emitterHandle.reset();
|
||||
}
|
||||
// if (x50_emitterHandle) {
|
||||
// x50_emitterHandle->getVoice()->keyOff();
|
||||
// SetPlaying(false);
|
||||
// x50_emitterHandle.reset();
|
||||
// }
|
||||
}
|
||||
|
||||
bool CSfxManager::CSfxEmitterWrapper::Ready() {
|
||||
|
@ -154,22 +154,22 @@ CSfxManager::ESfxAudibility CSfxManager::CSfxEmitterWrapper::GetAudible(const ze
|
|||
u16 CSfxManager::CSfxEmitterWrapper::GetSfxId() const { return x24_parmData.x24_sfxId; }
|
||||
|
||||
void CSfxManager::CSfxEmitterWrapper::UpdateEmitterSilent() {
|
||||
if (x50_emitterHandle) {
|
||||
zeus::simd_floats pos(x24_parmData.x0_pos.mSimd);
|
||||
zeus::simd_floats dir(x24_parmData.xc_dir.mSimd);
|
||||
x50_emitterHandle->setVectors(pos.data(), dir.data());
|
||||
x50_emitterHandle->setMaxVol(1.f / 127.f);
|
||||
}
|
||||
// if (x50_emitterHandle) {
|
||||
// zeus::simd_floats pos(x24_parmData.x0_pos.mSimd);
|
||||
// zeus::simd_floats dir(x24_parmData.xc_dir.mSimd);
|
||||
// x50_emitterHandle->setVectors(pos.data(), dir.data());
|
||||
// x50_emitterHandle->setMaxVol(1.f / 127.f);
|
||||
// }
|
||||
x55_cachedMaxVol = x24_parmData.x26_maxVol;
|
||||
}
|
||||
|
||||
void CSfxManager::CSfxEmitterWrapper::UpdateEmitter() {
|
||||
if (x50_emitterHandle) {
|
||||
zeus::simd_floats pos(x24_parmData.x0_pos.mSimd);
|
||||
zeus::simd_floats dir(x24_parmData.xc_dir.mSimd);
|
||||
x50_emitterHandle->setVectors(pos.data(), dir.data());
|
||||
x50_emitterHandle->setMaxVol(x55_cachedMaxVol);
|
||||
}
|
||||
// if (x50_emitterHandle) {
|
||||
// zeus::simd_floats pos(x24_parmData.x0_pos.mSimd);
|
||||
// zeus::simd_floats dir(x24_parmData.xc_dir.mSimd);
|
||||
// x50_emitterHandle->setVectors(pos.data(), dir.data());
|
||||
// x50_emitterHandle->setMaxVol(x55_cachedMaxVol);
|
||||
// }
|
||||
}
|
||||
|
||||
void CSfxManager::CSfxEmitterWrapper::SetReverb(float rev) {
|
||||
|
@ -238,26 +238,26 @@ void CSfxManager::TurnOffChannel(ESfxChannels chan) {
|
|||
void CSfxManager::AddListener(ESfxChannels channel, const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||
const zeus::CVector3f& heading, const zeus::CVector3f& up, float frontRadius,
|
||||
float surroundRadius, float soundSpeed, u32 flags /* 0x1 for doppler */, float vol) {
|
||||
if (m_listener)
|
||||
CAudioSys::GetAmuseEngine().removeListener(m_listener.get());
|
||||
zeus::simd_floats p(pos.mSimd);
|
||||
zeus::simd_floats d(dir.mSimd);
|
||||
zeus::simd_floats h(heading.mSimd);
|
||||
zeus::simd_floats u(up.mSimd);
|
||||
m_listener = CAudioSys::GetAmuseEngine().addListener(p.data(), d.data(), h.data(), u.data(), frontRadius,
|
||||
surroundRadius, soundSpeed, vol);
|
||||
// if (m_listener)
|
||||
// CAudioSys::GetAmuseEngine().removeListener(m_listener.get());
|
||||
// zeus::simd_floats p(pos.mSimd);
|
||||
// zeus::simd_floats d(dir.mSimd);
|
||||
// zeus::simd_floats h(heading.mSimd);
|
||||
// zeus::simd_floats u(up.mSimd);
|
||||
// m_listener = CAudioSys::GetAmuseEngine().addListener(p.data(), d.data(), h.data(), u.data(), frontRadius,
|
||||
// surroundRadius, soundSpeed, vol);
|
||||
}
|
||||
|
||||
void CSfxManager::UpdateListener(const zeus::CVector3f& pos, const zeus::CVector3f& dir, const zeus::CVector3f& heading,
|
||||
const zeus::CVector3f& up, float vol) {
|
||||
if (m_listener) {
|
||||
zeus::simd_floats p(pos.mSimd);
|
||||
zeus::simd_floats d(dir.mSimd);
|
||||
zeus::simd_floats h(heading.mSimd);
|
||||
zeus::simd_floats u(up.mSimd);
|
||||
m_listener->setVectors(p.data(), d.data(), h.data(), u.data());
|
||||
m_listener->setVolume(vol);
|
||||
}
|
||||
// if (m_listener) {
|
||||
// zeus::simd_floats p(pos.mSimd);
|
||||
// zeus::simd_floats d(dir.mSimd);
|
||||
// zeus::simd_floats h(heading.mSimd);
|
||||
// zeus::simd_floats u(up.mSimd);
|
||||
// m_listener->setVectors(p.data(), d.data(), h.data(), u.data());
|
||||
// m_listener->setVolume(vol);
|
||||
// }
|
||||
}
|
||||
|
||||
s16 CSfxManager::GetRank(CBaseSfxWrapper* sfx) {
|
||||
|
@ -304,10 +304,10 @@ void CSfxManager::PitchBend(const CSfxHandle& handle, float pitch) {
|
|||
return;
|
||||
if (!handle->IsPlaying())
|
||||
CSfxManager::Update(0.f);
|
||||
if (handle->IsPlaying()) {
|
||||
m_doUpdate = true;
|
||||
handle->GetVoice()->setPitchWheel(pitch);
|
||||
}
|
||||
// if (handle->IsPlaying()) {
|
||||
// m_doUpdate = true;
|
||||
// handle->GetVoice()->setPitchWheel(pitch);
|
||||
// }
|
||||
}
|
||||
|
||||
void CSfxManager::SfxVolume(const CSfxHandle& handle, float vol) {
|
||||
|
@ -317,15 +317,15 @@ void CSfxManager::SfxVolume(const CSfxHandle& handle, float vol) {
|
|||
CSfxWrapper& wrapper = static_cast<CSfxWrapper&>(*handle);
|
||||
wrapper.SetVolume(vol);
|
||||
}
|
||||
if (handle->IsPlaying())
|
||||
handle->GetVoice()->setVolume(vol);
|
||||
// if (handle->IsPlaying())
|
||||
// handle->GetVoice()->setVolume(vol);
|
||||
}
|
||||
|
||||
void CSfxManager::SfxSpan(const CSfxHandle& handle, float span) {
|
||||
if (!handle)
|
||||
return;
|
||||
if (handle->IsPlaying())
|
||||
handle->GetVoice()->setSurroundPan(span);
|
||||
// if (handle->IsPlaying())
|
||||
// handle->GetVoice()->setSurroundPan(span);
|
||||
}
|
||||
|
||||
u16 CSfxManager::TranslateSFXID(u16 id) {
|
||||
|
@ -380,16 +380,16 @@ void CSfxManager::UpdateEmitter(const CSfxHandle& handle, const zeus::CVector3f&
|
|||
float maxVol) {
|
||||
if (!handle || !handle->IsEmitter() || !handle->IsPlaying())
|
||||
return;
|
||||
m_doUpdate = true;
|
||||
CSfxEmitterWrapper& emitter = static_cast<CSfxEmitterWrapper&>(*handle);
|
||||
emitter.GetEmitterData().x0_pos = pos;
|
||||
emitter.GetEmitterData().xc_dir = dir;
|
||||
emitter.GetEmitterData().x26_maxVol = maxVol;
|
||||
amuse::Emitter& h = *emitter.GetHandle();
|
||||
zeus::simd_floats p(pos.mSimd);
|
||||
zeus::simd_floats d(dir.mSimd);
|
||||
h.setVectors(p.data(), d.data());
|
||||
h.setMaxVol(maxVol);
|
||||
// m_doUpdate = true;
|
||||
// CSfxEmitterWrapper& emitter = static_cast<CSfxEmitterWrapper&>(*handle);
|
||||
// emitter.GetEmitterData().x0_pos = pos;
|
||||
// emitter.GetEmitterData().xc_dir = dir;
|
||||
// emitter.GetEmitterData().x26_maxVol = maxVol;
|
||||
// amuse::Emitter& h = *emitter.GetHandle();
|
||||
// zeus::simd_floats p(pos.mSimd);
|
||||
// zeus::simd_floats d(dir.mSimd);
|
||||
// h.setVectors(p.data(), d.data());
|
||||
// h.setMaxVol(maxVol);
|
||||
}
|
||||
|
||||
CSfxHandle CSfxManager::AddEmitter(u16 id, const zeus::CVector3f& pos, const zeus::CVector3f& dir, bool useAcoustics,
|
||||
|
@ -459,84 +459,84 @@ void CSfxManager::EnableAuxCallback() {
|
|||
if (m_activeEffect != EAuxEffect::None)
|
||||
DisableAuxCallback();
|
||||
|
||||
auto studio = CAudioSys::GetAmuseEngine().getDefaultStudio();
|
||||
amuse::Submix& smix = studio->getAuxA();
|
||||
|
||||
m_activeEffect = m_nextEffect;
|
||||
switch (m_activeEffect) {
|
||||
case EAuxEffect::ReverbHi:
|
||||
s_ReverbHiState = &smix.makeReverbHi(s_ReverbHiQueued);
|
||||
break;
|
||||
case EAuxEffect::Chorus:
|
||||
s_ChorusState = &smix.makeChorus(s_ChorusQueued);
|
||||
break;
|
||||
case EAuxEffect::ReverbStd:
|
||||
s_ReverbStdState = &smix.makeReverbStd(s_ReverbStdQueued);
|
||||
break;
|
||||
case EAuxEffect::Delay:
|
||||
s_DelayState = &smix.makeDelay(s_DelayQueued);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// auto studio = CAudioSys::GetAmuseEngine().getDefaultStudio();
|
||||
// amuse::Submix& smix = studio->getAuxA();
|
||||
//
|
||||
// m_activeEffect = m_nextEffect;
|
||||
// switch (m_activeEffect) {
|
||||
// case EAuxEffect::ReverbHi:
|
||||
// s_ReverbHiState = &smix.makeReverbHi(s_ReverbHiQueued);
|
||||
// break;
|
||||
// case EAuxEffect::Chorus:
|
||||
// s_ChorusState = &smix.makeChorus(s_ChorusQueued);
|
||||
// break;
|
||||
// case EAuxEffect::ReverbStd:
|
||||
// s_ReverbStdState = &smix.makeReverbStd(s_ReverbStdQueued);
|
||||
// break;
|
||||
// case EAuxEffect::Delay:
|
||||
// s_DelayState = &smix.makeDelay(s_DelayQueued);
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
|
||||
m_auxProcessingEnabled = true;
|
||||
}
|
||||
|
||||
void CSfxManager::PrepareDelayCallback(const amuse::EffectDelayInfo& info) {
|
||||
DisableAuxProcessing();
|
||||
s_DelayQueued = info;
|
||||
m_nextEffect = EAuxEffect::Delay;
|
||||
if (m_reverbAmount == 0.f)
|
||||
EnableAuxCallback();
|
||||
}
|
||||
|
||||
void CSfxManager::PrepareReverbStdCallback(const amuse::EffectReverbStdInfo& info) {
|
||||
DisableAuxProcessing();
|
||||
s_ReverbStdQueued = info;
|
||||
m_nextEffect = EAuxEffect::ReverbStd;
|
||||
if (m_reverbAmount == 0.f)
|
||||
EnableAuxCallback();
|
||||
}
|
||||
|
||||
void CSfxManager::PrepareChorusCallback(const amuse::EffectChorusInfo& info) {
|
||||
DisableAuxProcessing();
|
||||
s_ChorusQueued = info;
|
||||
m_nextEffect = EAuxEffect::Chorus;
|
||||
if (m_reverbAmount == 0.f)
|
||||
EnableAuxCallback();
|
||||
}
|
||||
|
||||
void CSfxManager::PrepareReverbHiCallback(const amuse::EffectReverbHiInfo& info) {
|
||||
DisableAuxProcessing();
|
||||
s_ReverbHiQueued = info;
|
||||
m_nextEffect = EAuxEffect::ReverbHi;
|
||||
if (m_reverbAmount == 0.f)
|
||||
EnableAuxCallback();
|
||||
}
|
||||
//void CSfxManager::PrepareDelayCallback(const amuse::EffectDelayInfo& info) {
|
||||
// DisableAuxProcessing();
|
||||
// s_DelayQueued = info;
|
||||
// m_nextEffect = EAuxEffect::Delay;
|
||||
// if (m_reverbAmount == 0.f)
|
||||
// EnableAuxCallback();
|
||||
//}
|
||||
//
|
||||
//void CSfxManager::PrepareReverbStdCallback(const amuse::EffectReverbStdInfo& info) {
|
||||
// DisableAuxProcessing();
|
||||
// s_ReverbStdQueued = info;
|
||||
// m_nextEffect = EAuxEffect::ReverbStd;
|
||||
// if (m_reverbAmount == 0.f)
|
||||
// EnableAuxCallback();
|
||||
//}
|
||||
//
|
||||
//void CSfxManager::PrepareChorusCallback(const amuse::EffectChorusInfo& info) {
|
||||
// DisableAuxProcessing();
|
||||
// s_ChorusQueued = info;
|
||||
// m_nextEffect = EAuxEffect::Chorus;
|
||||
// if (m_reverbAmount == 0.f)
|
||||
// EnableAuxCallback();
|
||||
//}
|
||||
//
|
||||
//void CSfxManager::PrepareReverbHiCallback(const amuse::EffectReverbHiInfo& info) {
|
||||
// DisableAuxProcessing();
|
||||
// s_ReverbHiQueued = info;
|
||||
// m_nextEffect = EAuxEffect::ReverbHi;
|
||||
// if (m_reverbAmount == 0.f)
|
||||
// EnableAuxCallback();
|
||||
//}
|
||||
|
||||
void CSfxManager::DisableAuxCallback() {
|
||||
auto studio = CAudioSys::GetAmuseEngine().getDefaultStudio();
|
||||
studio->getAuxA().clearEffects();
|
||||
|
||||
switch (m_activeEffect) {
|
||||
case EAuxEffect::ReverbHi:
|
||||
s_ReverbHiState = nullptr;
|
||||
break;
|
||||
case EAuxEffect::Chorus:
|
||||
s_ChorusState = nullptr;
|
||||
break;
|
||||
case EAuxEffect::ReverbStd:
|
||||
s_ReverbStdState = nullptr;
|
||||
break;
|
||||
case EAuxEffect::Delay:
|
||||
s_DelayState = nullptr;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m_activeEffect = EAuxEffect::None;
|
||||
// auto studio = CAudioSys::GetAmuseEngine().getDefaultStudio();
|
||||
// studio->getAuxA().clearEffects();
|
||||
//
|
||||
// switch (m_activeEffect) {
|
||||
// case EAuxEffect::ReverbHi:
|
||||
// s_ReverbHiState = nullptr;
|
||||
// break;
|
||||
// case EAuxEffect::Chorus:
|
||||
// s_ChorusState = nullptr;
|
||||
// break;
|
||||
// case EAuxEffect::ReverbStd:
|
||||
// s_ReverbStdState = nullptr;
|
||||
// break;
|
||||
// case EAuxEffect::Delay:
|
||||
// s_DelayState = nullptr;
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// m_activeEffect = EAuxEffect::None;
|
||||
}
|
||||
|
||||
void CSfxManager::DisableAuxProcessing() {
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
virtual void Stop() = 0;
|
||||
virtual bool Ready() = 0;
|
||||
virtual ESfxAudibility GetAudible(const zeus::CVector3f&) = 0;
|
||||
virtual amuse::ObjToken<amuse::Voice> GetVoice() const = 0;
|
||||
//virtual amuse::ObjToken<amuse::Voice> GetVoice() const = 0;
|
||||
virtual u16 GetSfxId() const = 0;
|
||||
virtual void UpdateEmitterSilent() = 0;
|
||||
virtual void UpdateEmitter() = 0;
|
||||
|
@ -116,7 +116,7 @@ public:
|
|||
class CSfxEmitterWrapper : public CBaseSfxWrapper {
|
||||
float x1a_reverb = 0.0f;
|
||||
CAudioSys::C3DEmitterParmData x24_parmData;
|
||||
amuse::ObjToken<amuse::Emitter> x50_emitterHandle;
|
||||
//amuse::ObjToken<amuse::Emitter> x50_emitterHandle;
|
||||
bool x54_ready = true;
|
||||
float x55_cachedMaxVol = 0.0f;
|
||||
|
||||
|
@ -126,14 +126,14 @@ public:
|
|||
void Stop() override;
|
||||
bool Ready() override;
|
||||
ESfxAudibility GetAudible(const zeus::CVector3f&) override;
|
||||
amuse::ObjToken<amuse::Voice> GetVoice() const override { return x50_emitterHandle->getVoice(); }
|
||||
//amuse::ObjToken<amuse::Voice> GetVoice() const override { return x50_emitterHandle->getVoice(); }
|
||||
u16 GetSfxId() const override;
|
||||
void UpdateEmitterSilent() override;
|
||||
void UpdateEmitter() override;
|
||||
void SetReverb(float rev) override;
|
||||
CAudioSys::C3DEmitterParmData& GetEmitterData() { return x24_parmData; }
|
||||
|
||||
amuse::ObjToken<amuse::Emitter> GetHandle() const { return x50_emitterHandle; }
|
||||
//amuse::ObjToken<amuse::Emitter> GetHandle() const { return x50_emitterHandle; }
|
||||
|
||||
CSfxEmitterWrapper(bool looped, s16 prio, const CAudioSys::C3DEmitterParmData& data,
|
||||
/*const CSfxHandle& handle,*/ bool useAcoustics, TAreaId area)
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
|
||||
class CSfxWrapper : public CBaseSfxWrapper {
|
||||
u16 x18_sfxId;
|
||||
amuse::ObjToken<amuse::Voice> x1c_voiceHandle;
|
||||
//amuse::ObjToken<amuse::Voice> x1c_voiceHandle;
|
||||
float x20_vol;
|
||||
float x22_pan;
|
||||
bool x24_ready = true;
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
void Stop() override;
|
||||
bool Ready() override;
|
||||
ESfxAudibility GetAudible(const zeus::CVector3f&) override { return ESfxAudibility::Aud3; }
|
||||
amuse::ObjToken<amuse::Voice> GetVoice() const override { return x1c_voiceHandle; }
|
||||
// amuse::ObjToken<amuse::Voice> GetVoice() const override { return x1c_voiceHandle; }
|
||||
u16 GetSfxId() const override;
|
||||
void UpdateEmitterSilent() override;
|
||||
void UpdateEmitter() override;
|
||||
|
@ -178,7 +178,7 @@ public:
|
|||
static float m_reverbAmount;
|
||||
static EAuxEffect m_activeEffect;
|
||||
static EAuxEffect m_nextEffect;
|
||||
static amuse::ObjToken<amuse::Listener> m_listener;
|
||||
//static amuse::ObjToken<amuse::Listener> m_listener;
|
||||
|
||||
static u16 kMaxPriority;
|
||||
static u16 kMedPriority;
|
||||
|
@ -222,10 +222,10 @@ public:
|
|||
static void StopAndRemoveAllEmitters();
|
||||
static void DisableAuxCallback();
|
||||
static void EnableAuxCallback();
|
||||
static void PrepareDelayCallback(const amuse::EffectDelayInfo& info);
|
||||
static void PrepareReverbStdCallback(const amuse::EffectReverbStdInfo& info);
|
||||
static void PrepareChorusCallback(const amuse::EffectChorusInfo& info);
|
||||
static void PrepareReverbHiCallback(const amuse::EffectReverbHiInfo& info);
|
||||
// static void PrepareDelayCallback(const amuse::EffectDelayInfo& info);
|
||||
// static void PrepareReverbStdCallback(const amuse::EffectReverbStdInfo& info);
|
||||
// static void PrepareChorusCallback(const amuse::EffectChorusInfo& info);
|
||||
// static void PrepareReverbHiCallback(const amuse::EffectReverbHiInfo& info);
|
||||
static void DisableAuxProcessing();
|
||||
|
||||
static void SetActiveAreas(const rstl::reserved_vector<TAreaId, 10>& areas);
|
||||
|
|
|
@ -7,37 +7,37 @@ namespace metaforce {
|
|||
|
||||
#define RSF_BUFFER_SIZE 0x20000
|
||||
|
||||
CStaticAudioPlayer::CStaticAudioPlayer(boo::IAudioVoiceEngine& engine, std::string_view path, int loopStart,
|
||||
int loopEnd)
|
||||
: x0_path(path)
|
||||
, x1c_loopStartSamp(loopStart & 0xfffffffe)
|
||||
, x20_loopEndSamp(loopEnd & 0xfffffffe)
|
||||
, m_voiceCallback(*this)
|
||||
, m_voice(engine.allocateNewStereoVoice(32000, &m_voiceCallback)) {
|
||||
// These are mixed directly into boo voice engine instead
|
||||
// x28_dmaLeft.reset(new u8[640]);
|
||||
// x30_dmaRight.reset(new u8[640]);
|
||||
|
||||
CDvdFile file(path);
|
||||
x10_rsfRem = file.Length();
|
||||
x14_rsfLength = x10_rsfRem;
|
||||
|
||||
u32 bufCount = (x10_rsfRem + RSF_BUFFER_SIZE - 1) / RSF_BUFFER_SIZE;
|
||||
x48_buffers.reserve(bufCount);
|
||||
x38_dvdRequests.reserve(bufCount);
|
||||
|
||||
for (int remBytes = x10_rsfRem; remBytes > 0; remBytes -= RSF_BUFFER_SIZE) {
|
||||
u32 thisSz = RSF_BUFFER_SIZE;
|
||||
if (remBytes < RSF_BUFFER_SIZE)
|
||||
thisSz = ROUND_UP_32(remBytes);
|
||||
|
||||
x48_buffers.emplace_back(new u8[thisSz]);
|
||||
x38_dvdRequests.push_back(file.AsyncRead(x48_buffers.back().get(), thisSz));
|
||||
}
|
||||
|
||||
g72x_init_state(&x58_leftState);
|
||||
g72x_init_state(&x8c_rightState);
|
||||
}
|
||||
//CStaticAudioPlayer::CStaticAudioPlayer(boo::IAudioVoiceEngine& engine, std::string_view path, int loopStart,
|
||||
// int loopEnd)
|
||||
//: x0_path(path)
|
||||
//, x1c_loopStartSamp(loopStart & 0xfffffffe)
|
||||
//, x20_loopEndSamp(loopEnd & 0xfffffffe)
|
||||
//, m_voiceCallback(*this)
|
||||
//, m_voice(engine.allocateNewStereoVoice(32000, &m_voiceCallback)) {
|
||||
// // These are mixed directly into boo voice engine instead
|
||||
// // x28_dmaLeft.reset(new u8[640]);
|
||||
// // x30_dmaRight.reset(new u8[640]);
|
||||
//
|
||||
// CDvdFile file(path);
|
||||
// x10_rsfRem = file.Length();
|
||||
// x14_rsfLength = x10_rsfRem;
|
||||
//
|
||||
// u32 bufCount = (x10_rsfRem + RSF_BUFFER_SIZE - 1) / RSF_BUFFER_SIZE;
|
||||
// x48_buffers.reserve(bufCount);
|
||||
// x38_dvdRequests.reserve(bufCount);
|
||||
//
|
||||
// for (int remBytes = x10_rsfRem; remBytes > 0; remBytes -= RSF_BUFFER_SIZE) {
|
||||
// u32 thisSz = RSF_BUFFER_SIZE;
|
||||
// if (remBytes < RSF_BUFFER_SIZE)
|
||||
// thisSz = ROUND_UP_32(remBytes);
|
||||
//
|
||||
// x48_buffers.emplace_back(new u8[thisSz]);
|
||||
// x38_dvdRequests.push_back(file.AsyncRead(x48_buffers.back().get(), thisSz));
|
||||
// }
|
||||
//
|
||||
// g72x_init_state(&x58_leftState);
|
||||
// g72x_init_state(&x8c_rightState);
|
||||
//}
|
||||
|
||||
bool CStaticAudioPlayer::IsReady() {
|
||||
if (x38_dvdRequests.size())
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
#include "g721.h"
|
||||
|
||||
#include <boo/audiodev/IAudioVoice.hpp>
|
||||
#include <boo/audiodev/IAudioVoiceEngine.hpp>
|
||||
//#include <boo/audiodev/IAudioVoice.hpp>
|
||||
//#include <boo/audiodev/IAudioVoiceEngine.hpp>
|
||||
|
||||
namespace metaforce {
|
||||
class IDvdRequest;
|
||||
|
@ -41,8 +41,8 @@ class CStaticAudioPlayer {
|
|||
val = 32767;
|
||||
return val;
|
||||
}
|
||||
|
||||
struct AudioVoiceCallback : boo::IAudioVoiceCallback {
|
||||
/*
|
||||
struct AudioVoiceCallback {
|
||||
CStaticAudioPlayer& m_parent;
|
||||
void preSupplyAudio(boo::IAudioVoice&, double) override {}
|
||||
size_t supplyAudio(boo::IAudioVoice& voice, size_t frames, int16_t* data) override {
|
||||
|
@ -56,20 +56,20 @@ class CStaticAudioPlayer {
|
|||
explicit AudioVoiceCallback(CStaticAudioPlayer& p) : m_parent(p) {}
|
||||
} m_voiceCallback;
|
||||
boo::ObjToken<boo::IAudioVoice> m_voice;
|
||||
|
||||
*/
|
||||
public:
|
||||
CStaticAudioPlayer(boo::IAudioVoiceEngine& engine, std::string_view path, int loopStart, int loopEnd);
|
||||
CStaticAudioPlayer(std::string_view path, int loopStart, int loopEnd)
|
||||
: CStaticAudioPlayer(*CAudioSys::GetVoiceEngine(), path, loopStart, loopEnd) {}
|
||||
// CStaticAudioPlayer(boo::IAudioVoiceEngine& engine, std::string_view path, int loopStart, int loopEnd);
|
||||
// CStaticAudioPlayer(std::string_view path, int loopStart, int loopEnd)
|
||||
// : CStaticAudioPlayer(*CAudioSys::GetVoiceEngine(), path, loopStart, loopEnd) {}
|
||||
|
||||
bool IsReady();
|
||||
void DecodeMonoAndMix(s16* bufOut, u32 numSamples, u32 cur, u32 loopEndCur, u32 loopStartCur, int vol,
|
||||
g72x_state& state, std::optional<g72x_state>& loopState) const;
|
||||
void Decode(s16* bufOut, u32 numSamples);
|
||||
void SetVolume(float vol) { xc0_volume = zeus::clamp(0.f, vol, 1.f) * 32768.f; }
|
||||
|
||||
void StartMixing() { m_voice->start(); }
|
||||
void StopMixing() { m_voice->stop(); }
|
||||
//
|
||||
// void StartMixing() { m_voice->start(); }
|
||||
// void StopMixing() { m_voice->stop(); }
|
||||
};
|
||||
|
||||
} // namespace metaforce
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
#include <amuse/DSPCodec.hpp>
|
||||
//#include <amuse/DSPCodec.hpp>
|
||||
|
||||
namespace metaforce {
|
||||
class CDSPStreamManager;
|
||||
|
@ -54,7 +54,7 @@ struct SDSPStreamInfo {
|
|||
explicit SDSPStreamInfo(const CDSPStreamManager& stream);
|
||||
};
|
||||
|
||||
struct SDSPStream : boo::IAudioVoiceCallback {
|
||||
struct SDSPStream {
|
||||
bool x0_active;
|
||||
bool x1_oneshot;
|
||||
s32 x4_ownerId;
|
||||
|
@ -155,91 +155,91 @@ struct SDSPStream : boo::IAudioVoiceCallback {
|
|||
s16 m_prev1 = 0;
|
||||
s16 m_prev2 = 0;
|
||||
|
||||
void preSupplyAudio(boo::IAudioVoice&, double) override {}
|
||||
// void preSupplyAudio(boo::IAudioVoice&, double) override {}
|
||||
|
||||
unsigned decompressChunk(unsigned readToSample, int16_t*& data) {
|
||||
unsigned startSamp = m_curSample;
|
||||
// unsigned decompressChunk(unsigned readToSample, int16_t*& data) {
|
||||
// unsigned startSamp = m_curSample;
|
||||
//
|
||||
// auto sampDiv = std::div(int(m_curSample), int(14));
|
||||
// if (sampDiv.rem) {
|
||||
// unsigned samps = DSPDecompressFrameRanged(data, xd4_ringBuffer.get() + sampDiv.quot * 8, x10_info.x1c_coef,
|
||||
// &m_prev1, &m_prev2, unsigned(sampDiv.rem), readToSample - m_curSample);
|
||||
// m_curSample += samps;
|
||||
// data += samps;
|
||||
// ++sampDiv.quot;
|
||||
// }
|
||||
//
|
||||
// while (m_curSample < readToSample) {
|
||||
// unsigned samps = DSPDecompressFrame(data, xd4_ringBuffer.get() + sampDiv.quot * 8, x10_info.x1c_coef, &m_prev1,
|
||||
// &m_prev2, readToSample - m_curSample);
|
||||
// m_curSample += samps;
|
||||
// data += samps;
|
||||
// ++sampDiv.quot;
|
||||
// }
|
||||
//
|
||||
// return m_curSample - startSamp;
|
||||
// }
|
||||
|
||||
auto sampDiv = std::div(int(m_curSample), int(14));
|
||||
if (sampDiv.rem) {
|
||||
unsigned samps = DSPDecompressFrameRanged(data, xd4_ringBuffer.get() + sampDiv.quot * 8, x10_info.x1c_coef,
|
||||
&m_prev1, &m_prev2, unsigned(sampDiv.rem), readToSample - m_curSample);
|
||||
m_curSample += samps;
|
||||
data += samps;
|
||||
++sampDiv.quot;
|
||||
}
|
||||
|
||||
while (m_curSample < readToSample) {
|
||||
unsigned samps = DSPDecompressFrame(data, xd4_ringBuffer.get() + sampDiv.quot * 8, x10_info.x1c_coef, &m_prev1,
|
||||
&m_prev2, readToSample - m_curSample);
|
||||
m_curSample += samps;
|
||||
data += samps;
|
||||
++sampDiv.quot;
|
||||
}
|
||||
|
||||
return m_curSample - startSamp;
|
||||
}
|
||||
|
||||
size_t supplyAudio(boo::IAudioVoice&, size_t frames, int16_t* data) override {
|
||||
if (!x0_active) {
|
||||
memset(data, 0, frames * 2);
|
||||
return frames;
|
||||
}
|
||||
|
||||
if (xe8_silent) {
|
||||
StopStream();
|
||||
memset(data, 0, frames * 2);
|
||||
return frames;
|
||||
}
|
||||
|
||||
unsigned halfRingSamples = xdc_ringSamples / 2;
|
||||
|
||||
size_t remFrames = frames;
|
||||
while (remFrames) {
|
||||
if (xec_readState != 2 || (xe0_curBuffer == 0 && m_curSample >= halfRingSamples)) {
|
||||
if (!BufferStream()) {
|
||||
memset(data, 0, remFrames * 2);
|
||||
return frames;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned readToSample =
|
||||
std::min(m_curSample + unsigned(remFrames), (m_curSample / halfRingSamples + 1) * halfRingSamples);
|
||||
|
||||
if (!x10_info.x10_loopFlag) {
|
||||
m_totalSamples += remFrames;
|
||||
size_t fileSamples = x10_info.xc_adpcmBytes * 14 / 8;
|
||||
if (m_totalSamples >= fileSamples) {
|
||||
size_t leftover = m_totalSamples - fileSamples;
|
||||
readToSample -= leftover;
|
||||
remFrames -= leftover;
|
||||
memset(data + remFrames, 0, leftover * 2);
|
||||
StopStream();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned leftoverSamples = 0;
|
||||
if (readToSample > xdc_ringSamples) {
|
||||
leftoverSamples = readToSample - xdc_ringSamples;
|
||||
readToSample = xdc_ringSamples;
|
||||
}
|
||||
|
||||
remFrames -= decompressChunk(readToSample, data);
|
||||
|
||||
if (leftoverSamples) {
|
||||
BufferStream();
|
||||
m_curSample = 0;
|
||||
remFrames -= decompressChunk(leftoverSamples, data);
|
||||
}
|
||||
}
|
||||
|
||||
return frames;
|
||||
}
|
||||
boo::ObjToken<boo::IAudioVoice> m_booVoice;
|
||||
// size_t supplyAudio(boo::IAudioVoice&, size_t frames, int16_t* data) override {
|
||||
// if (!x0_active) {
|
||||
// memset(data, 0, frames * 2);
|
||||
// return frames;
|
||||
// }
|
||||
//
|
||||
// if (xe8_silent) {
|
||||
// StopStream();
|
||||
// memset(data, 0, frames * 2);
|
||||
// return frames;
|
||||
// }
|
||||
//
|
||||
// unsigned halfRingSamples = xdc_ringSamples / 2;
|
||||
//
|
||||
// size_t remFrames = frames;
|
||||
// while (remFrames) {
|
||||
// if (xec_readState != 2 || (xe0_curBuffer == 0 && m_curSample >= halfRingSamples)) {
|
||||
// if (!BufferStream()) {
|
||||
// memset(data, 0, remFrames * 2);
|
||||
// return frames;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// unsigned readToSample =
|
||||
// std::min(m_curSample + unsigned(remFrames), (m_curSample / halfRingSamples + 1) * halfRingSamples);
|
||||
//
|
||||
// if (!x10_info.x10_loopFlag) {
|
||||
// m_totalSamples += remFrames;
|
||||
// size_t fileSamples = x10_info.xc_adpcmBytes * 14 / 8;
|
||||
// if (m_totalSamples >= fileSamples) {
|
||||
// size_t leftover = m_totalSamples - fileSamples;
|
||||
// readToSample -= leftover;
|
||||
// remFrames -= leftover;
|
||||
// memset(data + remFrames, 0, leftover * 2);
|
||||
// StopStream();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// unsigned leftoverSamples = 0;
|
||||
// if (readToSample > xdc_ringSamples) {
|
||||
// leftoverSamples = readToSample - xdc_ringSamples;
|
||||
// readToSample = xdc_ringSamples;
|
||||
// }
|
||||
//
|
||||
// remFrames -= decompressChunk(readToSample, data);
|
||||
//
|
||||
// if (leftoverSamples) {
|
||||
// BufferStream();
|
||||
// m_curSample = 0;
|
||||
// remFrames -= decompressChunk(leftoverSamples, data);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return frames;
|
||||
// }
|
||||
// boo::ObjToken<boo::IAudioVoice> m_booVoice;
|
||||
|
||||
void DoAllocateStream() {
|
||||
xd4_ringBuffer.reset(new u8[0x11DC0]);
|
||||
m_booVoice = CAudioSys::GetVoiceEngine()->allocateNewMonoVoice(32000.0, this);
|
||||
//m_booVoice = CAudioSys::GetVoiceEngine()->allocateNewMonoVoice(32000.0, this);
|
||||
}
|
||||
|
||||
static void Initialize() {
|
||||
|
@ -259,18 +259,18 @@ struct SDSPStream : boo::IAudioVoiceCallback {
|
|||
}
|
||||
|
||||
static void FreeAllStreams() {
|
||||
for (auto& stream : g_Streams) {
|
||||
stream.m_booVoice.reset();
|
||||
stream.x0_active = false;
|
||||
for (auto& request : stream.m_readReqs) {
|
||||
if (request) {
|
||||
request->PostCancelRequest();
|
||||
request.reset();
|
||||
}
|
||||
}
|
||||
stream.xd4_ringBuffer.reset();
|
||||
stream.m_file = std::nullopt;
|
||||
}
|
||||
// for (auto& stream : g_Streams) {
|
||||
// stream.m_booVoice.reset();
|
||||
// stream.x0_active = false;
|
||||
// for (auto& request : stream.m_readReqs) {
|
||||
// if (request) {
|
||||
// request->PostCancelRequest();
|
||||
// request.reset();
|
||||
// }
|
||||
// }
|
||||
// stream.xd4_ringBuffer.reset();
|
||||
// stream.m_file = std::nullopt;
|
||||
// }
|
||||
}
|
||||
|
||||
static s32 PickFreeStream(SDSPStream*& streamOut, bool oneshot) {
|
||||
|
@ -302,27 +302,27 @@ struct SDSPStream : boo::IAudioVoiceCallback {
|
|||
}
|
||||
|
||||
void UpdateStreamVolume(float vol) {
|
||||
x4c_vol = vol;
|
||||
if (!x0_active || xe8_silent) {
|
||||
return;
|
||||
}
|
||||
std::array<float, 8> coefs{};
|
||||
coefs[size_t(boo::AudioChannel::FrontLeft)] = m_leftgain * vol;
|
||||
coefs[size_t(boo::AudioChannel::FrontRight)] = m_rightgain * vol;
|
||||
m_booVoice->setMonoChannelLevels(nullptr, coefs.data(), true);
|
||||
// x4c_vol = vol;
|
||||
// if (!x0_active || xe8_silent) {
|
||||
// return;
|
||||
// }
|
||||
// std::array<float, 8> coefs{};
|
||||
// coefs[size_t(boo::AudioChannel::FrontLeft)] = m_leftgain * vol;
|
||||
// coefs[size_t(boo::AudioChannel::FrontRight)] = m_rightgain * vol;
|
||||
// m_booVoice->setMonoChannelLevels(nullptr, coefs.data(), true);
|
||||
}
|
||||
|
||||
static void UpdateVolume(s32 id, float vol) {
|
||||
s32 idx = FindStreamIdx(id);
|
||||
if (idx == -1)
|
||||
return;
|
||||
|
||||
SDSPStream& stream = g_Streams[idx];
|
||||
stream.UpdateStreamVolume(vol);
|
||||
if (SDSPStream* left = stream.x8_stereoLeft)
|
||||
left->UpdateStreamVolume(vol);
|
||||
if (SDSPStream* right = stream.xc_companionRight)
|
||||
right->UpdateStreamVolume(vol);
|
||||
// s32 idx = FindStreamIdx(id);
|
||||
// if (idx == -1)
|
||||
// return;
|
||||
//
|
||||
// SDSPStream& stream = g_Streams[idx];
|
||||
// stream.UpdateStreamVolume(vol);
|
||||
// if (SDSPStream* left = stream.x8_stereoLeft)
|
||||
// left->UpdateStreamVolume(vol);
|
||||
// if (SDSPStream* right = stream.xc_companionRight)
|
||||
// right->UpdateStreamVolume(vol);
|
||||
}
|
||||
|
||||
void SilenceStream() {
|
||||
|
@ -330,7 +330,7 @@ struct SDSPStream : boo::IAudioVoiceCallback {
|
|||
return;
|
||||
}
|
||||
constexpr std::array<float, 8> coefs{};
|
||||
m_booVoice->setMonoChannelLevels(nullptr, coefs.data(), true);
|
||||
//m_booVoice->setMonoChannelLevels(nullptr, coefs.data(), true);
|
||||
xe8_silent = true;
|
||||
x0_active = false;
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ struct SDSPStream : boo::IAudioVoiceCallback {
|
|||
|
||||
void StopStream() {
|
||||
x0_active = false;
|
||||
m_booVoice->stop();
|
||||
//m_booVoice->stop();
|
||||
m_file = std::nullopt;
|
||||
}
|
||||
|
||||
|
@ -427,8 +427,8 @@ struct SDSPStream : boo::IAudioVoiceCallback {
|
|||
m_prev1 = 0;
|
||||
m_prev2 = 0;
|
||||
memset(xd4_ringBuffer.get(), 0, 0x11DC0);
|
||||
m_booVoice->resetSampleRate(info.x4_sampleRate);
|
||||
m_booVoice->start();
|
||||
//m_booVoice->resetSampleRate(info.x4_sampleRate);
|
||||
//m_booVoice->start();
|
||||
UpdateStreamVolume(vol);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "Runtime/ConsoleVariables/FileStoreManager.hpp"
|
||||
#include "Runtime/ConsoleVariables/CVarManager.hpp"
|
||||
#include "Runtime/CInfiniteLoopDetector.hpp"
|
||||
#include "amuse/BooBackend.hpp"
|
||||
//#include "amuse/BooBackend.hpp"
|
||||
|
||||
#include "logvisor/logvisor.hpp"
|
||||
|
||||
|
@ -160,8 +160,8 @@ private:
|
|||
|
||||
std::string m_deferredProject;
|
||||
bool m_projectInitialized = false;
|
||||
std::optional<amuse::BooBackendVoiceAllocator> m_amuseAllocWrapper;
|
||||
std::unique_ptr<boo::IAudioVoiceEngine> m_voiceEngine;
|
||||
//std::optional<amuse::BooBackendVoiceAllocator> m_amuseAllocWrapper;
|
||||
//std::unique_ptr<boo::IAudioVoiceEngine> m_voiceEngine;
|
||||
|
||||
Limiter m_limiter{};
|
||||
|
||||
|
@ -190,9 +190,9 @@ public:
|
|||
VISetWindowTitle(
|
||||
fmt::format(FMT_STRING("Metaforce {} [{}]"), METAFORCE_WC_DESCRIBE, backend_name(info.backend)).c_str());
|
||||
|
||||
m_voiceEngine = boo::NewAudioVoiceEngine("metaforce", "Metaforce");
|
||||
m_voiceEngine->setVolume(0.7f);
|
||||
m_amuseAllocWrapper.emplace(*m_voiceEngine);
|
||||
// m_voiceEngine = boo::NewAudioVoiceEngine("metaforce", "Metaforce");
|
||||
// m_voiceEngine->setVolume(0.7f);
|
||||
// m_amuseAllocWrapper.emplace(*m_voiceEngine);
|
||||
|
||||
#if TARGET_OS_IOS || TARGET_OS_TV
|
||||
m_deferredProject = std::string{m_fileMgr.getStoreRoot()} + "game.iso";
|
||||
|
@ -202,12 +202,13 @@ public:
|
|||
std::string arg = m_argv[i];
|
||||
if (m_deferredProject.empty() && !arg.starts_with('-') && !arg.starts_with('+') && CBasics::IsDir(arg.c_str()))
|
||||
m_deferredProject = arg;
|
||||
else if (arg == "--no-sound")
|
||||
m_voiceEngine->setVolume(0.f);
|
||||
else if (arg == "--no-sound") {
|
||||
// m_voiceEngine->setVolume(0.f);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
m_voiceEngine->startPump();
|
||||
//m_voiceEngine->startPump();
|
||||
}
|
||||
|
||||
void initialize() {
|
||||
|
@ -292,7 +293,7 @@ public:
|
|||
if (!g_mainMP1 && m_projectInitialized) {
|
||||
g_mainMP1.emplace(nullptr, nullptr);
|
||||
auto result =
|
||||
g_mainMP1->Init(m_argc, m_argv, m_fileMgr, &m_cvarManager, m_voiceEngine.get(), *m_amuseAllocWrapper);
|
||||
g_mainMP1->Init(m_argc, m_argv, m_fileMgr, &m_cvarManager);
|
||||
if (!result.empty()) {
|
||||
Log.report(logvisor::Error, FMT_STRING("{}"), result);
|
||||
m_imGuiConsole.m_errorString = result;
|
||||
|
@ -310,15 +311,15 @@ public:
|
|||
|
||||
m_imGuiConsole.PreUpdate();
|
||||
if (g_mainMP1) {
|
||||
if (m_voiceEngine) {
|
||||
m_voiceEngine->lockPump();
|
||||
}
|
||||
// if (m_voiceEngine) {
|
||||
// m_voiceEngine->lockPump();
|
||||
// }
|
||||
if (g_mainMP1->Proc(dt)) {
|
||||
return false;
|
||||
}
|
||||
if (m_voiceEngine) {
|
||||
m_voiceEngine->unlockPump();
|
||||
}
|
||||
// if (m_voiceEngine) {
|
||||
// m_voiceEngine->unlockPump();
|
||||
// }
|
||||
}
|
||||
m_imGuiConsole.PostUpdate();
|
||||
if (!g_mainMP1 && m_imGuiConsole.m_gameDiscSelected) {
|
||||
|
@ -350,9 +351,9 @@ public:
|
|||
|
||||
void onAppPostDraw() noexcept {
|
||||
OPTICK_EVENT("PostDraw");
|
||||
if (m_voiceEngine) {
|
||||
m_voiceEngine->pumpAndMixVoices();
|
||||
}
|
||||
// if (m_voiceEngine) {
|
||||
// m_voiceEngine->pumpAndMixVoices();
|
||||
// }
|
||||
#ifdef EMSCRIPTEN
|
||||
CDvdFile::DoWork();
|
||||
#endif
|
||||
|
@ -372,17 +373,17 @@ public:
|
|||
|
||||
void onAppExiting() noexcept {
|
||||
m_imGuiConsole.Shutdown();
|
||||
if (m_voiceEngine) {
|
||||
m_voiceEngine->unlockPump();
|
||||
m_voiceEngine->stopPump();
|
||||
}
|
||||
// if (m_voiceEngine) {
|
||||
// m_voiceEngine->unlockPump();
|
||||
// m_voiceEngine->stopPump();
|
||||
// }
|
||||
if (g_mainMP1) {
|
||||
g_mainMP1->Shutdown();
|
||||
}
|
||||
g_mainMP1.reset();
|
||||
m_cvarManager.serialize();
|
||||
m_amuseAllocWrapper.reset();
|
||||
m_voiceEngine.reset();
|
||||
// m_amuseAllocWrapper.reset();
|
||||
// m_voiceEngine.reset();
|
||||
CDvdFile::Shutdown();
|
||||
}
|
||||
|
||||
|
|
|
@ -153,9 +153,8 @@ set(DISCORD_RPC_LIBRARY "")
|
|||
if (NOT GEKKO AND NOT NX AND NOT IOS AND NOT TVOS)
|
||||
set(DISCORD_RPC_LIBRARY "discord-rpc")
|
||||
endif()
|
||||
set(RUNTIME_LIBRARIES amuse zeus nod NESEmulator libjpeg-turbo jbus kabufuda logvisor OptickCore
|
||||
set(RUNTIME_LIBRARIES zeus nod NESEmulator libjpeg-turbo jbus kabufuda logvisor OptickCore
|
||||
imgui_support aurora::aurora
|
||||
boo # TODO move audiodev
|
||||
${DISCORD_RPC_LIBRARY}
|
||||
${ZLIB_LIBRARIES}
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "Graphics/CGX.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
|
||||
#include <amuse/DSPCodec.hpp>
|
||||
//#include <amuse/DSPCodec.hpp>
|
||||
#include <turbojpeg.h>
|
||||
|
||||
namespace metaforce {
|
||||
|
@ -212,34 +212,34 @@ void CMoviePlayer::THPAudioFrameHeader::swapBig() {
|
|||
/* Slightly modified from THPAudioDecode present in SDK; always interleaves */
|
||||
u32 CMoviePlayer::THPAudioDecode(s16* buffer, const u8* audioFrame, bool stereo) {
|
||||
THPAudioFrameHeader header = *((const THPAudioFrameHeader*)audioFrame);
|
||||
header.swapBig();
|
||||
audioFrame += sizeof(THPAudioFrameHeader);
|
||||
|
||||
if (stereo) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
unsigned samples = header.numSamples;
|
||||
s16* bufferCur = buffer + i;
|
||||
int16_t prev1 = header.channelPrevs[i][0];
|
||||
int16_t prev2 = header.channelPrevs[i][1];
|
||||
for (u32 f = 0; f < (header.numSamples + 13) / 14; ++f) {
|
||||
DSPDecompressFrameStereoStride(bufferCur, audioFrame, header.channelCoefs[i], &prev1, &prev2, samples);
|
||||
samples -= 14;
|
||||
bufferCur += 28;
|
||||
audioFrame += 8;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
unsigned samples = header.numSamples;
|
||||
s16* bufferCur = buffer;
|
||||
int16_t prev1 = header.channelPrevs[0][0];
|
||||
int16_t prev2 = header.channelPrevs[0][1];
|
||||
for (u32 f = 0; f < (header.numSamples + 13) / 14; ++f) {
|
||||
DSPDecompressFrameStereoDupe(bufferCur, audioFrame, header.channelCoefs[0], &prev1, &prev2, samples);
|
||||
samples -= 14;
|
||||
bufferCur += 28;
|
||||
audioFrame += 8;
|
||||
}
|
||||
}
|
||||
// header.swapBig();
|
||||
// audioFrame += sizeof(THPAudioFrameHeader);
|
||||
//
|
||||
// if (stereo) {
|
||||
// for (int i = 0; i < 2; ++i) {
|
||||
// unsigned samples = header.numSamples;
|
||||
// s16* bufferCur = buffer + i;
|
||||
// int16_t prev1 = header.channelPrevs[i][0];
|
||||
// int16_t prev2 = header.channelPrevs[i][1];
|
||||
// for (u32 f = 0; f < (header.numSamples + 13) / 14; ++f) {
|
||||
// DSPDecompressFrameStereoStride(bufferCur, audioFrame, header.channelCoefs[i], &prev1, &prev2, samples);
|
||||
// samples -= 14;
|
||||
// bufferCur += 28;
|
||||
// audioFrame += 8;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// unsigned samples = header.numSamples;
|
||||
// s16* bufferCur = buffer;
|
||||
// int16_t prev1 = header.channelPrevs[0][0];
|
||||
// int16_t prev2 = header.channelPrevs[0][1];
|
||||
// for (u32 f = 0; f < (header.numSamples + 13) / 14; ++f) {
|
||||
// DSPDecompressFrameStereoDupe(bufferCur, audioFrame, header.channelCoefs[0], &prev1, &prev2, samples);
|
||||
// samples -= 14;
|
||||
// bufferCur += 28;
|
||||
// audioFrame += 8;
|
||||
// }
|
||||
// }
|
||||
|
||||
return header.numSamples;
|
||||
}
|
||||
|
@ -358,99 +358,99 @@ void CMoviePlayer::SetSfxVolume(u8 volume) { SfxVolume = std::min(volume, u8(127
|
|||
|
||||
void CMoviePlayer::MixAudio(s16* out, const s16* in, u32 samples) {
|
||||
/* No audio frames ready */
|
||||
if (xd4_audioSlot == UINT32_MAX) {
|
||||
if (in)
|
||||
memmove(out, in, samples * 4);
|
||||
else
|
||||
memset(out, 0, samples * 4);
|
||||
return;
|
||||
}
|
||||
|
||||
while (samples) {
|
||||
CTHPTextureSet* tex = &x80_textures[xd4_audioSlot];
|
||||
u32 thisSamples = std::min(tex->audioSamples - tex->playedSamples, samples);
|
||||
if (!thisSamples) {
|
||||
/* Advance frame */
|
||||
++xd4_audioSlot;
|
||||
if (xd4_audioSlot >= x80_textures.size())
|
||||
xd4_audioSlot = 0;
|
||||
tex = &x80_textures[xd4_audioSlot];
|
||||
thisSamples = std::min(tex->audioSamples - tex->playedSamples, samples);
|
||||
}
|
||||
|
||||
if (thisSamples) {
|
||||
/* mix samples with `in` or no mix */
|
||||
if (in) {
|
||||
for (u32 i = 0; i < thisSamples; ++i, out += 2, in += 2) {
|
||||
out[0] = DSPSampClamp(in[0] + s32(tex->audioBuf[(i + tex->playedSamples) * 2]) * 0x50F4 / 0x8000 * SfxVolume);
|
||||
out[1] =
|
||||
DSPSampClamp(in[1] + s32(tex->audioBuf[(i + tex->playedSamples) * 2 + 1]) * 0x50F4 / 0x8000 * SfxVolume);
|
||||
}
|
||||
} else {
|
||||
for (u32 i = 0; i < thisSamples; ++i, out += 2) {
|
||||
out[0] = DSPSampClamp(s32(tex->audioBuf[(i + tex->playedSamples) * 2]) * 0x50F4 / 0x8000 * SfxVolume);
|
||||
out[1] = DSPSampClamp(s32(tex->audioBuf[(i + tex->playedSamples) * 2 + 1]) * 0x50F4 / 0x8000 * SfxVolume);
|
||||
}
|
||||
}
|
||||
tex->playedSamples += thisSamples;
|
||||
samples -= thisSamples;
|
||||
} else {
|
||||
/* metaforce addition: failsafe for buffer overrun */
|
||||
if (in)
|
||||
memmove(out, in, samples * 4);
|
||||
else
|
||||
memset(out, 0, samples * 4);
|
||||
// fprintf(stderr, "dropped %d samples\n", samples);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// if (xd4_audioSlot == UINT32_MAX) {
|
||||
// if (in)
|
||||
// memmove(out, in, samples * 4);
|
||||
// else
|
||||
// memset(out, 0, samples * 4);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// while (samples) {
|
||||
// CTHPTextureSet* tex = &x80_textures[xd4_audioSlot];
|
||||
// u32 thisSamples = std::min(tex->audioSamples - tex->playedSamples, samples);
|
||||
// if (!thisSamples) {
|
||||
// /* Advance frame */
|
||||
// ++xd4_audioSlot;
|
||||
// if (xd4_audioSlot >= x80_textures.size())
|
||||
// xd4_audioSlot = 0;
|
||||
// tex = &x80_textures[xd4_audioSlot];
|
||||
// thisSamples = std::min(tex->audioSamples - tex->playedSamples, samples);
|
||||
// }
|
||||
//
|
||||
// if (thisSamples) {
|
||||
// /* mix samples with `in` or no mix */
|
||||
// if (in) {
|
||||
// for (u32 i = 0; i < thisSamples; ++i, out += 2, in += 2) {
|
||||
// out[0] = DSPSampClamp(in[0] + s32(tex->audioBuf[(i + tex->playedSamples) * 2]) * 0x50F4 / 0x8000 * SfxVolume);
|
||||
// out[1] =
|
||||
// DSPSampClamp(in[1] + s32(tex->audioBuf[(i + tex->playedSamples) * 2 + 1]) * 0x50F4 / 0x8000 * SfxVolume);
|
||||
// }
|
||||
// } else {
|
||||
// for (u32 i = 0; i < thisSamples; ++i, out += 2) {
|
||||
// out[0] = DSPSampClamp(s32(tex->audioBuf[(i + tex->playedSamples) * 2]) * 0x50F4 / 0x8000 * SfxVolume);
|
||||
// out[1] = DSPSampClamp(s32(tex->audioBuf[(i + tex->playedSamples) * 2 + 1]) * 0x50F4 / 0x8000 * SfxVolume);
|
||||
// }
|
||||
// }
|
||||
// tex->playedSamples += thisSamples;
|
||||
// samples -= thisSamples;
|
||||
// } else {
|
||||
// /* metaforce addition: failsafe for buffer overrun */
|
||||
// if (in)
|
||||
// memmove(out, in, samples * 4);
|
||||
// else
|
||||
// memset(out, 0, samples * 4);
|
||||
// // fprintf(stderr, "dropped %d samples\n", samples);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
void CMoviePlayer::MixStaticAudio(s16* out, const s16* in, u32 samples) {
|
||||
if (!StaticAudio)
|
||||
return;
|
||||
while (samples) {
|
||||
u32 thisSamples = std::min(StaticLoopEnd - StaticAudioOffset, samples);
|
||||
const u8* thisOffsetLeft = &StaticAudio[StaticAudioOffset / 2];
|
||||
const u8* thisOffsetRight = &StaticAudio[StaticAudioSize / 2 + StaticAudioOffset / 2];
|
||||
|
||||
/* metaforce addition: mix samples with `in` or no mix */
|
||||
if (in) {
|
||||
for (u32 i = 0; i < thisSamples; i += 2) {
|
||||
out[0] = DSPSampClamp(
|
||||
in[0] + s32(g721_decoder(thisOffsetLeft[0] & 0xf, &StaticStateLeft) * StaticVolumeAtten / 0x8000));
|
||||
out[1] = DSPSampClamp(
|
||||
in[1] + s32(g721_decoder(thisOffsetRight[0] & 0xf, &StaticStateRight) * StaticVolumeAtten / 0x8000));
|
||||
out[2] = DSPSampClamp(
|
||||
in[2] + s32(g721_decoder(thisOffsetLeft[0] >> 4 & 0xf, &StaticStateLeft) * StaticVolumeAtten / 0x8000));
|
||||
out[3] = DSPSampClamp(
|
||||
in[3] + s32(g721_decoder(thisOffsetRight[0] >> 4 & 0xf, &StaticStateRight) * StaticVolumeAtten / 0x8000));
|
||||
thisOffsetLeft += 1;
|
||||
thisOffsetRight += 1;
|
||||
out += 4;
|
||||
in += 4;
|
||||
}
|
||||
} else {
|
||||
for (u32 i = 0; i < thisSamples; i += 2) {
|
||||
out[0] =
|
||||
DSPSampClamp(s32(g721_decoder(thisOffsetLeft[0] & 0xf, &StaticStateLeft) * StaticVolumeAtten / 0x8000));
|
||||
out[1] =
|
||||
DSPSampClamp(s32(g721_decoder(thisOffsetRight[0] & 0xf, &StaticStateRight) * StaticVolumeAtten / 0x8000));
|
||||
out[2] = DSPSampClamp(
|
||||
s32(g721_decoder(thisOffsetLeft[0] >> 4 & 0xf, &StaticStateLeft) * StaticVolumeAtten / 0x8000));
|
||||
out[3] = DSPSampClamp(
|
||||
s32(g721_decoder(thisOffsetRight[0] >> 4 & 0xf, &StaticStateRight) * StaticVolumeAtten / 0x8000));
|
||||
thisOffsetLeft += 1;
|
||||
thisOffsetRight += 1;
|
||||
out += 4;
|
||||
}
|
||||
}
|
||||
|
||||
StaticAudioOffset += thisSamples;
|
||||
if (StaticAudioOffset == StaticLoopEnd)
|
||||
StaticAudioOffset = StaticLoopBegin;
|
||||
samples -= thisSamples;
|
||||
}
|
||||
// if (!StaticAudio)
|
||||
// return;
|
||||
// while (samples) {
|
||||
// u32 thisSamples = std::min(StaticLoopEnd - StaticAudioOffset, samples);
|
||||
// const u8* thisOffsetLeft = &StaticAudio[StaticAudioOffset / 2];
|
||||
// const u8* thisOffsetRight = &StaticAudio[StaticAudioSize / 2 + StaticAudioOffset / 2];
|
||||
//
|
||||
// /* metaforce addition: mix samples with `in` or no mix */
|
||||
// if (in) {
|
||||
// for (u32 i = 0; i < thisSamples; i += 2) {
|
||||
// out[0] = DSPSampClamp(
|
||||
// in[0] + s32(g721_decoder(thisOffsetLeft[0] & 0xf, &StaticStateLeft) * StaticVolumeAtten / 0x8000));
|
||||
// out[1] = DSPSampClamp(
|
||||
// in[1] + s32(g721_decoder(thisOffsetRight[0] & 0xf, &StaticStateRight) * StaticVolumeAtten / 0x8000));
|
||||
// out[2] = DSPSampClamp(
|
||||
// in[2] + s32(g721_decoder(thisOffsetLeft[0] >> 4 & 0xf, &StaticStateLeft) * StaticVolumeAtten / 0x8000));
|
||||
// out[3] = DSPSampClamp(
|
||||
// in[3] + s32(g721_decoder(thisOffsetRight[0] >> 4 & 0xf, &StaticStateRight) * StaticVolumeAtten / 0x8000));
|
||||
// thisOffsetLeft += 1;
|
||||
// thisOffsetRight += 1;
|
||||
// out += 4;
|
||||
// in += 4;
|
||||
// }
|
||||
// } else {
|
||||
// for (u32 i = 0; i < thisSamples; i += 2) {
|
||||
// out[0] =
|
||||
// DSPSampClamp(s32(g721_decoder(thisOffsetLeft[0] & 0xf, &StaticStateLeft) * StaticVolumeAtten / 0x8000));
|
||||
// out[1] =
|
||||
// DSPSampClamp(s32(g721_decoder(thisOffsetRight[0] & 0xf, &StaticStateRight) * StaticVolumeAtten / 0x8000));
|
||||
// out[2] = DSPSampClamp(
|
||||
// s32(g721_decoder(thisOffsetLeft[0] >> 4 & 0xf, &StaticStateLeft) * StaticVolumeAtten / 0x8000));
|
||||
// out[3] = DSPSampClamp(
|
||||
// s32(g721_decoder(thisOffsetRight[0] >> 4 & 0xf, &StaticStateRight) * StaticVolumeAtten / 0x8000));
|
||||
// thisOffsetLeft += 1;
|
||||
// thisOffsetRight += 1;
|
||||
// out += 4;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// StaticAudioOffset += thisSamples;
|
||||
// if (StaticAudioOffset == StaticLoopEnd)
|
||||
// StaticAudioOffset = StaticLoopBegin;
|
||||
// samples -= thisSamples;
|
||||
// }
|
||||
}
|
||||
|
||||
void CMoviePlayer::Rewind() {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
#include "Runtime/CMainFlowBase.hpp"
|
||||
#include "Runtime/ConsoleVariables/FileStoreManager.hpp"
|
||||
|
||||
#include <amuse/amuse.hpp>
|
||||
#include <boo/audiodev/IAudioVoiceEngine.hpp>
|
||||
//#include <amuse/amuse.hpp>
|
||||
//#include <boo/audiodev/IAudioVoiceEngine.hpp>
|
||||
|
||||
namespace metaforce {
|
||||
class Console;
|
||||
|
@ -37,8 +37,7 @@ enum class EGameplayResult { None, Win, Lose, Playing };
|
|||
class IMain {
|
||||
public:
|
||||
virtual ~IMain() = default;
|
||||
virtual std::string Init(int argc, char** argv, const FileStoreManager& storeMgr, CVarManager* cvarMgr,
|
||||
boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend) = 0;
|
||||
virtual std::string Init(int argc, char** argv, const FileStoreManager& storeMgr, CVarManager* cvarMgr) = 0;
|
||||
virtual void Draw() = 0;
|
||||
virtual bool Proc(float dt) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <set>
|
||||
#include <string_view>
|
||||
#include <deque>
|
||||
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
#include "Runtime/World/CActor.hpp"
|
||||
|
|
|
@ -163,6 +163,8 @@
|
|||
#include "imgui.h"
|
||||
#include "magic_enum.hpp"
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
#define IMGUI_ENTITY_INSPECT(CLS, PARENT, NAME, ...) \
|
||||
std::string_view CLS::ImGuiType() { return #NAME; } \
|
||||
void CLS::ImGuiInspect() { \
|
||||
|
|
|
@ -109,20 +109,20 @@ CIOWin::EMessageReturn CCredits::Update(float dt, CArchitectureQueue& queue) {
|
|||
}
|
||||
case 1: {
|
||||
if (!x28_) {
|
||||
x28_ = std::make_unique<CMoviePlayer>("Video/creditBG.thp", 0.f, true, true);
|
||||
//x28_ = std::make_unique<CMoviePlayer>("Video/creditBG.thp", 0.f, true, true);
|
||||
}
|
||||
x14_ = 2;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
if (!x2c_) {
|
||||
x2c_ = std::make_unique<CStaticAudioPlayer>("Audio/ending3.rsf", 0, 0x5d7c00);
|
||||
//x2c_ = std::make_unique<CStaticAudioPlayer>("Audio/ending3.rsf", 0, 0x5d7c00);
|
||||
}
|
||||
if (!x2c_->IsReady()) {
|
||||
return EMessageReturn::Exit;
|
||||
}
|
||||
x2c_->SetVolume(1.f);
|
||||
x2c_->StartMixing();
|
||||
//x2c_->StartMixing();
|
||||
x14_ = 3;
|
||||
}
|
||||
[[fallthrough]];
|
||||
|
|
|
@ -1643,12 +1643,12 @@ CFrontEndUI::CFrontEndUI() : CIOWin("FrontEndUI") {
|
|||
|
||||
CFrontEndUI::~CFrontEndUI() {
|
||||
if (x14_phase >= EPhase::DisplayFrontEnd) {
|
||||
CAudioSys::RemoveAudioGroup(x44_frontendAudioGrp->GetAudioGroupData());
|
||||
//CAudioSys::RemoveAudioGroup(x44_frontendAudioGrp->GetAudioGroupData());
|
||||
}
|
||||
}
|
||||
|
||||
void CFrontEndUI::StartSlideShow(CArchitectureQueue& queue) {
|
||||
xf4_curAudio->StopMixing();
|
||||
//xf4_curAudio->StopMixing();
|
||||
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, std::make_shared<CSlideShow>()));
|
||||
}
|
||||
|
||||
|
@ -1771,9 +1771,9 @@ void CFrontEndUI::CompleteStateTransition() {
|
|||
case EScreen::FileSelect:
|
||||
SetCurrentMovie(EMenuMovie::FileSelectLoop);
|
||||
if (oldScreen == EScreen::Title) {
|
||||
xf4_curAudio->StopMixing();
|
||||
xf4_curAudio = xd8_audio2.get();
|
||||
xf4_curAudio->StartMixing();
|
||||
//xf4_curAudio->StopMixing();
|
||||
//xf4_curAudio = xd8_audio2.get();
|
||||
//xf4_curAudio->StartMixing();
|
||||
}
|
||||
if (xdc_saveUI)
|
||||
xdc_saveUI->ResetCardDriver();
|
||||
|
@ -2046,7 +2046,7 @@ void CFrontEndUI::ProcessUserInput(const CFinalInput& input, CArchitectureQueue&
|
|||
StartStateTransition(EScreen::FileSelect);
|
||||
return;
|
||||
case SFusionBonusFrame::EAction::PlayNESMetroid:
|
||||
xf4_curAudio->StopMixing();
|
||||
//xf4_curAudio->StopMixing();
|
||||
xec_emuFrme = std::make_unique<SNesEmulatorFrame>();
|
||||
if (xdc_saveUI)
|
||||
xdc_saveUI->SetInGame(true);
|
||||
|
@ -2119,9 +2119,9 @@ CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue)
|
|||
}
|
||||
xe8_frontendNoCardFrme = std::make_unique<SFrontEndFrame>(x1c_rndB);
|
||||
x38_pressStart.GetObj();
|
||||
CAudioSys::AddAudioGroup(x44_frontendAudioGrp->GetAudioGroupData());
|
||||
xd4_audio1 = std::make_unique<CStaticAudioPlayer>("Audio/frontend_1.rsf", 416480, 1973664);
|
||||
xd8_audio2 = std::make_unique<CStaticAudioPlayer>("Audio/frontend_2.rsf", 273556, 1636980);
|
||||
//CAudioSys::AddAudioGroup(x44_frontendAudioGrp->GetAudioGroupData());
|
||||
// xd4_audio1 = std::make_unique<CStaticAudioPlayer>("Audio/frontend_1.rsf", 416480, 1973664);
|
||||
// xd8_audio2 = std::make_unique<CStaticAudioPlayer>("Audio/frontend_2.rsf", 273556, 1636980);
|
||||
x14_phase = EPhase::LoadFrames;
|
||||
}
|
||||
if (x14_phase == EPhase::LoadDeps)
|
||||
|
@ -2136,8 +2136,8 @@ CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue)
|
|||
if (!xd4_audio1->IsReady() || !xd8_audio2->IsReady() || !xe0_frontendCardFrme->PumpLoad() ||
|
||||
!xe8_frontendNoCardFrme->PumpLoad() || !xdc_saveUI->PumpLoad())
|
||||
return EMessageReturn::Exit;
|
||||
xf4_curAudio = xd4_audio1.get();
|
||||
xf4_curAudio->StartMixing();
|
||||
// xf4_curAudio = xd4_audio1.get();
|
||||
// xf4_curAudio->StartMixing();
|
||||
x14_phase = EPhase::LoadMovies;
|
||||
[[fallthrough]];
|
||||
|
||||
|
@ -2178,7 +2178,7 @@ CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue)
|
|||
xec_emuFrme.reset();
|
||||
if (xdc_saveUI)
|
||||
xdc_saveUI->SetInGame(false);
|
||||
xf4_curAudio->StartMixing();
|
||||
//xf4_curAudio->StartMixing();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2186,7 +2186,7 @@ CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue)
|
|||
if (xd2_deferSlideShow) {
|
||||
/* Start mixing slideshow music */
|
||||
xd2_deferSlideShow = false;
|
||||
xf4_curAudio->StartMixing();
|
||||
//xf4_curAudio->StartMixing();
|
||||
if (xdc_saveUI)
|
||||
xdc_saveUI->ResetCardDriver();
|
||||
}
|
||||
|
|
|
@ -90,10 +90,9 @@ constexpr std::array<AudioGroupInfo, 5> StaticAudioGroups{{
|
|||
}};
|
||||
} // Anonymous namespace
|
||||
|
||||
CGameArchitectureSupport::CGameArchitectureSupport(CMain& parent, boo::IAudioVoiceEngine* voiceEngine,
|
||||
amuse::IBackendVoiceAllocator& backend)
|
||||
CGameArchitectureSupport::CGameArchitectureSupport(CMain& parent)
|
||||
: m_parent(parent)
|
||||
, x0_audioSys(voiceEngine, backend, 0, 0, 0, 0, 0)
|
||||
, x0_audioSys(0, 0, 0, 0, 0)
|
||||
, x30_inputGenerator(/*osCtx, */ g_tweakPlayer->GetLeftLogicalThreshold(), g_tweakPlayer->GetRightLogicalThreshold())
|
||||
, x44_guiSys(*g_ResFactory, *g_SimplePool, CGuiSys::EUsageMode::Zero) {
|
||||
auto* m = static_cast<CMain*>(g_Main);
|
||||
|
@ -506,8 +505,7 @@ void CMain::HandleDiscordErrored(int errorCode, const char* message) {
|
|||
DiscordLog.report(logvisor::Error, FMT_STRING("Discord Error: {}"), message);
|
||||
}
|
||||
|
||||
std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr, CVarManager* cvarMgr,
|
||||
boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend) {
|
||||
std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr, CVarManager* cvarMgr) {
|
||||
m_cvarMgr = cvarMgr;
|
||||
|
||||
{
|
||||
|
@ -642,7 +640,7 @@ std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr,
|
|||
}
|
||||
|
||||
FillInAssetIDs();
|
||||
x164_archSupport = std::make_unique<CGameArchitectureSupport>(*this, voiceEngine, backend);
|
||||
x164_archSupport = std::make_unique<CGameArchitectureSupport>(*this);
|
||||
g_archSupport = x164_archSupport.get();
|
||||
x164_archSupport->PreloadAudio();
|
||||
std::srand(static_cast<u32>(CBasics::GetTime()));
|
||||
|
|
|
@ -128,7 +128,7 @@ class CGameArchitectureSupport {
|
|||
void destroyed() { x4_archQueue.Push(MakeMsg::CreateRemoveAllIOWins(EArchMsgTarget::IOWinManager)); }
|
||||
|
||||
public:
|
||||
CGameArchitectureSupport(CMain& parent, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend);
|
||||
CGameArchitectureSupport(CMain& parent);
|
||||
~CGameArchitectureSupport();
|
||||
|
||||
void PreloadAudio();
|
||||
|
@ -213,8 +213,7 @@ public:
|
|||
|
||||
// int RsMain(int argc, char** argv, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator&
|
||||
// backend);
|
||||
std::string Init(int argc, char** argv, const FileStoreManager& storeMgr, CVarManager* cvarManager,
|
||||
boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend) override;
|
||||
std::string Init(int argc, char** argv, const FileStoreManager& storeMgr, CVarManager* cvarManager) override;
|
||||
bool Proc(float dt) override;
|
||||
void Draw() override;
|
||||
void Shutdown() override;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "Runtime/World/IGameArea.hpp"
|
||||
#include "Runtime/Character/CModelData.hpp"
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <zeus/CAABox.hpp>
|
||||
#include <zeus/CColor.hpp>
|
||||
#include <zeus/CTransform.hpp>
|
||||
|
|
|
@ -18,16 +18,17 @@ CScriptRoomAcoustics::CScriptRoomAcoustics(TUniqueId uid, std::string_view name,
|
|||
u32 feedbackS, u32 outputL, u32 outputR, u32 outputS)
|
||||
: CEntity(uid, info, active, name)
|
||||
, x34_volumeScale(volScale)
|
||||
, x38_revHi(revHi)
|
||||
, x39_revHiDis(revHiDis)
|
||||
, x3c_revHiInfo(revHiColoration, revHiMix, revHiTime, revHiDamping, revHiPreDelay, revHiCrosstalk)
|
||||
, x54_chorus(chorus)
|
||||
, x58_chorusInfo(baseDelay, variation, period)
|
||||
, x64_revStd(revStd)
|
||||
, x65_revStdDis(revStdDis)
|
||||
, x68_revStdInfo(revStdColoration, revStdMix, revStdTime, revStdDamping, revStdPreDelay)
|
||||
, x7c_delay(delay)
|
||||
, x80_delayInfo(delayL, delayR, delayS, feedbackL, feedbackR, feedbackS, outputL, outputR, outputS) {}
|
||||
//, x38_revHi(revHi)
|
||||
//, x39_revHiDis(revHiDis)
|
||||
//, x3c_revHiInfo(revHiColoration, revHiMix, revHiTime, revHiDamping, revHiPreDelay, revHiCrosstalk)
|
||||
//, x54_chorus(chorus)
|
||||
//, x58_chorusInfo(baseDelay, variation, period)
|
||||
//, x64_revStd(revStd)
|
||||
//, x65_revStdDis(revStdDis)
|
||||
//, x68_revStdInfo(revStdColoration, revStdMix, revStdTime, revStdDamping, revStdPreDelay)
|
||||
//, x7c_delay(delay)
|
||||
//, x80_delayInfo(delayL, delayR, delayS, feedbackL, feedbackR, feedbackS, outputL, outputR, outputS)
|
||||
{}
|
||||
|
||||
void CScriptRoomAcoustics::DisableAuxCallbacks() {
|
||||
CSfxManager::DisableAuxProcessing();
|
||||
|
@ -41,17 +42,17 @@ void CScriptRoomAcoustics::EnableAuxCallbacks() {
|
|||
}
|
||||
|
||||
bool applied = true;
|
||||
if (x38_revHi) {
|
||||
CSfxManager::PrepareReverbHiCallback(x3c_revHiInfo);
|
||||
} else if (x54_chorus) {
|
||||
CSfxManager::PrepareChorusCallback(x58_chorusInfo);
|
||||
} else if (x64_revStd) {
|
||||
CSfxManager::PrepareReverbStdCallback(x68_revStdInfo);
|
||||
} else if (x7c_delay) {
|
||||
CSfxManager::PrepareDelayCallback(x80_delayInfo);
|
||||
} else {
|
||||
applied = false;
|
||||
}
|
||||
// if (x38_revHi) {
|
||||
// CSfxManager::PrepareReverbHiCallback(x3c_revHiInfo);
|
||||
// } else if (x54_chorus) {
|
||||
// CSfxManager::PrepareChorusCallback(x58_chorusInfo);
|
||||
// } else if (x64_revStd) {
|
||||
// CSfxManager::PrepareReverbStdCallback(x68_revStdInfo);
|
||||
// } else if (x7c_delay) {
|
||||
// CSfxManager::PrepareDelayCallback(x80_delayInfo);
|
||||
// } else {
|
||||
// applied = false;
|
||||
// }
|
||||
|
||||
if (applied) {
|
||||
CAudioSys::SetVolumeScale(x34_volumeScale);
|
||||
|
|
|
@ -5,26 +5,26 @@
|
|||
#include "Runtime/RetroTypes.hpp"
|
||||
#include "Runtime/World/CEntity.hpp"
|
||||
|
||||
#include <amuse/EffectChorus.hpp>
|
||||
#include <amuse/EffectDelay.hpp>
|
||||
#include <amuse/EffectReverb.hpp>
|
||||
//#include <amuse/EffectChorus.hpp>
|
||||
//#include <amuse/EffectDelay.hpp>
|
||||
//#include <amuse/EffectReverb.hpp>
|
||||
|
||||
namespace metaforce {
|
||||
|
||||
class CScriptRoomAcoustics : public CEntity {
|
||||
u32 x34_volumeScale;
|
||||
|
||||
bool x38_revHi, x39_revHiDis;
|
||||
amuse::EffectReverbHiInfo x3c_revHiInfo;
|
||||
|
||||
bool x54_chorus;
|
||||
amuse::EffectChorusInfo x58_chorusInfo;
|
||||
|
||||
bool x64_revStd, x65_revStdDis;
|
||||
amuse::EffectReverbStdInfo x68_revStdInfo;
|
||||
|
||||
bool x7c_delay;
|
||||
amuse::EffectDelayInfo x80_delayInfo;
|
||||
// bool x38_revHi, x39_revHiDis;
|
||||
// amuse::EffectReverbHiInfo x3c_revHiInfo;
|
||||
//
|
||||
// bool x54_chorus;
|
||||
// amuse::EffectChorusInfo x58_chorusInfo;
|
||||
//
|
||||
// bool x64_revStd, x65_revStdDis;
|
||||
// amuse::EffectReverbStdInfo x68_revStdInfo;
|
||||
//
|
||||
// bool x7c_delay;
|
||||
// amuse::EffectDelayInfo x80_delayInfo;
|
||||
|
||||
public:
|
||||
DEFINE_ENTITY
|
||||
|
|
|
@ -25,7 +25,7 @@ CScriptSound::CScriptSound(TUniqueId uid, std::string_view name, const CEntityIn
|
|||
, x10e_vol(vol / 127.f)
|
||||
, x110_(w3)
|
||||
, x112_prio(s16(prio))
|
||||
, x114_pan(amuse::convertMusyXPanToAmusePan(pan))
|
||||
//, x114_pan(amuse::convertMusyXPanToAmusePan(pan))
|
||||
, x116_(w6)
|
||||
, x118_pitch(pitch / 8192.f)
|
||||
, x11c_25_looped(looped)
|
||||
|
|
|
@ -320,7 +320,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId
|
|||
}
|
||||
case ESpecialFunction::EndGame: {
|
||||
if (msg == EScriptObjectMessage::Action) {
|
||||
switch (GetSpecialEnding(mgr)) {
|
||||
switch (ClassifyEnding(mgr)) {
|
||||
case 0:
|
||||
g_Main->SetFlowState(EClientFlowStates::WinBad);
|
||||
break;
|
||||
|
@ -492,7 +492,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId
|
|||
break;
|
||||
}
|
||||
case ESpecialFunction::Ending: {
|
||||
if (msg == EScriptObjectMessage::Action && GetSpecialEnding(mgr) == u32(xfc_float1)) {
|
||||
if (msg == EScriptObjectMessage::Action && ClassifyEnding(mgr) == u32(xfc_float1)) {
|
||||
SendScriptMsgs(EScriptObjectState::Zero, mgr, EScriptObjectMessage::None);
|
||||
}
|
||||
break;
|
||||
|
@ -1006,7 +1006,7 @@ void CScriptSpecialFunction::DeleteEmitter(CSfxHandle& handle) {
|
|||
handle = CSfxHandle();
|
||||
}
|
||||
|
||||
u32 CScriptSpecialFunction::GetSpecialEnding(const CStateManager& mgr) const {
|
||||
u32 CScriptSpecialFunction::ClassifyEnding(const CStateManager& mgr) const {
|
||||
const int rate = (mgr.GetPlayerState()->CalculateItemCollectionRate() * 100) / mgr.GetPlayerState()->GetPickupTotal();
|
||||
int result;
|
||||
if (rate < 75) {
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
bool ShouldSkipCinematic(CStateManager& stateMgr) const;
|
||||
|
||||
void DeleteEmitter(CSfxHandle& handle);
|
||||
u32 GetSpecialEnding(const CStateManager&) const;
|
||||
u32 ClassifyEnding(const CStateManager& mgr) const;
|
||||
void AddOrUpdateEmitter(float pitch, CSfxHandle& handle, u16 id, const zeus::CVector3f& pos, float vol);
|
||||
};
|
||||
} // namespace metaforce
|
||||
|
|
|
@ -46,10 +46,7 @@ set(AURORA_NATIVE_MATRIX ON CACHE BOOL "Assume OpenGL-layout matrices, disables
|
|||
add_subdirectory(aurora)
|
||||
|
||||
# boo must come after SDL2
|
||||
add_subdirectory(boo EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(nod EXCLUDE_FROM_ALL)
|
||||
# amuse must come after athena/atdna, boo and nod
|
||||
add_subdirectory(amuse EXCLUDE_FROM_ALL)
|
||||
|
||||
if (NOT GEKKO AND NOT NX AND NOT IOS AND NOT TVOS)
|
||||
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit bc1e04b116b9f0fbaa7c88ad9d781a0e16a818da
|
|
@ -1 +1 @@
|
|||
Subproject commit ca822a7679bd0589ce8243f0138054085e3cabd6
|
||||
Subproject commit 104f089cd0a89af1cbbaafd789223de38f8e7658
|
Loading…
Reference in New Issue