summaryrefslogtreecommitdiff
path: root/libs/JSystem/JAudio2/JASLfo.cpp
blob: 06ffc83cd94a8d3203234037ead19a110321d3aa (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
//
// Generated By: dol2asm
// Translation Unit: JASLfo
//

#include "JSystem/JAudio2/JASLfo.h"
#include "SSystem/SComponent/c_math.h"

//
// Types:
//

//
// Forward References:
//

//
// External References:
//

//
// Declarations:
//

/* ############################################################################################## */

/* 8029BD14-8029BD44 296654 0030+00 1/1 1/1 0/0 .text            __ct__6JASLfoFv */
JASLfo::JASLfo() {
    field_0x0 = 0;
    field_0x4 = 1;
    field_0x8 = 0.0f;
    mDepth = 0.0f;
    mPitch = 1.0f;
    mDelay = 0;
    field_0x16 = 0;
}

/* ############################################################################################## */

/* 8029BD44-8029BDD8 296684 0094+00 0/0 3/3 0/0 .text            getValue__6JASLfoCFv */
f32 JASLfo::getValue() const {
    if (field_0x16) {
        return 0.0f;
    }

    if (mDepth == 0.0f) {
        return 0.0f;
    }

    return mDepth * JMASinLap(field_0x8);
}

/* ############################################################################################## */

/* 8029BDD8-8029BE2C 296718 0054+00 0/0 2/2 0/0 .text            incCounter__6JASLfoFf */
void JASLfo::incCounter(f32 param_0) {
    if (field_0x16) {
        field_0x16--;
        return;
    }

    field_0x8 += param_0 * ((1.0f / 72.0f) * mPitch);
    if (field_0x8 >= 1.0f) {
        field_0x8 -= 1.0f; 
    }
}

/* ############################################################################################## */
/* 80431C40-80431C58 05E960 0018+00 2/2 1/1 0/0 .bss             sFreeRunLfo__6JASLfo */
JASLfo JASLfo::sFreeRunLfo;

/* 8029BE2C-8029BE6C 29676C 0040+00 0/0 1/1 0/0 .text            resetCounter__6JASLfoFv */
void JASLfo::resetCounter() {
    field_0x16 = mDelay;
    switch (field_0x4) {
    case 0:
        field_0x8 = sFreeRunLfo.field_0x8;
        break;
    case 1:
        field_0x8 = 0.0f;
        break;
    }
}

/* 8029BE6C-8029BE94 2967AC 0028+00 0/0 1/0 0/0 .text            __sinit_JASLfo_cpp */