start matching some d/snd things

This commit is contained in:
robojumper
2025-05-30 22:21:49 +02:00
parent 77e17d4c1f
commit 83456a9cd8
43 changed files with 1561 additions and 384 deletions
@@ -66,5 +66,12 @@ inline float sqrtf(float x) {
} // namespace std
#define _HUGE_ENUF 1e+300
#define INFINITY ((float)(_HUGE_ENUF * _HUGE_ENUF))
#define HUGE_VAL ((double)INFINITY)
#define HUGE_VALL ((long double)INFINITY)
#define DOUBLE_INF HUGE_VAL
#endif
#endif
+3 -9
View File
@@ -3,6 +3,7 @@
#include "d/a/d_a_player.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/c/c_m3d_g_cps.h"
#include "d/snd/d_snd_3d_manager.h"
#include "d/t/d_t_sound_area_mgr.h"
#include "rvl/MTX.h" // IWYU pragma: export
@@ -45,20 +46,13 @@ int dTgSndAr_c::doDelete() {
return SUCCEEDED;
}
struct Unk {
u8 unk[0x144];
mVec3_c v;
};
extern Unk *lbl_80575D58;
int dTgSndAr_c::actorExecute() {
dAcBase_c *link = dAcPy_c::LINK;
if (link != nullptr && checkPosInArea(link->position)) {
link->setBit_field_0xE8(params & 0xFF);
}
if (lbl_80575D58 != nullptr) {
mVec3_c pos = lbl_80575D58->v;
if (dSnd3DManager_c::GetInstance() != nullptr) {
mVec3_c pos = dSnd3DManager_c::GetInstance()->getListenerPos();
if (checkPosInArea(pos) && dTgSndMg_c::GetInstance() != nullptr) {
dTgSndMg_c::GetInstance()->setBgmFlag(params & 0xFF);
}
+3 -3
View File
@@ -39,7 +39,7 @@ u8 dAcBase_c::s_Create_Subtype;
extern "C" ObjInfo *getObjByActorIdAndSubtype_unkNamespace(ProfileName, u8);
extern "C" ObjInfo *getObjByActorName_unkNamespace(char *name);
extern "C" char *getObjectName_8006a730(ObjInfo *);
extern "C" SoundSource *soundForActorInitRelated_803889c0(s8, fBase_c *, char *, u8);
extern "C" dSoundSourceIf_c *soundForActorInitRelated_803889c0(s8, fBase_c *, char *, u8);
bool dAcBase_c::createHeap() {
return true;
@@ -113,7 +113,7 @@ void dAcBase_c::setTempCreateParams(
}
// has regswap
SoundSource *dAcBase_c::FUN_8002c690() {
dSoundSourceIf_c *dAcBase_c::FUN_8002c690() {
if (obj_info == nullptr) {
return nullptr;
}
@@ -515,7 +515,7 @@ void dAcBase_c::FUN_8002d830() {}
void dAcBase_c::FUN_8002d860(UNKWORD) {}
// 8002d880
SoundSource *dAcBase_c::getSoundSource() {
dSoundSourceIf_c *dAcBase_c::getSoundSource() {
return sound_source.get();
}
// End of SoundSource stuff
+3 -3
View File
@@ -631,7 +631,7 @@ bool daPlBaseMdl_c::create(
field_0x58 = 0;
mpSoundData = nullptr;
field_0x5A = 0xFFFF;
SoundSource *sound = player->getSoundSource();
dSoundSourceIf_c *sound = player->getSoundSource();
if (sound->isReadyMaybe()) {
sound->load(nullptr, "");
}
@@ -1772,7 +1772,7 @@ void daPlayerModelBase_c::removeAnmChr(s32 childIdx) {
}
void daPlayerModelBase_c::loadSound(nw4r::g3d::ResFile &file, const char *name, s32 childIdx) {
SoundSource *s = getSoundSource();
dSoundSourceIf_c *s = getSoundSource();
mCurrentAnmChrIdx = childIdx;
SizedString<64> path;
path.sprintf("%s.brasd", name);
@@ -1785,7 +1785,7 @@ void daPlayerModelBase_c::loadSound(nw4r::g3d::ResFile &file, const char *name,
}
void daPlayerModelBase_c::loadSoundForAnim(s32 childIdx) {
SoundSource *s = getSoundSource();
dSoundSourceIf_c *s = getSoundSource();
s32 anim = mAnimations[childIdx];
mCurrentAnmChrIdx = childIdx;
if (anim != mMainMdl.getField_0x5A()) {
+96
View File
@@ -0,0 +1,96 @@
#include "d/snd/d_snd_3d_actor.h"
#include "common.h"
#include "d/a/d_a_player.h"
#include "d/snd/d_snd_3d_manager.h"
#include "nw4r/math/math_types.h"
#include "toBeSorted/music_mgrs.h"
#include <cmath>
dSnd3DActor_c::dSnd3DActor_c(UNKTYPE *a1, u8 a2)
: nw4r::snd::Sound3DActor(
dSndPlayerMgr_c::GetInstance()->getSoundArchivePlayerForType(a2), dSnd3DManager_c::GetInstance()->getManager()
),
a_field_0x7D(0),
a_field_0x7E(0),
a_field_0x7F(0),
a_field_0x80(0),
a_field_0x84(0.0f),
a_field_0x88(0.0f),
a_field_0x8C(0.0f),
a_field_0x90(INFINITY),
a_field_0x94(INFINITY),
a_field_0x98(0.0f),
a_field_0x9C(0.0f),
a_field_0xC8(a1),
mFlags(0),
mDistanceToPlayer(INFINITY),
a_field_0xE0(0.0f) {
resetFloats();
// Portability hazard
SetUserParam(reinterpret_cast<u32>(this));
if (fn_8035ED90(BGM_MGR, a2)) {
a_field_0x7F = 1;
}
}
void dSnd3DActor_c::d_vt_0x34(const nw4r::math::VEC3 &rPosition) {
SetPosition(rPosition);
// TODO - 0xE0
mFlags = 0;
}
void dSnd3DActor_c::updatePositionRelativeToPlayer() {
if (!checkFlag(0x40)) {
nw4r::math::VEC3 linkTranslation = dAcPy_c::GetLink()->getCenterTranslation();
nw4r::math::VEC3 pos = GetPosition();
nw4r::math::VEC3Sub(&mPositionRelativeToPlayer, &pos, &linkTranslation);
mFlags |= 0x40;
}
}
const nw4r::math::VEC3 &dSnd3DActor_c::getPositionRelativeToPlayer() {
updatePositionRelativeToPlayer();
return mPositionRelativeToPlayer;
}
void dSnd3DActor_c::updateDistanceToPlayer() {
if (!checkFlag(0x80)) {
updatePositionRelativeToPlayer();
nw4r::math::VEC3 linkTranslation = dAcPy_c::GetLink()->getCenterTranslation();
nw4r::math::VEC3 pos = GetPosition();
if ((linkTranslation.x == 0.0f && linkTranslation.y == 0.0f && linkTranslation.z == 0.0f) ||
(pos.x == 0.0f && pos.y == 0.0f && pos.z == 0.0f)) {
// Don't bother if we received dummy values
mDistanceToPlayer = INFINITY;
} else {
mDistanceToPlayer = nw4r::math::VEC3Len(&mPositionRelativeToPlayer);
}
mFlags |= 0x80;
}
}
f32 dSnd3DActor_c::getDistanceToPlayer() {
updateDistanceToPlayer();
return mDistanceToPlayer;
}
bool dSnd3DActor_c::hasPlayingSounds() const {
for (int i = 0; i < ACTOR_PLAYER_COUNT; i++) {
if (GetPlayingSoundCount(i) > 0) {
return true;
}
}
return false;
}
bool dSnd3DActor_c::isPlayingSound(u32 id) {
bool result = false;
IsCurrentSoundIdChecker handler(id, &result);
ForEachSound(handler, false);
return result;
}
+56
View File
@@ -0,0 +1,56 @@
#include "d/snd/d_snd_3d_engine.h"
#include "common.h"
#include "nw4r/snd/snd_Sound3DListener.h"
dSnd3DEngine_c::dSnd3DEngine_c() {}
static void CalcPitch(
const nw4r::math::VEC3 *vec, f32 mag, const nw4r::snd::Sound3DManager &mgr,
const nw4r::snd::Sound3DListener &listener, const nw4r::snd::Sound3DParam &param, f32 *pPitch
);
void dSnd3DEngine_c::UpdateAmbientParam(
const nw4r::snd::Sound3DManager *mgr, const nw4r::snd::Sound3DParam *param3d, u32 unk, u32 flags,
nw4r::snd::SoundAmbientParam *paramAmb
) {
f32 pitch;
CalcPitch(nullptr, 0.0f, *mgr, mgr->GetListenerList().GetFront(), *param3d, &pitch);
}
// Largely copied from Sound3DCalculator::CalcPitch
static void CalcPitch(
const nw4r::math::VEC3 *vec, f32 mag, const nw4r::snd::Sound3DManager &mgr,
const nw4r::snd::Sound3DListener &listener, const nw4r::snd::Sound3DParam &param, f32 *pPitch
) {
f32 f0 = mgr.GetField0x24();
if (f0 == 0.0f) {
*pPitch = 1.0f;
return;
}
nw4r::math::VEC3 relativePos(*vec);
if (mag > 0.0f) {
relativePos /= mag;
}
f32 f3 = param.field_0x1E / 32.0f;
f32 f1, f2;
if (mag > 0.0f) {
f1 = -nw4r::math::VEC3Dot(&relativePos, &param.velocity);
f2 = -nw4r::math::VEC3Dot(&relativePos, &listener.GetVelocity());
} else {
f1 = -nw4r::math::VEC3Len(&param.velocity);
f2 = nw4r::math::VEC3Len(&listener.GetVelocity());
}
f32 pitch;
f1 *= f3;
f2 *= f3;
if (f2 > f0) {
pitch = 0.0f;
} else if (f1 >= f0) {
pitch = 65535.0f;
} else {
pitch = (f0 - f2) / (f0 - f1);
}
*pPitch = pitch;
}
+135
View File
@@ -0,0 +1,135 @@
#include "d/snd/d_snd_3d_manager.h"
#include "d/snd/d_snd_3d_engine.h"
#include "d/snd/d_snd_mgr.h"
#include "egg/math/eggMatrix.h"
#include "egg/math/eggVector.h"
#include "nw4r/math/math_arithmetic.h"
#include "nw4r/math/math_types.h"
#include "nw4r/snd/snd_SoundArchive.h"
#include "toBeSorted/music_mgrs.h"
template class SndMgrDisposer<dSnd3DManager_c>;
dSnd3DManager_c::dSnd3DManager_c() : mIsSetup(false), field_0x11(0) {
mCameraPosSqVelocity = 0.0f;
mCameraAtSqVelocity = 0.0f;
mCamDistance = 0.9f;
mTimer = 0;
mpEngine = new dSnd3DEngine_c();
field_0x138.x = 0.0f;
field_0x138.y = 0.0f;
field_0x138.z = 1.0f;
}
void dSnd3DManager_c::setup() {
if (mIsSetup) {
return;
}
nw4r::snd::SoundArchive *archive = dSndMgr_c::GetInstance()->getArchive();
u32 requiredSize = mManager.GetRequiredMemSize(archive);
void *buf = dSndMgr_c::GetInstance()->getSoundHeap()->Alloc(requiredSize);
mManager.Setup(archive, buf, requiredSize);
mManager.SetEngine(mpEngine);
mManager.SetMaxPriorityReduction(32);
mManager.SetField0x20(0.9f);
mManager.SetField0x24(3400.0f / 3.0f);
mListener.SetMaxVolumeDistance(300.0f);
mListener.SetUnitDistance(1000.0f);
mListener.SetInteriorSize(400.0f);
mManager.SetBiquadFilterType(3);
mListener.SetUnitBiquadFilterMax(0.5f);
mListener.SetUnitBiquadFilterValue(0.2f);
mManager.GetListenerList().Insert(mManager.GetListenerList().GetEndIter(), &mListener);
mIsSetup = true;
}
void dSnd3DManager_c::resetCamDistance() {
mCamDistance = 0.9f;
}
void dSnd3DManager_c::setCamDistance(f32 value) {
// @bug ? not actually clamped
nw4r::ut::Clamp(value, -1.0f, 2.0f);
mCamDistance = value;
}
void dSnd3DManager_c::calc() {
field_0x11 = 0;
}
void dSnd3DManager_c::clearState() {
mCameraPosSqVelocity = 0.0f;
mCameraAtSqVelocity = 0.0f;
mTimer = 0;
}
void dSnd3DManager_c::updateFromCamera(EGG::LookAtCamera &camera) {
if (field_0x11) {
return;
}
f32 dist = 0.5f;
if (fn_80364DA0(ENEMY_SOUND_MGR)) {
dist = mCamDistance;
f32 prevCameraAtSqVelocity = mCameraAtSqVelocity;
f32 prevCameraPosSqVelocity = mCameraPosSqVelocity;
mCameraAtSqVelocity = VECSquareDistance(camera.mAt, mCamera.mAt);
mCameraPosSqVelocity = VECSquareDistance(camera.mPos, mCamera.mPos);
if (((u32 *)ENEMY_SOUND_MGR)[71] > 30) {
bool bigMovement = false;
bool hugeMovement = false;
if (mTimer > 0) {
mTimer--;
} else {
f32 atAccel = prevCameraAtSqVelocity - mCameraAtSqVelocity;
f32 atAccelAbs = nw4r::math::FAbs(atAccel);
if (mCameraAtSqVelocity > 490000.0f) {
bigMovement = true;
hugeMovement = true;
} else if (atAccelAbs > 10000.0f) {
bigMovement = true;
}
if (!hugeMovement) {
f32 posAccel = prevCameraPosSqVelocity - mCameraPosSqVelocity;
f32 posAccelAbs = nw4r::math::FAbs(posAccel);
if (mCameraPosSqVelocity > 490000.0f) {
bigMovement = true;
hugeMovement = true;
} else if (posAccelAbs > 10000.0f) {
bigMovement = true;
}
if (bigMovement && !hugeMovement && nw4r::math::FAbs(atAccelAbs - posAccelAbs) < 22500.0f) {
nw4r::math::VEC3 myDir = mCamera.getOtherDirection();
nw4r::math::VEC3 camDir = camera.getOtherDirection();
VECNormalize(myDir, myDir);
VECNormalize(camDir, camDir);
if (nw4r::math::VEC3Dot(&myDir, &camDir) > 0.99f) {
bigMovement = false;
}
}
}
if (bigMovement) {
fn_80364D00(ENEMY_SOUND_MGR, -1);
mTimer = 30;
}
}
}
}
mCamera = camera;
updateListenerPos(dist);
field_0x11 = 1;
}
void dSnd3DManager_c::updateListenerPos(f32 f) {
const EGG::Matrix34f &mtx = mCamera.getViewMatrix();
mListener.SetMatrix(*mtx);
EGG::Vector3f dir = mCamera.getDirection();
VECNormalize(dir, field_0x138);
dir *= f;
mSoundListenerPosition = mCamera.mPos + dir;
}
+66
View File
@@ -0,0 +1,66 @@
#include "d/snd/d_snd_actor.h"
#include "common.h"
#include "d/snd/d_snd_checkers.h"
#include "nw4r/snd/snd_BasicSound.h"
#include "nw4r/snd/snd_SoundArchivePlayer.h"
#include "nw4r/snd/snd_SoundHandle.h"
#include "toBeSorted/music_mgrs.h"
dSndActor_c::dSndActor_c(nw4r::snd::SoundArchivePlayer &rStartable) : nw4r::snd::SoundActor(rStartable) {}
void d_snd_actor_SoundHandle_dtor() {
nw4r::snd::SoundHandle handle[2];
}
void SoundPropertiesChecker::operator()(nw4r::snd::SoundHandle &pHandle) {
if (mSoundId != -1 && mSoundId != pHandle.GetId()) {
return;
}
if (mpPlayCounter != nullptr) {
(*mpPlayCounter)++;
} else {
mPlayCounter++;
}
if (pHandle.IsPause()) {
if (mpPauseCounter != nullptr) {
(*mpPauseCounter)++;
} else {
mPauseCounter++;
}
return;
}
if (fn_803721F0(FANFARE_SOUND_MGR, pHandle.GetId())) {
if (mpCounter3 != nullptr) {
(*mpCounter3)++;
} else {
mCounter3++;
}
return;
}
if (fn_803720E0(FANFARE_SOUND_MGR, pHandle.GetId())) {
if (mpCounter3 != nullptr) {
(*mpCounter3)++;
} else {
mCounter3++;
}
return;
}
if (fn_80372070(FANFARE_SOUND_MGR, pHandle.GetId())) {
if (mpCounter4 != nullptr) {
(*mpCounter4)++;
} else {
mCounter4++;
}
return;
}
if (fn_803734C0(FANFARE_SOUND_MGR, pHandle.GetId()) && !fn_80373550(FANFARE_SOUND_MGR, pHandle.GetId())) {
mCounter3++;
}
}
+58
View File
@@ -0,0 +1,58 @@
#include "d/snd/d_snd_mgr.h"
#include "d/snd/d_snd_3d_manager.h"
#include "d/snd/d_snd_player_mgr.h"
#include "d/snd/d_snd_util.h"
#include "egg/audio/eggAudioRmtSpeakerMgr.h"
#include "egg/audio/eggAudioUtility.h"
extern "C" void fn_8035F120();
extern "C" void initEnemySoundMgr();
extern "C" void initFanfareSoundMgr();
extern "C" void initSomeUnusedSoundMgr();
extern "C" void initSoundEffectSoundMgr();
extern "C" void fn_8036A430();
extern "C" void initEnemyBgmRelatedMgr();
extern "C" void fn_80393530();
extern "C" void fn_80394830();
extern "C" void fn_8037F940();
extern "C" void fn_80399600();
extern "C" void fn_80399C20();
dSndMgr_c *dSndMgr_c::sInstance;
dSndMgr_c::dSndMgr_c(): field_0x6CC(0) {
sInstance = this;
SndMgrDisposer<dSndPlayerMgr_c>::create();
fn_8035F120();
initEnemySoundMgr();
SndMgrDisposer<dSnd3DManager_c>::create();
initFanfareSoundMgr();
initSomeUnusedSoundMgr();
initSoundEffectSoundMgr();
fn_8036A430();
initEnemyBgmRelatedMgr();
fn_80393530();
fn_80394830();
fn_8037F940();
fn_80399600();
fn_80399C20();
initHbm(9);
}
void dSndMgr_c::initialize(EGG::Heap *heap, u32 size) {}
void dSndMgr_c::initHbm(u32 frame) {
EGG::AudioUtility::HBM::init(this, restoreEffectsCallback, frame);
}
void dSndMgr_c::calc() {
if (field_0x6CC) {
EGG::SimpleAudioMgr::calc();
EGG::AudioRmtSpeakerMgr::calc();
dSndPlayerMgr_c::GetInstance()->calc();
}
}
void dSndMgr_c::restoreEffectsCallback() {}
+86
View File
@@ -0,0 +1,86 @@
#include "d/snd/d_snd_player_mgr.h"
#include "common.h"
#include "d/snd/d_snd_mgr.h"
#include "egg/core/eggDvdRipper.h"
#include "nw4r/snd/snd_SoundHandle.h"
#include "nw4r/snd/snd_SoundStartable.h"
#include "sized_string.h"
const char *dSndPlayerMgr_c::getSoundArchivePath() {
return "Sound/WZSound.brsar";
}
template class SndMgrDisposer<dSndPlayerMgr_c>;
dSndPlayerMgr_c::dSndPlayerMgr_c()
: field_0x010(0), field_0x011(0), field_0x014(-1), field_0x018(-1), field_0x01C(-1), mFlags(0) {}
u32 dSndPlayerMgr_c::getFreeSize() {
return dSndMgr_c::GetInstance()->getSoundHeap()->GetFreeSize();
}
nw4r::snd::SoundStartable::StartResult dSndPlayerMgr_c::startSound(
nw4r::snd::SoundHandle *pHandle, u32 soundId, const nw4r::snd::SoundStartable::StartInfo *pStartInfo
) {
if (mFlags & 0x2) {
return nw4r::snd::SoundStartable::START_ERR_USER;
}
nw4r::snd::SoundHandle handle;
if (pHandle == nullptr) {
pHandle = &handle;
}
nw4r::snd::SoundStartable::StartResult res;
if (pStartInfo != nullptr) {
res = dSndMgr_c::getPlayer()->detail_StartSound(pHandle, soundId, pStartInfo);
} else {
res = dSndMgr_c::getPlayer()->detail_StartSound(pHandle, soundId, nullptr);
}
return res;
}
nw4r::snd::SoundStartable::StartResult dSndPlayerMgr_c::startSound(
nw4r::snd::SoundHandle *pHandle, const char *soundLabel, const nw4r::snd::SoundStartable::StartInfo *pStartInfo
) {
u32 id = dSndPlayerMgr_c::GetInstance()->convertLabelStringToSoundId(soundLabel);
return startSound(pHandle, id, pStartInfo);
}
u32 dSndPlayerMgr_c::convertLabelStringToSoundId(const char *label) const {
return dSndMgr_c::GetInstance()->changeNameToId(label);
}
bool dSndPlayerMgr_c::loadDemoArchive(const char *demoArchiveName) {
if (demoArchiveName == nullptr) {
return false;
}
int stateId = dSndMgr_c::GetInstance()->saveState();
SizedString<64> path;
path.sprintf("Sound/demo/%s.brsar", demoArchiveName);
void *buf = dSndMgr_c::GetInstance()->getSoundHeap()->Alloc(getFreeSize() - 0x40000);
if (buf == nullptr) {
return false;
}
bool ok = false;
u32 amountRead = 0;
u32 fileSize = 0;
EGG::DvdRipper::Arg arg(path, (u8 *)buf, nullptr, EGG::DvdRipper::ALLOC_DIR_TOP, 0, &amountRead, &fileSize);
void *ptr = EGG::DvdRipper::loadToMainRAM(arg);
if (ptr != nullptr) {
ok = mSoundArchive.Setup(ptr);
if (ok) {
u32 size = mSoundArchivePlayer.GetRequiredMemSize(&mSoundArchive);
void *buf2 = dSndMgr_c::GetInstance()->getSoundHeap()->Alloc(size);
if (buf2 != nullptr) {
ok = mSoundArchivePlayer.Setup(&mSoundArchive, buf2, size, nullptr, 0);
}
}
}
if (!ok) {
dSndMgr_c::GetInstance()->loadState(stateId);
}
return ok;
}
+94
View File
@@ -0,0 +1,94 @@
#include "d/snd/d_snd_source.h"
#include "common.h"
#include "d/snd/d_snd_3d_actor.h"
#include "nw4r/snd/snd_SoundStartable.h"
#include "nw4r/ut/ut_list.h"
#include "sized_string.h"
extern "C" u8 fn_80382590(u8, UNKWORD);
extern "C" void fn_80386C50(UNKWORD, dSoundSource_c *);
extern "C" void fn_80386C70(dSoundSource_c *);
struct d_snd_mgr_unk_6_sinit {
d_snd_mgr_unk_6_sinit() : field_0x00(0), field_0x04(0.0f) {}
u32 field_0x00;
f32 field_0x04;
};
d_snd_mgr_unk_6_sinit d_snd_mgr_unk_6_sinit_instance;
const char *help_i_need_data() {
return "%s_%s_%d";
}
dSoundSource_c::dSoundSource_c(u8 a1, dAcBase_c *player, UNKWORD a3, UNKWORD a4)
: dSnd3DActor_c(((char *)a4) + 0x50, a1),
field_0x0F0(a3),
field_0x0F4(0),
mpPlayer(player),
field_0x0FD(a1),
field_0x0FE(0),
field_0x0FF(0),
field_0x100(0),
field_0x101(0),
field_0x102(0),
field_0x104(0),
field_0x108(0),
field_0x10C(0),
field_0x11C(0),
field_0x140(a4),
field_0x154(0),
field_0x158(-1),
field_0x15A(-1) {
field_0x0FC = fn_80382590(a1, a3);
// TODO: Offsetof
nw4r::ut::List_Init(&field_0x110, 0xEC);
nw4r::ut::List_Init(&field_0x120, 0x04);
nw4r::ut::List_Init(&field_0x12C, 0x04);
fn_80386C50(a4, this);
}
dSoundSource_c::~dSoundSource_c() {
SetUserParam(0);
vt_0x44();
fn_80386C70(this);
}
bool dSoundSource_c::hasPlayingSounds() const {
return dSnd3DActor_c::hasPlayingSounds();
}
void dSoundSource_c::d_vt_0x38(bool flag, int fadeFrames) {
if (flag == 0) {
PauseAllSound(flag, fadeFrames);
d_s_vt_0x1C4(flag, fadeFrames);
a_field_0x80 = 0;
} else if (a_field_0x7E == 0) {
PauseAllSound(flag, fadeFrames);
d_s_vt_0x1C4(flag, fadeFrames);
a_field_0x80 = 1;
}
}
nw4r::snd::SoundStartable::StartResult
dSoundSource_c::SetupSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *) {
// TODO
return START_SUCCESS;
}
void dSoundSource_c::d_vt_0x58() {
// noop
}
void dSoundSource_c::d_vt_0x5C() {
// noop
}
u32 dSoundSource_c::getRemoConSoundVariant(u32 soundId) const {
const char *label = soundIdToSoundLabel(soundId);
SizedString<64> str;
str.sprintf("%s_RC", label);
return soundLabelToSoundId(str);
}
+36
View File
@@ -0,0 +1,36 @@
#include "d/snd/d_snd_util.h"
class SndClass80399a40 {
public:
SndClass80399a40();
virtual ~SndClass80399a40() {}
/* 0x04 */ u8 _0x04[0x18 - 0x04];
};
// This is a test for SndMgrDisposer, since this
// class has the disposer at 0x18, which is interesting
class SndMgr80399c20;
extern template class SndMgrDisposer<SndMgr80399c20>;
class SndMgr80399c20 : SndClass80399a40 {
public:
SndMgrDisposer<SndMgr80399c20> *GetDisposer() {
return &mDisposer;
}
static SndMgr80399c20 *GetInstance() {
return sInstance;
}
static SndMgr80399c20 *sInstance;
static SndMgrDisposer<SndMgr80399c20> *sDisposer;
private:
SndMgrDisposer<SndMgr80399c20> mDisposer;
};
template class SndMgrDisposer<SndMgr80399c20>;
+3 -3
View File
@@ -31,10 +31,10 @@ AnmMdlWrapper::AnmMdlWrapper() : mpSoundSource(nullptr), mpSoundData(nullptr) {}
AnmMdlWrapper::~AnmMdlWrapper() {
if (mpSoundSource != nullptr) {
if (mpSoundSource->shutdown()) {
if (mpSoundSource->hasPlayingSounds()) {
do {
VIWaitForRetrace();
} while (mpSoundSource->shutdown());
} while (mpSoundSource->hasPlayingSounds());
}
}
}
@@ -119,7 +119,7 @@ void AnmMdlWrapper::setRate(f32 rate) {
setSoundRate(rate);
}
void AnmMdlWrapper::setSoundSource(SoundSource *pSource) {
void AnmMdlWrapper::setSoundSource(dSoundSourceIf_c *pSource) {
mpSoundSource = pSource;
}
+1 -1
View File
@@ -1,6 +1,6 @@
#include "d/a/d_a_base.h"
extern "C" SoundSource *soundForActorInitRelated_803889c0(int, fBase_c *, char *, u8);
extern "C" dSoundSourceIf_c *soundForActorInitRelated_803889c0(int, fBase_c *, char *, u8);
extern "C" bool fn_8002C250(SoundInfo *p1, int someNum, char *name, mVec3_c *position) {
p1->sound_source = soundForActorInitRelated_803889c0(someNum, p1->actor, name, 0);