summaryrefslogtreecommitdiff
path: root/include/nw4r/snd/snd_RemoteSpeakerManager.h
blob: 2793637c1684a060c3cc23a460c733d74d1b1802 (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
#ifndef NW4R_SND_REMOTE_SPEAKER_MANAGER_H
#define NW4R_SND_REMOTE_SPEAKER_MANAGER_H
#include "nw4r/snd/snd_RemoteSpeaker.h"
#include "rvl/OS.h"   // IWYU pragma: export
#include "rvl/WPAD.h" // IWYU pragma: export


namespace nw4r {
namespace snd {
namespace detail {

class RemoteSpeakerManager {
public:
    static RemoteSpeakerManager &GetInstance();

    RemoteSpeaker &GetRemoteSpeaker(int i);

    void Setup();
    void Shutdown();

private:
    static const int SPEAKER_ALARM_HZ = 150;

    // commented out since it causes compiler warnings
    // static const int SPEAKER_ALARM_PERIOD_NSEC = static_cast<int>(1.0f / SPEAKER_ALARM_HZ * 1000 * 1000 * 1000);
    static const int SPEAKER_ALARM_PERIOD_NSEC = 6666667;
private:
    RemoteSpeakerManager();

    static void RemoteSpeakerAlarmProc(OSAlarm *pAlarm, OSContext *pCtx);

private:
    bool mInitialized;                            // at 0x0
    OSAlarm mRemoteSpeakerAlarm;                  // at 0x8
    RemoteSpeaker mSpeaker[WPAD_MAX_CONTROLLERS]; // at 0x38
};

} // namespace detail
} // namespace snd
} // namespace nw4r

#endif