mirror of
https://github.com/zeldaret/ss
synced 2026-08-19 05:51:59 -04:00
Import of more nw4r::snd from https://github.com/kiwi515/ogws
Co-authored-by: kiwi515 <49212064+kiwi515@users.noreply.github.com>
This commit is contained in:
@@ -102,12 +102,18 @@ namespace nw4r { namespace snd { namespace detail
|
||||
void SetMasterVolume(f32 volume, int frame);
|
||||
void PrepareReset();
|
||||
|
||||
bool IsResetReady() const {
|
||||
return mResetReadyCounter == 0;
|
||||
}
|
||||
|
||||
private:
|
||||
// cdtors
|
||||
AxManager();
|
||||
|
||||
// callbacks
|
||||
static void AxCallbackFunc();
|
||||
static void AuxCallbackFunc(void* pChans, void* pContext);
|
||||
static void AiDmaCallbackFunc();
|
||||
|
||||
// static members
|
||||
private:
|
||||
@@ -140,7 +146,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
MoveValue<f32, int> mMasterVolume; // size 0x10, offset 0x1c
|
||||
MoveValue<f32, int> mMainOutVolume; // size 0x10, offset 0x2c
|
||||
MoveValue<f32, int> mVolumeForReset; // size 0x10, offset 0x3c
|
||||
AIDMACallback *mOldAidCallback; // size 0x04, offset 0x4c
|
||||
AIDMACallback mOldAidCallback; // size 0x04, offset 0x4c
|
||||
s32 mResetReadyCounter; // size 0x04, offset 0x50
|
||||
MoveValue<f32, int> mAuxFadeVolume[AUX_BUS_NUM]; // size 0x30, offset 0x54
|
||||
MoveValue<f32, int> mAuxUserVolume[AUX_BUS_NUM]; // size 0x30, offset 0x84
|
||||
|
||||
@@ -47,6 +47,9 @@ namespace nw4r { namespace snd { namespace detail
|
||||
// static members
|
||||
public:
|
||||
static int const VOICE_COUNT_MARGIN = 16;
|
||||
static const int VOICE_MARGIN = 16;
|
||||
static const int VOICE_MAX = AX_VOICE_MAX + VOICE_MARGIN;
|
||||
static const int WORK_SIZE_MAX = VOICE_MAX * sizeof(AxVoice);
|
||||
|
||||
// members
|
||||
private:
|
||||
|
||||
@@ -156,6 +156,13 @@ namespace nw4r { namespace snd { namespace detail
|
||||
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x276d8
|
||||
class AmbientParamUpdateCallback
|
||||
{
|
||||
public:
|
||||
enum ParamUpdateFlags {
|
||||
PARAM_UPDATE_VOLUME = (1 << 0),
|
||||
PARAM_UPDATE_PAN = (1 << 1),
|
||||
PARAM_UPDATE_SURROUND_PAN = (1 << 2),
|
||||
PARAM_UPDATE_PRIORITY = (1 << 3),
|
||||
};
|
||||
// methods
|
||||
public:
|
||||
virtual void at_0x08();
|
||||
|
||||
@@ -242,6 +242,10 @@ namespace nw4r { namespace snd { namespace detail
|
||||
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2b895c
|
||||
class ChannelManager
|
||||
{
|
||||
public:
|
||||
static const int VOICE_MARGIN = 1;
|
||||
static const int VOICE_MAX = AX_VOICE_MAX + VOICE_MARGIN;
|
||||
static const int WORK_SIZE_MAX = VOICE_MAX * sizeof(Channel);
|
||||
// methods
|
||||
public:
|
||||
// instance accessors
|
||||
|
||||
@@ -9,38 +9,6 @@ namespace nw4r {
|
||||
namespace snd {
|
||||
namespace detail {
|
||||
|
||||
class ChannelManager {
|
||||
friend class Channel; // Alloc/Free intended through Channel only
|
||||
|
||||
public:
|
||||
static const int VOICE_MARGIN = 1;
|
||||
static const int VOICE_MAX = AX_VOICE_MAX + VOICE_MARGIN;
|
||||
static const int WORK_SIZE_MAX = VOICE_MAX * sizeof(Channel);
|
||||
|
||||
public:
|
||||
static ChannelManager &GetInstance();
|
||||
|
||||
u32 GetRequiredMemSize();
|
||||
|
||||
void Setup(void *pWork, u32 workSize);
|
||||
void Shutdown();
|
||||
void UpdateAllChannel();
|
||||
|
||||
private:
|
||||
ChannelManager();
|
||||
|
||||
Channel *Alloc();
|
||||
void Free(Channel *pChannel);
|
||||
|
||||
private:
|
||||
InstancePool<Channel> mPool; // at 0x0
|
||||
ChannelList mChannelList; // at 0x4
|
||||
bool mInitialized; // at 0x10
|
||||
u32 mChannelCount; // at 0x14
|
||||
void *mMem; // at 0x18
|
||||
u32 mMemSize; // at 0x1C
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace snd
|
||||
} // namespace nw4r
|
||||
|
||||
@@ -70,29 +70,6 @@ namespace nw4r { namespace snd
|
||||
DVDFileInfo mFileInfo; // at 0x14C
|
||||
bool mOpen; // at 0x188
|
||||
};
|
||||
|
||||
class DvdSoundArchive::DvdFileStream : public ut::FileStream
|
||||
{
|
||||
DvdFileStream();
|
||||
virtual ut::detail::RuntimeTypeInfo const *GetRuntimeTypeInfo() const { return 0; }
|
||||
virtual void Close() {}
|
||||
virtual s32 Read(void *, u32) { return 0; }
|
||||
virtual bool IsBusy() const { return 0; }
|
||||
virtual bool CanAsync() const { return 0; }
|
||||
virtual bool CanRead() const { return 0; }
|
||||
virtual bool CanWrite() const { return 0; }
|
||||
virtual u32 GetOffsetAlign() const { return 0; }
|
||||
virtual u32 GetSizeAlign() const { return 0; }
|
||||
virtual u32 GetBufferAlign() const { return 0; }
|
||||
virtual u32 GetSize() const { return 0; }
|
||||
virtual void Seek(s32, u32) {}
|
||||
virtual void Cancel() {}
|
||||
virtual bool CancelAsync(StreamCallback *, void *) { return 0; }
|
||||
virtual bool CanSeek() const { return 0; }
|
||||
virtual bool CanCancel() const { return 0; }
|
||||
virtual u32 Tell() const { return 0; }
|
||||
friend class DvdSoundArchive;
|
||||
};
|
||||
}} // namespace nw4r::snd
|
||||
|
||||
#endif // NW4R_SND_DVD_SOUND_ARCHIVE_H
|
||||
|
||||
@@ -19,8 +19,11 @@ namespace nw4r { namespace snd { namespace detail
|
||||
// methods
|
||||
public:
|
||||
// methods
|
||||
ExternalSoundPlayer();
|
||||
~ExternalSoundPlayer();
|
||||
int GetPlayingSoundCount() const { return mSoundList.GetSize(); }
|
||||
int GetPlayableSoundCount() const { return mPlayableCount; }
|
||||
void SetPlayableSoundCount(int count);
|
||||
|
||||
bool AppendSound(BasicSound *sound);
|
||||
void RemoveSound(BasicSound *sound);
|
||||
|
||||
@@ -76,17 +76,17 @@ private:
|
||||
bool mFirstEncodeFlag; // at 0x3
|
||||
bool mValidCallbackFlag; // at 0x4
|
||||
bool mCommandBusyFlag; // at 0x5
|
||||
bool mForceResumeFlag; // at 0x6
|
||||
bool mContinueFlag; // at 0x7
|
||||
// TODO commenting out a random flag to make eggAudioRmtSpeakerMgr match
|
||||
// TODO offsets are wrong as a result
|
||||
// volatile bool mIntervalFlag; // at 0x8
|
||||
// bool mForceResumeFlag; // at 0x6
|
||||
bool mContinueFlag; // at 0x7
|
||||
volatile bool mIntervalFlag; // at 0x8
|
||||
SpeakerState mState; // at 0xC
|
||||
SpeakerCommand mUserCommand; // at 0x10
|
||||
SpeakerCommand mInternalCommand; // at 0x14
|
||||
WENCInfo mEncodeInfo; // at 0x18
|
||||
int mChannelIndex; // at 0x38
|
||||
WPADCallback mWpadCallback; // at 0x3C
|
||||
WPADCallback *mWpadCallback; // at 0x3C
|
||||
OSAlarm mContinueAlarm; // at 0x40
|
||||
OSAlarm mIntervalAlarm; // at 0x70
|
||||
s64 mContinueBeginTime; // at 0xA0
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
private:
|
||||
static const int SPEAKER_ALARM_HZ = 150;
|
||||
|
||||
// static const int SPEAKER_ALARM_PERIOD_NSEC = 1.0f / SPEAKER_ALARM_HZ * 1000 * 1000 * 1000;
|
||||
static const int SPEAKER_ALARM_PERIOD_NSEC = static_cast<int>(1.0f / SPEAKER_ALARM_HZ * 1000 * 1000 * 1000);
|
||||
|
||||
private:
|
||||
RemoteSpeakerManager();
|
||||
|
||||
@@ -128,6 +128,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
SeqTrack *GetPlayerTrack(int trackNo);
|
||||
s16 volatile *GetVariablePtr(int varNo);
|
||||
|
||||
void SetTempoRatio(f32 tempo);
|
||||
void SetReleasePriorityFix(bool fix);
|
||||
void SetChannelPriority(int priority);
|
||||
void SetSeqUserprocCallback(SeqUserprocCallback *callback, void *arg);
|
||||
|
||||
@@ -108,6 +108,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
s32 GetFileStreamBufferSize() { return sizeof mFileStreamBuffer; }
|
||||
|
||||
void SetReleasePriorityFix(bool fix);
|
||||
void SetTempoRatio(f32 tempo);
|
||||
void SetChannelPriority(int priority);
|
||||
void SetSeqUserprocCallback(SeqPlayer::SeqUserprocCallback *callback,
|
||||
void *arg);
|
||||
|
||||
@@ -15,7 +15,7 @@ class Sound3DManager : public detail::BasicSound::AmbientInfo::AmbientParamUpdat
|
||||
public:
|
||||
struct Sound3DActorParam {
|
||||
u32 userParam; // at 0x0
|
||||
SoundParam soundParam; // at 0x4
|
||||
SoundArchive::Sound3DParam soundParam; // at 0x4
|
||||
math::VEC3 position; // at 0xC
|
||||
|
||||
Sound3DActorParam();
|
||||
|
||||
@@ -119,6 +119,12 @@ namespace nw4r { namespace snd
|
||||
/* 3 bytes padding */
|
||||
}; // size 0x0c
|
||||
|
||||
struct Sound3DParam {
|
||||
u32 flags; // at 0x0
|
||||
u8 decayCurve; // at 0x4
|
||||
u8 decayRatio; // at 0x5
|
||||
};
|
||||
|
||||
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x256dc
|
||||
struct SoundArchivePlayerInfo
|
||||
{
|
||||
@@ -170,7 +176,11 @@ namespace nw4r { namespace snd
|
||||
bool IsAvailable() const;
|
||||
SoundType GetSoundType(u32 soundId) const;
|
||||
|
||||
const char* GetSoundLabelString(u32 id) const;
|
||||
u32 ConvertLabelStringToSoundId(char const *label) const;
|
||||
u32 ConvertLabelStringToPlayerId(const char* pLabel) const;
|
||||
u32 ConvertLabelStringToGroupId(const char* pLabel) const;
|
||||
u32 GetSoundUserParam(u32 id) const;
|
||||
|
||||
bool ReadSoundInfo(u32 soundId, SoundInfo *info) const;
|
||||
bool ReadSeqSoundInfo(u32 soundId, SeqSoundInfo *info) const;
|
||||
@@ -192,6 +202,12 @@ namespace nw4r { namespace snd
|
||||
|
||||
ut::FileStream *detail_OpenFileStream(u32 fileId, void *buffer,
|
||||
int size) const;
|
||||
ut::FileStream* detail_OpenGroupStream(u32 id, void* pBuffer,
|
||||
int bufferSize) const;
|
||||
ut::FileStream* detail_OpenGroupWaveDataStream(u32 id, void* pBuffer,
|
||||
int bufferSize) const;
|
||||
|
||||
void SetExternalFileRoot(const char* pExtFileRoot);
|
||||
|
||||
private:
|
||||
ut::FileStream *OpenExtStreamImpl(void *buffer, int size,
|
||||
|
||||
@@ -35,6 +35,8 @@ namespace nw4r { namespace snd { namespace detail
|
||||
u32 fileImageSize; // size 0x04, offset 0x24
|
||||
}; // size 0x28
|
||||
|
||||
static const int HEADER_AREA_SIZE = ROUND_UP(sizeof(Header), 32) + 40;
|
||||
|
||||
/* SymbolBlock */
|
||||
|
||||
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x24881
|
||||
@@ -332,9 +334,17 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
u32 ConvertLabelStringToId(SoundArchiveFile::StringTree const *tree,
|
||||
char const *str) const;
|
||||
u32 ConvertLabelStringToSoundId(char const *label) const
|
||||
{
|
||||
return ConvertLabelStringToId(mStringTreeSound, label);
|
||||
const char* GetSoundLabelString(u32 id) const;
|
||||
u32 GetSoundUserParam(u32 id) const;
|
||||
|
||||
u32 ConvertLabelStringToSoundId(const char* pLabel) const {
|
||||
return ConvertLabelStringToId(mStringTreeSound, pLabel);
|
||||
}
|
||||
u32 ConvertLabelStringToPlayerId(const char* pLabel) const {
|
||||
return ConvertLabelStringToId(mStringTreePlayer, pLabel);
|
||||
}
|
||||
u32 ConvertLabelStringToGroupId(const char* pLabel) const {
|
||||
return ConvertLabelStringToId(mStringTreeGroup, pLabel);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -184,7 +184,9 @@ namespace nw4r { namespace snd
|
||||
u32 GetRequiredMemSize(SoundArchive const *arc);
|
||||
u32 GetRequiredStrmBufferSize(SoundArchive const *arc);
|
||||
void const *GetGroupAddress(u32 groupId) const;
|
||||
void SetGroupAddress(u32 id, const void* pAddr);
|
||||
void const *GetGroupWaveDataAddress(u32 groupId) const;
|
||||
void SetGroupWaveDataAddress(u32 id, const void* pAddr);
|
||||
void const *GetFileAddress(u32 fileId) const;
|
||||
void const *GetFileWaveDataAddress(u32 fileId) const;
|
||||
void const *detail_GetFileAddress(u32 fileId) const;
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace nw4r { namespace snd
|
||||
~SoundHandle() { DetachSound(); }
|
||||
|
||||
// methods
|
||||
void detail_AttachSoundAsTempHandle(detail::BasicSound* pSound);
|
||||
void detail_AttachSound(detail::BasicSound *sound);
|
||||
bool IsAttachedSound() const { return mSound != nullptr; }
|
||||
detail::BasicSound *detail_GetAttachedSound() { return mSound; }
|
||||
|
||||
@@ -42,6 +42,17 @@ namespace nw4r { namespace snd { namespace detail
|
||||
CALLBACK_STATUS_DROP_DSP,
|
||||
};
|
||||
|
||||
enum VoiceSyncFlag {
|
||||
SYNC_AX_SRC_INITIAL = (1 << 0),
|
||||
SYNC_AX_VOICE = (1 << 1),
|
||||
SYNC_AX_SRC = (1 << 2),
|
||||
SYNC_AX_VE = (1 << 3),
|
||||
SYNC_AX_MIX = (1 << 4),
|
||||
SYNC_AX_LPF = (1 << 5),
|
||||
SYNC_AX_REMOTE = (1 << 7),
|
||||
SYNC_AX_BIQUAD = (1 << 8),
|
||||
};
|
||||
|
||||
// typedefs
|
||||
public:
|
||||
typedef ut::LinkList<Voice, 0xec> LinkList;
|
||||
|
||||
@@ -18,6 +18,9 @@ namespace nw4r { namespace snd { namespace detail
|
||||
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2ffb36
|
||||
class VoiceManager
|
||||
{
|
||||
public:
|
||||
static const int VOICE_MAX = AX_VOICE_MAX;
|
||||
static const int WORK_SIZE_MAX = VOICE_MAX * sizeof(Voice);
|
||||
// methods
|
||||
public:
|
||||
// instance accessors
|
||||
|
||||
@@ -17,6 +17,27 @@ extern "C" {
|
||||
#define AX_SAMPLES_PER_FRAME_RMT 18
|
||||
#define AX_FRAME_SIZE (AX_SAMPLES_PER_FRAME * AX_SAMPLE_DEPTH_BYTES)
|
||||
|
||||
/**
|
||||
* Stereo: Left, Right, Surround
|
||||
* DPL2: Left, Right, Left Surround, Right Surround
|
||||
*/
|
||||
typedef enum {
|
||||
AX_STEREO_L,
|
||||
AX_STEREO_R,
|
||||
AX_STEREO_S,
|
||||
|
||||
AX_STEREO_MAX
|
||||
} AXStereoChannel;
|
||||
|
||||
typedef enum {
|
||||
AX_DPL2_L,
|
||||
AX_DPL2_R,
|
||||
AX_DPL2_LS,
|
||||
AX_DPL2_RS,
|
||||
|
||||
AX_DPL2_MAX
|
||||
} AXDPL2Channel;
|
||||
|
||||
typedef void (*AXAuxCallback)(void *chans, void *context);
|
||||
|
||||
void __AXAuxInit(void);
|
||||
|
||||
@@ -32,8 +32,8 @@ enum WPADResult_et {
|
||||
WPAD_ERR_OK = 0,
|
||||
|
||||
WPAD_ERR_NO_CONTROLLER = -1, /* name known from asserts */
|
||||
WPAD_ERR_COMMUNICATION_ERROR = -2, // [RT3P54] has this as WPAD_ERR_BUSY
|
||||
WPAD_ERR_3 = -3, // [RT3P54] has this as WPAD_ERR_TRANSFER
|
||||
WPAD_ERR_BUSY = -2, // [RT3P54] has this as WPAD_ERR_BUSY
|
||||
WPAD_ERR_TRANSFER = -3, // [RT3P54] has this as WPAD_ERR_TRANSFER
|
||||
WPAD_ERR_INVALID = -4, /* name comes from [R89JEL] */
|
||||
// WPAD_ERR_5 = -5, /* unknown */
|
||||
// WPAD_ERR_6 = -6, /* unknown */
|
||||
@@ -260,8 +260,8 @@ enum WPADMotorCommand_et {
|
||||
// WPADControlSpeaker
|
||||
typedef u32 WPADSpeakerCommand;
|
||||
enum WPADSpeakerCommand_et {
|
||||
WPAD_SPEAKER_DISABLE = 0,
|
||||
WPAD_SPEAKER_ENABLE = 1, // might be ON? see HBMRemoteSpk.cpp
|
||||
WPAD_SPEAKER_OFF = 0,
|
||||
WPAD_SPEAKER_ON = 1, // might be ON? see HBMRemoteSpk.cpp
|
||||
WPAD_SPEAKER_MUTE = 2,
|
||||
WPAD_SPEAKER_UNMUTE = 3,
|
||||
WPAD_SPEAKER_PLAY = 4, // figured out from HBM usage
|
||||
|
||||
Reference in New Issue
Block a user