NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_audio.hpp
Go to the documentation of this file.
1#pragma once
3#include <game/mLib/m_vec.hpp>
4#include <lib/egg/core/eggHeap.h>
5#include <nw4r/snd.h>
6#include <nw4r/math.h>
7
8/// @file
9
10/// @ingroup bases
11
13 u32 mNumHandles;
14 u32 mRemotePlayer;
15 void * mSnd2DCalc; // TODO: Snd2DCalc *
16 u32 mObjType;
17};
18
19template<int T>
21public:
22 virtual void startSound(unsigned long, const nw4r::math::VEC2 &, unsigned long);
23};
24
25class SndObjctCmnEmy : public NMSndObject<4> {
26public:
27 virtual void startSound(unsigned long, const nw4r::math::VEC2 &, unsigned long);
28};
29
30class SndObjctCmnMap : public NMSndObject<4> {
31public:
32 virtual void startSound(unsigned long, const nw4r::math::VEC2 &, unsigned long);
33};
34
35namespace dAudio {
36 void init(EGG::Heap *heap);
37 void execute();
38 void requestStartScene(ProfileName sceneProf); ///< Sets up game audio for the given scene.
39 void createSndObjctCmn();
40 void deleteSndObjctCmn();
41 void setNextScene(ProfileName prof, unsigned long bgmIndex);
42 void pauseOffGameWithReset(); ///< @unofficial
43 void boot();
44 void loadSceneSnd();
45 bool isLoadedSceneSnd();
46 void FUN_8006a6a0(bool); ///< @unofficial
47 void setMainBgmNo(int);
48 void setBgmMode(int);
49 void updateBgmInfo();
50
51 int getRemotePlayer(int);
52 mVec2_c cvtSndObjctPos(const mVec2_c &);
53 mVec2_c cvtSndObjctPos(const mVec3_c &);
54
56 public:
57 void startSound(unsigned long soundID, const nw4r::math::VEC2 &pos, int remPlayer) {
58 SndObjctCmnEmy::startSound(soundID, pos, remPlayer);
59 }
60 void startSound(unsigned long soundID, const mVec3_c &pos, int remPlayer) {
61 SndObjctCmnEmy::startSound(soundID, dAudio::cvtSndObjctPos(pos), remPlayer);
62 }
63 };
64
66 public:
67 void startSound(unsigned long soundID, const nw4r::math::VEC2 &pos, int remPlayer) {
68 SndObjctCmnMap::startSound(soundID, pos, remPlayer);
69 }
70 void startSound(unsigned long soundID, const mVec3_c &pos, int remPlayer) {
71 SndObjctCmnMap::startSound(soundID, dAudio::cvtSndObjctPos(pos), remPlayer);
72 }
73 };
74
75 extern SndObjctCmnEmy_c *g_pSndObjEmy;
76 extern SndObjctCmnMap_c *g_pSndObjMap;
77
78 /// @unofficial
79 class SoundEffectID_t {
80 public:
81 SoundEffectID_t(u32 soundID) : id(soundID) {}
82
83 operator u32() const {
84 return id;
85 }
86
87 template<class T>
88 void playObjSound(T *obj, const mVec2_c &pos, int playerNo) const {
89 obj->startSound(id, dAudio::cvtSndObjctPos(pos), playerNo);
90 }
91
92 template<class T>
93 void playObjSound(T *obj, const mVec3_c &pos, int playerNo) const {
94 obj->startSound(id, dAudio::cvtSndObjctPos(pos), playerNo);
95 }
96
97 void playEmySound(const mVec2_c &pos, int playerNo) const {
98 playObjSound(dAudio::g_pSndObjEmy, pos, playerNo);
99 }
100
101 void playEmySound(const mVec3_c &pos, int playerNo) const {
102 playObjSound(dAudio::g_pSndObjEmy, pos, playerNo);
103 }
104
105 void playMapSound(const mVec2_c &pos, int playerNo) const {
106 playObjSound(dAudio::g_pSndObjMap, pos, playerNo);
107 }
108
109 void playMapSound(const mVec3_c &pos, int playerNo) const {
110 playObjSound(dAudio::g_pSndObjMap, pos, playerNo);
111 }
112
113 private:
114 u32 id;
115 };
116};
A two-dimensional floating point vector.
Definition m_vec.hpp:16
A three-dimensional floating point vector.
Definition m_vec.hpp:112
void requestStartScene(ProfileName sceneProf)
Sets up game audio for the given scene.
void FUN_8006a6a0(bool)
void pauseOffGameWithReset()
u16 ProfileName
The name of a profile. Value is a fProfile::PROFILE_NAME_e.
Definition f_profile.hpp:32