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 <nw4r/snd.h>
5#include <nw4r/math.h>
6
7/// @file
8
9/// @ingroup bases
10
12 u32 mNumHandles;
13 u32 mRemotePlayer;
14 void * mSnd2DCalc; // TODO: Snd2DCalc *
15 u32 mObjType;
16};
17
18template<int T>
20public:
21 virtual void startSound(unsigned long, const nw4r::math::VEC2 &, unsigned long);
22};
23
24class SndObjctCmnEmy : public NMSndObject<4> {
25public:
26 virtual void startSound(unsigned long, const nw4r::math::VEC2 &, unsigned long);
27};
28
29class SndObjctCmnMap : public NMSndObject<4> {
30public:
31 virtual void startSound(unsigned long, const nw4r::math::VEC2 &, unsigned long);
32};
33
34namespace dAudio {
35 void requestStartScene(ProfileName sceneProf); ///< Sets up game audio for the given scene.
36 void prepareSceneSnd(); ///< @unofficial
37 void destroySceneSnd(); ///< @unofficial
38 void setNextScene(ProfileName prof, unsigned long bgmIndex);
39 void pauseOffGameWithReset(); ///< @unofficial
40
41 int getRemotePlayer(int);
42 mVec2_c cvtSndObjctPos(const mVec3_c &);
43
45 public:
46 void startSound(unsigned long soundID, const nw4r::math::VEC2 &pos, int remPlayer) {
47 SndObjctCmnEmy::startSound(soundID, pos, remPlayer);
48 }
49 void startSound(unsigned long soundID, const mVec3_c &pos, int remPlayer) {
50 SndObjctCmnEmy::startSound(soundID, dAudio::cvtSndObjctPos(pos), remPlayer);
51 }
52 };
53
55 public:
56 void startSound(unsigned long soundID, const nw4r::math::VEC2 &pos, int remPlayer) {
57 SndObjctCmnMap::startSound(soundID, pos, remPlayer);
58 }
59 void startSound(unsigned long soundID, const mVec3_c &pos, int remPlayer) {
60 SndObjctCmnMap::startSound(soundID, dAudio::cvtSndObjctPos(pos), remPlayer);
61 }
62 };
63
64 extern SndObjctCmnEmy_c *g_pSndObjEmy;
65 extern SndObjctCmnMap_c *g_pSndObjMap;
66
67 /// @unofficial
68 class SoundEffectID_t {
69 public:
70 SoundEffectID_t(u32 soundID) : id(soundID) {}
71
72 operator u32() const {
73 return id;
74 }
75
76 template<class T>
77 void playObjSound(T *obj, const mVec3_c &pos, int playerNo) const {
78 obj->startSound(id, dAudio::cvtSndObjctPos(pos), playerNo);
79 }
80
81 void playEmySound(const mVec3_c &pos, int playerNo) const {
82 playObjSound(dAudio::g_pSndObjEmy, pos, playerNo);
83 }
84
85 void playMapSound(const mVec3_c &pos, int playerNo) const {
86 playObjSound(dAudio::g_pSndObjMap, pos, playerNo);
87 }
88
89 private:
90 u32 id;
91 };
92};
A two-dimensional floating point vector.
Definition m_vec.hpp:9
A three-dimensional floating point vector.
Definition m_vec.hpp:100
void requestStartScene(ProfileName sceneProf)
Sets up game audio for the given scene.
void destroySceneSnd()
void prepareSceneSnd()
void pauseOffGameWithReset()
u16 ProfileName
The name of a profile. Value is a fProfile::PROFILE_NAME_e.
Definition f_profile.hpp:32