summaryrefslogtreecommitdiff
path: root/include/nw4r/snd/snd_Lfo.h
blob: 780c813f1ae6cbbbeb0263fdfa2914c35125cf0d (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
#ifndef NW4R_SND_LFO_H
#define NW4R_SND_LFO_H

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

#include "common.h"

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

namespace nw4r { namespace snd { namespace detail
{
	// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x28dc2
	struct LfoParam
	{
	// methods
	public:
		// cdtors
		LfoParam() { Init(); }

		// methods
		void Init();

	// members
	public:
		f32		depth;		// size 0x04, offset 0x00
		f32		speed;		// size 0x04, offset 0x04
		u32		delay;		// size 0x04, offset 0x08
		u8		range;		// size 0x01, offset 0x0c
		u8	padding[3];
	}; // size 0x10

	// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x28ea0
	class Lfo
	{
	// methods
	public:
		// cdtors
		Lfo() :
			mDelayCounter	(0),
			mCounter		(0.0f)
		{
		}

		// methods
		void Update(int msec);
		void Reset();

		LfoParam &GetParam() { return mParam; }

		void SetParam(LfoParam const &param) { mParam = param; }

		f32 GetValue() const;

	private:
		static s8 GetSinIdx(int i);

	// static members
	private:
		static int const PERIOD;
		static int const TABLE_SIZE = 32;

	// members
	private:
		LfoParam	mParam;			// size 0x10, offset 0x00
		u32			mDelayCounter;	// size 0x04, offset 0x10
		f32			mCounter;		// size 0x04, offset 0x14
	}; // size 0x18
}}} // namespace nw4r::snd::detail

#endif // NW4R_SND_LFO_H