mirror of
https://github.com/zeldaret/ss
synced 2026-05-26 23:47:22 -04:00
snd_Voice OK
This commit is contained in:
@@ -3111,6 +3111,8 @@ nw4r/snd/snd_TaskThread.cpp:
|
||||
|
||||
nw4r/snd/snd_Voice.cpp:
|
||||
.text start:0x804817A0 end:0x80484034 align:16
|
||||
.data start:0x8056E308 end:0x8056E340
|
||||
.sdata2 start:0x8057F188 end:0x8057F1C0
|
||||
|
||||
nw4r/snd/snd_VoiceManager.cpp:
|
||||
.text start:0x80484040 end:0x804846F4 align:16
|
||||
|
||||
+16
-16
@@ -25775,7 +25775,7 @@ AxVoiceCallbackFunc__Q44nw4r3snd6detail5VoiceFPQ44nw4r3snd6detail7AxVoiceQ54nw4r
|
||||
TransformDpl2Pan__Q44nw4r3snd6detail5VoiceFPfPfff = .text:0x80483190; // type:function size:0x1A0
|
||||
CalcMixParam__Q44nw4r3snd6detail5VoiceFiiPQ54nw4r3snd6detail7AxVoice8MixParamPQ54nw4r3snd6detail7AxVoice14RemoteMixParam = .text:0x80483330; // type:function size:0xBAC
|
||||
InvalidateWaveData__Q44nw4r3snd6detail5VoiceFPCvPCv = .text:0x80483EE0; // type:function size:0x14C
|
||||
InvalidateData__Q44nw4r3snd6detail5VoiceFPCvPCv = .text:0x80484030; // type:function size:0x4
|
||||
InvalidateData__Q44nw4r3snd6detail5VoiceFPCvPCv = .text:0x80484030; // type:function size:0x4 scope:weak
|
||||
GetInstance__Q44nw4r3snd6detail12VoiceManagerFv = .text:0x80484040; // type:function size:0x7C
|
||||
__dt__Q44nw4r3snd6detail12VoiceManagerFv = .text:0x804840C0; // type:function size:0x70
|
||||
GetRequiredMemSize__Q44nw4r3snd6detail12VoiceManagerFi = .text:0x80484130; // type:function size:0x8
|
||||
@@ -38623,8 +38623,8 @@ lbl_8056E258 = .data:0x8056E258; // type:object size:0x48
|
||||
lbl_8056E2A0 = .data:0x8056E2A0; // type:object size:0x18
|
||||
lbl_8056E2B8 = .data:0x8056E2B8; // type:object size:0x18
|
||||
lbl_8056E2D0 = .data:0x8056E2D0; // type:object size:0x38
|
||||
jumptable_8056E308 = .data:0x8056E308; // type:object size:0x24 scope:local
|
||||
lbl_8056E32C = .data:0x8056E32C; // type:object size:0x14
|
||||
@5068 = .data:0x8056E308; // type:object size:0x24 scope:local
|
||||
__vt__Q44nw4r3snd6detail5Voice = .data:0x8056E32C; // type:object size:0x14
|
||||
PanTableTable__Q44nw4r3snd6detail4Util = .data:0x8056E340; // type:object size:0xC
|
||||
__vt__Q44nw4r3snd6detail9WaveSound = .data:0x8056E350; // type:object size:0x38
|
||||
__vt__Q44nw4r3snd6detail9WsdPlayer = .data:0x8056E388; // type:object size:0x60
|
||||
@@ -49758,19 +49758,19 @@ lbl_8057F170 = .sdata2:0x8057F170; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F178 = .sdata2:0x8057F178; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F17C = .sdata2:0x8057F17C; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F180 = .sdata2:0x8057F180; // type:object size:0x8 align:8 data:double
|
||||
lbl_8057F188 = .sdata2:0x8057F188; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F18C = .sdata2:0x8057F18C; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F190 = .sdata2:0x8057F190; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F194 = .sdata2:0x8057F194; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F198 = .sdata2:0x8057F198; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F19C = .sdata2:0x8057F19C; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F1A0 = .sdata2:0x8057F1A0; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F1A4 = .sdata2:0x8057F1A4; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F1A8 = .sdata2:0x8057F1A8; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F1AC = .sdata2:0x8057F1AC; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F1B0 = .sdata2:0x8057F1B0; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F1B4 = .sdata2:0x8057F1B4; // type:object size:0x4 align:4 data:float
|
||||
lbl_8057F1B8 = .sdata2:0x8057F1B8; // type:object size:0x4 align:4 data:float
|
||||
@4083 = .sdata2:0x8057F188; // type:object size:0x4 scope:local align:4 data:float
|
||||
@4084 = .sdata2:0x8057F18C; // type:object size:0x4 scope:local align:4 data:float
|
||||
@4815 = .sdata2:0x8057F190; // type:object size:0x4 scope:local align:4 data:float
|
||||
@4816 = .sdata2:0x8057F194; // type:object size:0x4 scope:local align:4 data:float
|
||||
@4817 = .sdata2:0x8057F198; // type:object size:0x4 scope:local align:4 data:float
|
||||
@4818 = .sdata2:0x8057F19C; // type:object size:0x4 scope:local align:4 data:float
|
||||
@4819 = .sdata2:0x8057F1A0; // type:object size:0x4 scope:local align:4 data:float
|
||||
@4820 = .sdata2:0x8057F1A4; // type:object size:0x4 scope:local align:4 data:float
|
||||
@4821 = .sdata2:0x8057F1A8; // type:object size:0x4 scope:local align:4 data:float
|
||||
@4822 = .sdata2:0x8057F1AC; // type:object size:0x4 scope:local align:4 data:float
|
||||
@5062 = .sdata2:0x8057F1B0; // type:object size:0x4 scope:local align:4 data:float
|
||||
@5063 = .sdata2:0x8057F1B4; // type:object size:0x4 scope:local align:4 data:float
|
||||
@5064 = .sdata2:0x8057F1B8; // type:object size:0x4 scope:local align:4 data:float
|
||||
@312 = .sdata2:0x8057F1C0; // type:object size:0x4 scope:local align:4 data:float
|
||||
@313 = .sdata2:0x8057F1C4; // type:object size:0x4 scope:local align:4 data:float
|
||||
@314 = .sdata2:0x8057F1C8; // type:object size:0x4 scope:local align:4 data:float
|
||||
|
||||
+1
-1
@@ -1076,7 +1076,7 @@ config.libs = [
|
||||
Object(Matching, "nw4r/snd/snd_Task.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_TaskManager.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_TaskThread.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_Voice.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_Voice.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_VoiceManager.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_Util.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_WaveArchive.cpp"),
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "nw4r/snd/snd_AxVoice.h"
|
||||
#include "nw4r/snd/snd_global.h"
|
||||
|
||||
#include "nw4r/snd/snd_FxBase.h"
|
||||
@@ -106,6 +107,10 @@ namespace nw4r { namespace snd { namespace detail
|
||||
return mResetReadyCounter == 0;
|
||||
}
|
||||
|
||||
AxVoice::SrcType GetSrcType() const {
|
||||
return mSrcType;
|
||||
}
|
||||
|
||||
private:
|
||||
// cdtors
|
||||
AxManager();
|
||||
@@ -156,7 +161,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
u8 mAuxCallbackWaitCounter[AUX_BUS_NUM]; // size 0x03, offset 0xf0
|
||||
/* 1 byte padding */
|
||||
u32 mEffectProcessTick[AUX_BUS_NUM]; // size 0x0c, offset 0xf4
|
||||
u32 field_0x100;
|
||||
AxVoice::SrcType mSrcType;
|
||||
}; // size 0x104
|
||||
}}} // namespace nw4r::snd::detail
|
||||
|
||||
|
||||
@@ -235,6 +235,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
void SetLoopFlag(bool loopFlag);
|
||||
void SetPriority(u32 priority);
|
||||
void SetVoiceType(VoiceType type);
|
||||
void EnableRemote(bool enable);
|
||||
void ResetDelta();
|
||||
void SetAddr(bool loopFlag, void const *waveAddr, u32 startOffset,
|
||||
u32 loopStart, u32 loopEnd);
|
||||
@@ -242,6 +243,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
void SetAdpcm(AdpcmParam const *param);
|
||||
void SetAdpcmLoop(AdpcmLoopParam const *param);
|
||||
bool SetMix(MixParam const ¶m);
|
||||
bool SetRmtMix(const RemoteMixParam ¶m);
|
||||
void SetSrc(f32 ratio, bool initialUpdate);
|
||||
void SetVe(f32 volume, f32 initVolume);
|
||||
void SetLpf(u16 freq);
|
||||
@@ -269,7 +271,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
static void CalcOffsetAdpcmParam(u16 *outPredScale, u16 *outYn1,
|
||||
u16 *outYn2, u32 offset,
|
||||
void *dataAddr,
|
||||
const void *dataAddr,
|
||||
AdpcmParam const &adpcmParam);
|
||||
|
||||
private:
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
// typedefs
|
||||
public:
|
||||
typedef ut::LinkList<Voice, 0xec> LinkList;
|
||||
typedef ut::LinkList<Voice, 0xfc> LinkList;
|
||||
|
||||
typedef void Callback(Voice *dropVoice, VoiceCallbackStatus status,
|
||||
void *callbackData);
|
||||
@@ -229,6 +229,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
f32 mMainOutVolume; // size 0x04, offset 0xc0
|
||||
f32 mMainSend; // size 0x04, offset 0xc4
|
||||
f32 mFxSend[AUX_BUS_NUM]; // size 0x0c, offset 0xc8
|
||||
f32 mRemoteOutVolume[4]; // size 0x10, offset 0xd4 TODO following sizes wrong
|
||||
f32 mPitch; // size 0x04, offset 0xd4
|
||||
f32 mVolume; // size 0x04, offset 0xd8
|
||||
f32 mVeInitVolume; // size 0x04, offset 0xdc
|
||||
|
||||
@@ -328,7 +328,7 @@ public:
|
||||
return Iterator(LinkListImpl::GetBeginIter());
|
||||
}
|
||||
ConstIterator GetBeginIter() const {
|
||||
return ConstIterator(GetBeginIter());
|
||||
return const_cast<LinkList *>(this)->LinkListImpl::GetBeginIter();
|
||||
}
|
||||
detail::ReverseIterator<Iterator> GetBeginReverseIter() {
|
||||
return detail::ReverseIterator<Iterator>(GetBeginIter());
|
||||
@@ -338,7 +338,7 @@ public:
|
||||
return Iterator(LinkListImpl::GetEndIter());
|
||||
}
|
||||
ConstIterator GetEndIter() const {
|
||||
return ConstIterator(GetEndIter());
|
||||
return const_cast<LinkList *>(this)->LinkListImpl::GetEndIter();
|
||||
}
|
||||
detail::ReverseIterator<Iterator> GetEndReverseIter() {
|
||||
return detail::ReverseIterator<Iterator>(GetEndIter());
|
||||
|
||||
@@ -69,7 +69,7 @@ AxManager::AxManager() :
|
||||
mUpdateVoicePrioFlag (true),
|
||||
mOldAidCallback (nullptr),
|
||||
mResetReadyCounter (-1),
|
||||
field_0x100(5)
|
||||
mSrcType(AxVoice::SRC_4TAP_AUTO)
|
||||
{
|
||||
mMainOutVolume.InitValue(1.0f);
|
||||
mMasterVolume.InitValue(1.0f);
|
||||
|
||||
@@ -847,7 +847,7 @@ void AxVoice::SetRemoteFilter(u8 filter)
|
||||
}
|
||||
|
||||
void AxVoice::CalcOffsetAdpcmParam(u16 *outPredScale, u16 *outYn1, u16 *outYn2,
|
||||
u32 offset, void *dataAddr,
|
||||
u32 offset, const void *dataAddr,
|
||||
AdpcmParam const &adpcmParam)
|
||||
{
|
||||
AXPBADPCM adpcm;
|
||||
|
||||
+66
-20
@@ -136,6 +136,9 @@ void Voice::InitParam(int channelCount, int voiceOutCount, Callback *callback,
|
||||
for (int i = 0; i < AUX_BUS_NUM; i++)
|
||||
mFxSend[i] = 0.0f;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
mRemoteOutVolume[i] = 1.0f;
|
||||
|
||||
mPitch = 1.0f;
|
||||
mRemoteFilter = 0;
|
||||
mPanMode = PAN_MODE_DUAL;
|
||||
@@ -417,7 +420,7 @@ void Voice::Setup(WaveInfo const &waveParam, u32 startOffset)
|
||||
&waveParam.channelParam[channelIndex].adpcmLoopParam);
|
||||
}
|
||||
|
||||
axVoice->SetSrcType(AxVoice::SRC_4TAP_AUTO, mPitch);
|
||||
axVoice->SetSrcType(AxManager::GetInstance().GetSrcType(), mPitch);
|
||||
axVoice->SetVoiceType(AxVoice::VOICE_TYPE_NORMAL);
|
||||
}
|
||||
}
|
||||
@@ -486,7 +489,8 @@ SampleFormat Voice::GetFormat() const
|
||||
|
||||
void Voice::SetVolume(f32 volume)
|
||||
{
|
||||
volume = ut::Clamp(volume, VOLUME_MIN, VOLUME_MAX);
|
||||
if (volume < 0.0f)
|
||||
volume = 0.0f;
|
||||
|
||||
if (volume != mVolume)
|
||||
{
|
||||
@@ -498,8 +502,10 @@ void Voice::SetVolume(f32 volume)
|
||||
|
||||
void Voice::SetVeVolume(f32 targetVolume, f32 initVolume)
|
||||
{
|
||||
targetVolume = ut::Clamp(targetVolume, VOLUME_MIN, VOLUME_MAX);
|
||||
initVolume = ut::Clamp(initVolume, VOLUME_MIN, VOLUME_MAX);
|
||||
if (targetVolume < 0.0f)
|
||||
targetVolume = 0.0f;
|
||||
if (initVolume < 0.0f)
|
||||
initVolume = 0.0f;
|
||||
|
||||
if (initVolume < 0.0f)
|
||||
{
|
||||
@@ -632,7 +638,8 @@ void Voice::SetOutputLine(int lineFlag)
|
||||
|
||||
void Voice::SetMainOutVolume(f32 volume)
|
||||
{
|
||||
volume = ut::Clamp(volume, VOLUME_MIN, VOLUME_MAX);
|
||||
if (volume < 0.0f)
|
||||
volume = 0.0f;
|
||||
|
||||
if (volume != mMainOutVolume)
|
||||
{
|
||||
@@ -645,7 +652,8 @@ void Voice::SetMainOutVolume(f32 volume)
|
||||
void Voice::SetMainSend(f32 send)
|
||||
{
|
||||
send += 1.0f;
|
||||
send = ut::Clamp(send, SEND_MIN, SEND_MAX);
|
||||
if (send < SEND_MIN)
|
||||
send = SEND_MIN;
|
||||
|
||||
if (send != mMainSend)
|
||||
{
|
||||
@@ -660,7 +668,8 @@ void Voice::SetFxSend(AuxBus bus, f32 send)
|
||||
// specifically not the source variant
|
||||
NW4RAssertHeaderClampedLValue_Line(748, bus, 0, AUX_BUS_NUM);
|
||||
|
||||
send = ut::Clamp(send, SEND_MIN, SEND_MAX);
|
||||
if (send < SEND_MIN)
|
||||
send = SEND_MIN;
|
||||
|
||||
if (send != mFxSend[bus])
|
||||
{
|
||||
@@ -670,6 +679,18 @@ void Voice::SetFxSend(AuxBus bus, f32 send)
|
||||
}
|
||||
}
|
||||
|
||||
void Voice::SetRemoteOutVolume(int remote, f32 volume)
|
||||
{
|
||||
if (volume < 0.0f)
|
||||
volume = 0.0f;
|
||||
|
||||
if (mRemoteOutVolume[remote] == volume)
|
||||
return;
|
||||
|
||||
mRemoteOutVolume[remote] = volume;
|
||||
mSyncFlag |= UPDATE_MIX;
|
||||
}
|
||||
|
||||
void Voice::SetVoiceOutParam(int voiceOutIndex,
|
||||
VoiceOutParam const &voiceOutParam)
|
||||
{
|
||||
@@ -719,9 +740,10 @@ void Voice::UpdateVoicesPriority()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Voice::GetAxVoice ([R89JEL]:/bin/RVL/Debug/mainD.MAP:14824)
|
||||
DECOMP_FORCE(NW4RAssert_String(channelIndex < CHANNEL_MAX));
|
||||
#endif
|
||||
|
||||
void Voice::SetAdpcmLoop(int channelIndex, AdpcmLoopParam const *param)
|
||||
{
|
||||
@@ -839,7 +861,7 @@ bool Voice::CalcAxMix()
|
||||
/* The address is taken and the members are set, but the members aren't used
|
||||
* after that
|
||||
*/
|
||||
AxVoice::RemoteMixParam rmtmix ATTR_UNUSED;
|
||||
AxVoice::RemoteMixParam rmtmix;
|
||||
|
||||
for (int channelIndex = 0; channelIndex < mChannelCount; channelIndex++)
|
||||
{
|
||||
@@ -851,6 +873,12 @@ bool Voice::CalcAxMix()
|
||||
CalcMixParam(channelIndex, voiceOutIndex, &mix, &rmtmix);
|
||||
|
||||
nextUpdateFlag |= axVoice->SetMix(mix);
|
||||
if (mOutputLineFlag == 0 || mOutputLineFlag == 1) {
|
||||
axVoice->EnableRemote(false);
|
||||
} else {
|
||||
axVoice->EnableRemote(true);
|
||||
axVoice->SetRmtMix(rmtmix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1054,17 +1082,31 @@ void Voice::CalcMixParam(int channelIndex, int voiceOutIndex,
|
||||
mainVolume = mMainOutVolume;
|
||||
mainSend = mMainSend;
|
||||
|
||||
fxSendA =
|
||||
ut::Clamp(mFxSend[AUX_A] + mVoiceOutParam[voiceOutIndex].fxSend,
|
||||
SEND_MIN, SEND_MAX);
|
||||
fxSendA = mFxSend[AUX_A] + mVoiceOutParam[voiceOutIndex].fxSend;
|
||||
if (fxSendA < SEND_MIN) {
|
||||
fxSendA = SEND_MIN;
|
||||
}
|
||||
fxSendB = mFxSend[AUX_B];
|
||||
fxSendC = mFxSend[AUX_C];
|
||||
}
|
||||
|
||||
f32 main = mainVolume * mainSend;
|
||||
f32 fx_a = mainVolume * fxSendA;
|
||||
f32 fx_b = mainVolume * fxSendB;
|
||||
f32 fx_c = mainVolume * fxSendC;
|
||||
f32 main = mainVolume * nw4r::ut::Clamp(mainSend, 0.0f, 1.0f);
|
||||
f32 fx_a = mainVolume * nw4r::ut::Clamp(fxSendA, 0.0f, 1.0f);
|
||||
f32 fx_b = mainVolume * nw4r::ut::Clamp(fxSendB, 0.0f, 1.0f);
|
||||
f32 fx_c = mainVolume * nw4r::ut::Clamp(fxSendC, 0.0f, 1.0f);
|
||||
|
||||
f32 remoteOutVolumeOrig[4];
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (mOutputLineFlag & (2 << i))
|
||||
{
|
||||
remoteOutVolumeOrig[i] = mRemoteOutVolume[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
remoteOutVolumeOrig[i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
f32 left, right, surround, lrMixed;
|
||||
f32 front, rear;
|
||||
@@ -1302,6 +1344,10 @@ void Voice::CalcMixParam(int channelIndex, int voiceOutIndex,
|
||||
break;
|
||||
}
|
||||
|
||||
f32 remoteOutVolume[4];
|
||||
for (int i = 0; i < 4; i++)
|
||||
remoteOutVolume[i] = lrMixed * remoteOutVolumeOrig[i];
|
||||
|
||||
mix->vL = CalcMixVolume(m_l);
|
||||
mix->vR = CalcMixVolume(m_r);
|
||||
mix->vS = CalcMixVolume(m_s);
|
||||
@@ -1315,13 +1361,13 @@ void Voice::CalcMixParam(int channelIndex, int voiceOutIndex,
|
||||
mix->vAuxCR = CalcMixVolume(c_r);
|
||||
mix->vAuxCS = CalcMixVolume(c_s);
|
||||
|
||||
rmtmix->vMain0 = 0;
|
||||
rmtmix->vMain0 = CalcMixVolume(remoteOutVolume[0]);
|
||||
rmtmix->vAux0 = 0;
|
||||
rmtmix->vMain1 = 0;
|
||||
rmtmix->vMain1 = CalcMixVolume(remoteOutVolume[1]);
|
||||
rmtmix->vAux1 = 0;
|
||||
rmtmix->vMain2 = 0;
|
||||
rmtmix->vMain2 = CalcMixVolume(remoteOutVolume[2]);
|
||||
rmtmix->vAux2 = 0;
|
||||
rmtmix->vMain3 = 0;
|
||||
rmtmix->vMain3 = CalcMixVolume(remoteOutVolume[3]);
|
||||
rmtmix->vAux3 = 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user