summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/SOUE01/splits.txt4
-rw-r--r--config/SOUE01/symbols.txt48
-rw-r--r--configure.py2
-rw-r--r--include/nw4r/snd/snd_StrmPlayer.h16
-rw-r--r--include/nw4r/snd/snd_Voice.h4
-rw-r--r--src/nw4r/snd/snd_StrmPlayer.cpp63
6 files changed, 109 insertions, 28 deletions
diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt
index fd954d27..02f9f13e 100644
--- a/config/SOUE01/splits.txt
+++ b/config/SOUE01/splits.txt
@@ -3090,6 +3090,10 @@ nw4r/snd/snd_StrmFile.cpp:
nw4r/snd/snd_StrmPlayer.cpp:
.text start:0x8047D8E0 end:0x80480588 align:16
+ .data start:0x8056E258 end:0x8056E2D0
+ .sbss start:0x805766C8 end:0x805766D0
+ .sdata2 start:0x8057F150 end:0x8057F178
+ .bss start:0x8066FA20 end:0x80673A38
nw4r/snd/snd_StrmSound.cpp:
.text start:0x80480590 end:0x80480D8C align:16
diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt
index 1c220bfd..9c6dfa3f 100644
--- a/config/SOUE01/symbols.txt
+++ b/config/SOUE01/symbols.txt
@@ -25649,8 +25649,8 @@ ReadStrmTrackInfo__Q44nw4r3snd6detail14StrmFileLoaderCFPQ54nw4r3snd6detail14Strm
ReadAdpcmInfo__Q44nw4r3snd6detail14StrmFileLoaderCFPQ34nw4r3snd10AdpcmParamPQ44nw4r3snd6detail14AdpcmLoopParami = .text:0x8047D5D0; // type:function size:0x14C
ReadAdpcBlockData__Q44nw4r3snd6detail14StrmFileLoaderFPUsPUsii = .text:0x8047D720; // type:function size:0x1B4
__ct__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x8047D8E0; // type:function size:0xF0
-__dt__Q54nw4r3snd6detail10StrmPlayer18StrmHeaderLoadTaskFv = .text:0x8047D9D0; // type:function size:0x58
-__dt__Q54nw4r3snd6detail10StrmPlayer16StrmDataLoadTaskFv = .text:0x8047DA30; // type:function size:0x58
+__dt__Q54nw4r3snd6detail10StrmPlayer18StrmHeaderLoadTaskFv = .text:0x8047D9D0; // type:function size:0x58 scope:weak
+__dt__Q54nw4r3snd6detail10StrmPlayer16StrmDataLoadTaskFv = .text:0x8047DA30; // type:function size:0x58 scope:weak
__dt__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x8047DA90; // type:function size:0x100
Setup__Q44nw4r3snd6detail10StrmPlayerFPQ44nw4r3snd6detail14StrmBufferPooliUsi = .text:0x8047DB90; // type:function size:0x218
Shutdown__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x8047DDB0; // type:function size:0x90
@@ -25685,16 +25685,16 @@ __ct__Q54nw4r3snd6detail10StrmPlayer16StrmDataLoadTaskFv = .text:0x80480290; //
Execute__Q54nw4r3snd6detail10StrmPlayer16StrmDataLoadTaskFv = .text:0x804802E0; // type:function size:0xD0
Cancel__Q54nw4r3snd6detail10StrmPlayer16StrmDataLoadTaskFv = .text:0x804803B0; // type:function size:0x8C
OnCancel__Q54nw4r3snd6detail10StrmPlayer16StrmDataLoadTaskFv = .text:0x80480440; // type:function size:0xA8
-OnUpdateFrameSoundThread__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x804804F0; // type:function size:0x4
-OnUpdateVoiceSoundThread__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x80480500; // type:function size:0x4
-OnShutdownSoundThread__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x80480510; // type:function size:0x10
-IsPause__Q44nw4r3snd6detail10StrmPlayerCFv = .text:0x80480520; // type:function size:0x8
-IsStarted__Q44nw4r3snd6detail10StrmPlayerCFv = .text:0x80480530; // type:function size:0x8
-IsActive__Q44nw4r3snd6detail10StrmPlayerCFv = .text:0x80480540; // type:function size:0x8
-@180@OnShutdownSoundThread__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x80480550; // type:function size:0x8
-@180@OnUpdateVoiceSoundThread__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x80480560; // type:function size:0x8
-@180@OnUpdateFrameSoundThread__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x80480570; // type:function size:0x8
-@180@__dt__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x80480580; // type:function size:0x8
+OnUpdateFrameSoundThread__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x804804F0; // type:function size:0x4 scope:weak
+OnUpdateVoiceSoundThread__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x80480500; // type:function size:0x4 scope:weak
+OnShutdownSoundThread__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x80480510; // type:function size:0x10 scope:weak
+IsPause__Q44nw4r3snd6detail10StrmPlayerCFv = .text:0x80480520; // type:function size:0x8 scope:weak
+IsStarted__Q44nw4r3snd6detail10StrmPlayerCFv = .text:0x80480530; // type:function size:0x8 scope:weak
+IsActive__Q44nw4r3snd6detail10StrmPlayerCFv = .text:0x80480540; // type:function size:0x8 scope:weak
+@180@OnShutdownSoundThread__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x80480550; // type:function size:0x8 scope:weak
+@180@OnUpdateVoiceSoundThread__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x80480560; // type:function size:0x8 scope:weak
+@180@OnUpdateFrameSoundThread__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x80480570; // type:function size:0x8 scope:weak
+@180@__dt__Q44nw4r3snd6detail10StrmPlayerFv = .text:0x80480580; // type:function size:0x8 scope:weak
__ct__Q44nw4r3snd6detail9StrmSoundFPQ44nw4r3snd6detail50SoundInstanceManager<Q44nw4r3snd6detail9StrmSound>ii = .text:0x80480590; // type:function size:0xB4
InitParam__Q44nw4r3snd6detail9StrmSoundFv = .text:0x80480650; // type:function size:0x138
Setup__Q44nw4r3snd6detail9StrmSoundFPQ44nw4r3snd6detail14StrmBufferPooliUs = .text:0x80480790; // type:function size:0x7C
@@ -38619,9 +38619,9 @@ WSDCallback = .data:0x8056E1E0; // type:object size:0x10
SeqCallback = .data:0x8056E1F0; // type:object size:0x10
__vt__Q34nw4r3snd9SoundHeap = .data:0x8056E200; // type:object size:0x10
lbl_8056E210 = .data:0x8056E210; // type:object size:0x48
-lbl_8056E258 = .data:0x8056E258; // type:object size:0x48
-lbl_8056E2A0 = .data:0x8056E2A0; // type:object size:0x18
-lbl_8056E2B8 = .data:0x8056E2B8; // type:object size:0x18
+__vt__Q44nw4r3snd6detail10StrmPlayer = .data:0x8056E258; // type:object size:0x48
+__vt__Q54nw4r3snd6detail10StrmPlayer16StrmDataLoadTask = .data:0x8056E2A0; // type:object size:0x18
+__vt__Q54nw4r3snd6detail10StrmPlayer18StrmHeaderLoadTask = .data:0x8056E2B8; // type:object size:0x18
lbl_8056E2D0 = .data:0x8056E2D0; // type:object size:0x38
@5068 = .data:0x8056E308; // type:object size:0x24 scope:local
__vt__Q44nw4r3snd6detail5Voice = .data:0x8056E32C; // type:object size:0x14
@@ -42435,7 +42435,7 @@ lbl_805766B0 = .sbss:0x805766B0; // type:object size:0x8 data:byte
isSoundSystemInit = .sbss:0x805766B8; // type:object size:0x1 data:byte
lbl_805766BC = .sbss:0x805766BC; // type:object size:0x4 data:4byte
@GUARD@GetInstance__Q44nw4r3snd6detail11SoundThreadFv@instance = .sbss:0x805766C0; // type:object size:0x1 scope:weak data:byte
-lbl_805766C8 = .sbss:0x805766C8; // type:object size:0x8 data:byte
+sStaticInitFlag__Q44nw4r3snd6detail10StrmPlayer = .sbss:0x805766C8; // type:object size:0x1 data:byte
lbl_805766D0 = .sbss:0x805766D0; // type:object size:0x8 data:4byte
@GUARD@GetInstance__Q44nw4r3snd6detail11TaskManagerFv@instance = .sbss:0x805766D8; // type:object size:0x1 scope:weak data:byte
@GUARD@GetInstance__Q44nw4r3snd6detail12VoiceManagerFv@instance = .sbss:0x805766E0; // type:object size:0x1 scope:weak data:byte
@@ -49749,12 +49749,12 @@ lbl_8057F138 = .sdata2:0x8057F138; // type:object size:0x4 align:4 data:float
lbl_8057F140 = .sdata2:0x8057F140; // type:object size:0x8 align:8 data:double
lbl_8057F148 = .sdata2:0x8057F148; // type:object size:0x4 align:4 data:float
lbl_8057F14C = .sdata2:0x8057F14C; // type:object size:0x4 align:4 data:float
-lbl_8057F150 = .sdata2:0x8057F150; // type:object size:0x4 align:4 data:float
-lbl_8057F158 = .sdata2:0x8057F158; // type:object size:0x8 align:8 data:double
-lbl_8057F160 = .sdata2:0x8057F160; // type:object size:0x8 align:8 data:double
-lbl_8057F168 = .sdata2:0x8057F168; // type:object size:0x4 align:4 data:float
-lbl_8057F16C = .sdata2:0x8057F16C; // type:object size:0x4 align:4 data:float
-lbl_8057F170 = .sdata2:0x8057F170; // type:object size:0x4 align:4 data:float
+@5421 = .sdata2:0x8057F150; // type:object size:0x4 scope:local align:4 data:float
+@5423 = .sdata2:0x8057F158; // type:object size:0x8 scope:local align:8 data:double
+@5425 = .sdata2:0x8057F160; // type:object size:0x8 scope:local align:8 data:double
+@5492 = .sdata2:0x8057F168; // type:object size:0x4 scope:local align:4 data:float
+@5765 = .sdata2:0x8057F16C; // type:object size:0x4 scope:local align:4 data:float
+@5766 = .sdata2:0x8057F170; // type:object size:0x4 scope:local 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
@@ -51948,8 +51948,8 @@ lbl_80659D50 = .bss:0x80659D50; // type:object size:0x330
lbl_8065A080 = .bss:0x8065A080; // type:object size:0x155E0
@1941 = .bss:0x8066F660; // type:object size:0xC scope:local
@LOCAL@GetInstance__Q44nw4r3snd6detail11SoundThreadFv@instance = .bss:0x8066F670; // type:object size:0x398 scope:weak
-lbl_8066FA20 = .bss:0x8066FA20; // type:object size:0x4000 align:32
-lbl_80673A20 = .bss:0x80673A20; // type:object size:0x18
+sLoadBuffer__Q44nw4r3snd6detail10StrmPlayer = .bss:0x8066FA20; // type:object size:0x4000 align:32
+sLoadBufferMutex__Q44nw4r3snd6detail10StrmPlayer = .bss:0x80673A20; // type:object size:0x18
@886 = .bss:0x80673A38; // type:object size:0xC scope:local
@LOCAL@GetInstance__Q44nw4r3snd6detail11TaskManagerFv@instance = .bss:0x80673A44; // type:object size:0x3C scope:weak
@1109 = .bss:0x80673A80; // type:object size:0xC scope:local
diff --git a/configure.py b/configure.py
index fc0bf7de..28172939 100644
--- a/configure.py
+++ b/configure.py
@@ -1070,7 +1070,7 @@ config.libs = [
Object(Matching, "nw4r/snd/snd_SoundThread.cpp"),
Object(Matching, "nw4r/snd/snd_StrmChannel.cpp"),
Object(Matching, "nw4r/snd/snd_StrmFile.cpp"),
- Object(NonMatching, "nw4r/snd/snd_StrmPlayer.cpp"),
+ Object(Matching, "nw4r/snd/snd_StrmPlayer.cpp"),
Object(NonMatching, "nw4r/snd/snd_StrmSound.cpp"),
Object(NonMatching, "nw4r/snd/snd_StrmSoundHandle.cpp"),
Object(Matching, "nw4r/snd/snd_Task.cpp"),
diff --git a/include/nw4r/snd/snd_StrmPlayer.h b/include/nw4r/snd/snd_StrmPlayer.h
index aee8101e..a4889945 100644
--- a/include/nw4r/snd/snd_StrmPlayer.h
+++ b/include/nw4r/snd/snd_StrmPlayer.h
@@ -31,7 +31,17 @@ namespace nw4r { namespace ut { class FileStream; }}
* classes and functions
*/
-namespace nw4r { namespace snd { namespace detail
+namespace nw4r { namespace snd {
+
+struct StrmDataInfo
+{
+ /* 0x00 */ bool loopFlag;
+ /* 0x04 */ int sampleRate;
+ /* 0x08 */ u32 loopStart;
+ /* 0x0C */ u32 loopEnd;
+};
+
+namespace detail
{
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2fcda
class StrmPlayer : public BasicPlayer, public SoundThread::PlayerCallback
@@ -162,7 +172,9 @@ namespace nw4r { namespace snd { namespace detail
void SetAdpcmLoopContext(int channelNum, u16 *predScale);
void SetTrackVolume(u32 trackBitFlag, f32 volume);
+ u32 GetPlaySamplePosition() const;
+ bool ReadStrmDataInfo(StrmDataInfo*) const;
void InitParam();
bool SetupPlayer();
bool Prepare(ut::FileStream *fileStream,
@@ -221,7 +233,7 @@ namespace nw4r { namespace snd { namespace detail
/* base BasicPlayer */ // size 0x0a4, offset 0x000
/* base SoundThread::PlayerCallback */ // size 0x00c, offset 0x0a4
StrmFileReader::StrmInfo mStrmInfo; // size 0x040, offset 0x0b0
- bool mSetupFlag; // size 0x001, offset 0x0f0
+ bool volatile mSetupFlag; // size 0x001, offset 0x0f0
bool mActiveFlag; // size 0x001, offset 0x0f1
bool mStartedFlag; // size 0x001, offset 0x0f2
bool mPreparedFlag; // size 0x001, offset 0x0f3
diff --git a/include/nw4r/snd/snd_Voice.h b/include/nw4r/snd/snd_Voice.h
index 96cd4455..3c43d741 100644
--- a/include/nw4r/snd/snd_Voice.h
+++ b/include/nw4r/snd/snd_Voice.h
@@ -104,6 +104,10 @@ namespace nw4r { namespace snd { namespace detail
{
return IsActive() && mAxVoice[0][0]->IsPlayFinished();
}
+ bool IsRun() const
+ {
+ return IsActive() && mAxVoice[0][0]->IsRun();
+ }
SampleFormat GetFormat() const;
u32 GetCurrentPlayingSample() const;
int GetPhysicalVoiceCount() const
diff --git a/src/nw4r/snd/snd_StrmPlayer.cpp b/src/nw4r/snd/snd_StrmPlayer.cpp
index 0a6f74d1..6833aca5 100644
--- a/src/nw4r/snd/snd_StrmPlayer.cpp
+++ b/src/nw4r/snd/snd_StrmPlayer.cpp
@@ -48,7 +48,7 @@
namespace nw4r { namespace snd { namespace detail
{
// .bss
- byte_t StrmPlayer::sLoadBuffer[LOAD_BUFFER_SIZE];
+ byte_t ALIGN_DECL(32) StrmPlayer::sLoadBuffer[LOAD_BUFFER_SIZE];
OSMutex StrmPlayer::sLoadBufferMutex;
// .sbss
@@ -375,10 +375,61 @@ void StrmPlayer::Pause(bool flag)
UpdatePauseStatus();
}
+void float_order_snd_StrmPlayer() {
+ 0.0f;
+ int zero = 0;
+ unsigned uzero = 0;
+ f32 z = zero;
+ z = uzero;
+}
+#if 0
// Some functions in between idk
DECOMP_FORCE(0.0f);
DECOMP_FORCE(SI2D_CONSTANT);
DECOMP_FORCE(UI2D_CONSTANT);
+#endif
+
+bool StrmPlayer::ReadStrmDataInfo(StrmDataInfo* info) const
+{
+ SoundThread::AutoLock lock;
+
+ if (!mPreparedFlag)
+ return false;
+
+ info->loopFlag = mStrmInfo.loopFlag != 0;
+ info->sampleRate = mStrmInfo.sampleRate;
+ info->loopStart = mStrmInfo.loopStart;
+ info->loopEnd = mStrmInfo.loopEnd;
+
+ return true;
+}
+
+u32 StrmPlayer::GetPlaySamplePosition() const
+{
+ SoundThread::AutoLock lock;
+
+ if (!mActiveFlag)
+ return -1;
+
+ if (!mTracks[0].mActiveFlag)
+ return -1;
+
+ if (!mPreparedFlag)
+ return 0;
+
+ u32 sample = 0;
+ u32 t1;
+ {
+ ut::AutoInterruptLock lock2;
+
+ if (mTracks[0].mVoice)
+ sample = mTracks[0].mVoice->GetCurrentPlayingSample();
+
+ t1 = mPlayingDataBlockIndex - mPlayingBufferBlockIndex;
+ }
+ u32 t2 = t1 * mStrmInfo.blockSamples;
+ return t2 + sample;
+}
void StrmPlayer::InitParam()
{
@@ -836,6 +887,10 @@ void StrmPlayer::UpdateVoiceParams(StrmTrack *track)
fxsend[i] += GetFxSend(static_cast<AuxBus>(i));
}
+ f32 remoteOutVolume[4];
+ for (int i = 0; i < 4; i++)
+ remoteOutVolume[i] = GetRemoteOutVolume(i);
+
ut::AutoInterruptLock lock;
if (Voice *voice = track->mVoice)
@@ -857,6 +912,9 @@ void StrmPlayer::UpdateVoiceParams(StrmTrack *track)
voice->SetFxSend(bus, fxsend[i]);
}
+ for (int i = 0; i < 4; i++)
+ voice->SetRemoteOutVolume(i, remoteOutVolume[i]);
+
for (int i = 0; i < mVoiceOutCount; i++)
voice->SetVoiceOutParam(i, GetVoiceOutParam(i));
}
@@ -893,6 +951,9 @@ void StrmPlayer::UpdateBuffer()
if (!voice)
return;
+ if (!voice->IsRun())
+ return;
+
if (CheckDiskDriveError())
{
mLoadWaitFlag = true;