summaryrefslogtreecommitdiff
path: root/include/nw4r/snd/snd_SoundSystem.h
blob: 3a376d0e1e537395431748d0282b7dcea191fb02 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#ifndef NW4R_SND_SOUND_SYSTEM_H
#define NW4R_SND_SOUND_SYSTEM_H

/*******************************************************************************
 * headers
 */

#include "common.h"
#include "nw4r/snd/snd_AxManager.h"
#include "nw4r/snd/snd_RemoteSpeaker.h"
#include "nw4r/snd/snd_RemoteSpeakerManager.h"

/*******************************************************************************
 * classes and functions
 */

// forward declarations
namespace nw4r { namespace snd { namespace detail { class TaskThread; }}}

namespace nw4r { namespace snd
{
	// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x4bd66
	class SoundSystem
	{
	// nested types
	public:
		// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x4bc73
		struct SoundSystemParam
		{
		// methods
		public:
			// cdtors
			SoundSystemParam() :
				soundThreadPriority		(DEFAULT_SOUND_THREAD_PRIORITY),
				soundThreadStackSize	(DEFAULT_SOUND_THREAD_STACK_SIZE),
				dvdThreadPriority		(DEFAULT_DVD_THREAD_PRIORITY),
				dvdThreadStackSize		(DEFAULT_DVD_THREAD_STACK_SIZE)
			{
			}

		// members
		public:
			s32	soundThreadPriority;	// size 0x04, offset 0x00
			u32	soundThreadStackSize;	// size 0x04, offset 0x04
			s32	dvdThreadPriority;		// size 0x04, offset 0x08
			u32	dvdThreadStackSize;		// size 0x04, offset 0x0c
		}; // size 0x10

	// static members
	private:
		static int const DEFAULT_DVD_THREAD_STACK_SIZE = 0x4000;
		static int const DEFAULT_SOUND_THREAD_STACK_SIZE = 0x4000;
		static int const DEFAULT_DVD_THREAD_PRIORITY = 3;
		static int const DEFAULT_SOUND_THREAD_PRIORITY = 4;

		static int sMaxVoices;
		static detail::TaskThread sTaskThread;

	// methods
	public:
		static void InitSoundSystem(s32 sndThreadPriority, s32 dvdThreadPriority);
		static void InitSoundSystem(SoundSystemParam const &param,
		                            void *workMem, u32 workMemSize);
		static void ShutdownSoundSystem();
		static void WaitForResetReady();

		static bool IsInitializedSoundSystem();

		static u32 GetRequiredMemSize(SoundSystemParam const &param);

		static void PrepareReset() {
			detail::AxManager::GetInstance().PrepareReset();
		}

		static OutputMode GetOutputMode() {
			return detail::AxManager::GetInstance().GetOutputMode();
		}

		static void SetOutputMode(OutputMode mode) {
			detail::AxManager::GetInstance().SetOutputMode(mode);
		}


		static f32 GetMasterVolume() {
			return detail::AxManager::GetInstance().GetMasterVolume();
		}
		static void SetMasterVolume(f32 volume, int frame) {
			detail::AxManager::GetInstance().SetMasterVolume(volume, frame);
		}


		static RemoteSpeaker &GetRemoteSpeaker(int i) {
			return detail::RemoteSpeakerManager::GetInstance().GetRemoteSpeaker(i);
		}


		static void AppendEffect(AuxBus bus, FxBase *pFx) {
			detail::AxManager::GetInstance().AppendEffect(bus, pFx);
		}
		static void ClearEffect(AuxBus bus, int frame) {
			detail::AxManager::GetInstance().ClearEffect(bus, frame);
		}
	}; // size 0x01 (0x00 for inheritance)
}} // namespace nw4r::snd

#endif // NW4R_SND_SOUND_SYSTEM_H