summaryrefslogtreecommitdiff
path: root/include/d/snd/d_snd_mgr.h
blob: 75673e8e3a621fc3e49cbc81ca3d272a965bed84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef D_SND_MGR_H
#define D_SND_MGR_H

#include "common.h"
#include "egg/audio/eggAudioMgr.h"
#include "nw4r/snd/snd_SoundArchivePlayer.h"
#include "nw4r/snd/snd_global.h"

/** The core audio manager used for most sounds. */
class dSndMgr_c : public EGG::SimpleAudioMgr {
public:
    dSndMgr_c();

    virtual void calc() override;
    void setup(EGG::Heap *heap, u32 size);
    void initHbm(u32 frame);

    static void restoreEffectsCallback();

    static dSndMgr_c *GetInstance() {
        return sInstance;
    }

    static nw4r::snd::SoundArchivePlayer& getPlayer() {
        return *sInstance->ArcPlayer::getPlayer();
    }

    static const char *getSoundLabelString(u32 soundId) {
        const char *label = nullptr;
        if (sInstance->getArchive() != nullptr) {
            label = sInstance->getArchive()->GetSoundLabelString(soundId);
        }
        return label;
    }

    static u32 getPlayerId(u32 soundId) {
        nw4r::snd::SoundArchive::SoundInfo info;
        u32 playerId;
        if (!sInstance->getArchive()->ReadSoundInfo(soundId, &info)) {
            playerId = -1;
        } else {
            playerId = info.playerId;
        }
        return playerId;
    }

private:
    static dSndMgr_c *sInstance;

    /* 0x6C8 */ nw4r::snd::OutputMode mOutputMode;
    /* 0x6CC */ bool mIsInitialized;
};

#endif