summaryrefslogtreecommitdiff
path: root/libs/JSystem/JAudio2/JASDrumSet.cpp
blob: 984855067d10c6e331ac9765a27728d3b7c62802 (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//
// Generated By: dol2asm
// Translation Unit: JASDrumSet
//

#include "JSystem/JAudio2/JASDrumSet.h"
#include "JSystem/JAudio2/JASCalc.h"
#include "JSystem/JKernel/JKRHeap.h"

//
// Types:
//

//
// Forward References:
//

//
// External References:
//

//
// Declarations:
//

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

/* 802982EC-80298314 292C2C 0028+00 0/0 2/2 0/0 .text            __ct__10JASDrumSetFv */
JASDrumSet::JASDrumSet() {
    field_0x4 = NULL;
    field_0x8 = 0;
}

/* 80298314-80298370 292C54 005C+00 1/0 0/0 0/0 .text            __dt__10JASDrumSetFv */
JASDrumSet::~JASDrumSet() {
}

/* 80298370-802983CC 292CB0 005C+00 0/0 2/2 0/0 .text newPercArray__10JASDrumSetFUcP7JKRHeap */
void JASDrumSet::newPercArray(u8 param_0, JKRHeap* param_1) {
    if (param_0) {
        field_0x8 = param_0;
        field_0x4 = new (param_1, 0) TPerc*[field_0x8];
        JASCalc::bzero(field_0x4, field_0x8 * sizeof(TPerc*));
    }
}

/* ############################################################################################## */
/* 80431B58-80431B70 05E878 0018+00 1/1 0/0 0/0 .bss             osc$213 */
static JASOscillator::Data osc;

/* 80451270-80451274 000770 0004+00 1/1 0/0 0/0 .sbss            oscp$214 */
static JASOscillator::Data* oscp;

/* 80451274-80451278 000774 0004+00 1/1 0/0 0/0 .sbss            None */
static s8 data_80451274[4];

/* 802983CC-802984B4 292D0C 00E8+00 1/0 0/0 0/0 .text getParam__10JASDrumSetCFiiP12JASInstParam */
bool JASDrumSet::getParam(int param_0, int param_1, JASInstParam* param_2) const {
    if (field_0x4 == NULL) {
        return false;
    }

    if (param_0 >= field_0x8) {
        return false;
    }

    TPerc* perc = field_0x4[param_0];
    if (perc == NULL) {
        return false;
    }

    param_2->field_0x1c = 0;
    param_2->field_0x1e = 1;
    param_2->mVolume = perc->mVolume;
    param_2->mPitch = perc->mPitch;
    param_2->mPan = perc->mPan;
    param_2->field_0x18 = perc->field_0xc;
    osc._00 = 0;
    osc._04 = 1.0f;
    osc._08 = NULL;
    osc._0C = NULL;
    osc._10 = 1.0f;
    osc._14 = 0.0f;

    if (data_80451274[0] == 0) {
        oscp = &osc;
        data_80451274[0] = 1;
    }

    param_2->field_0x14 = &oscp;
    param_2->field_0x1d = 1;
    param_2->mVolume *= perc->field_0x10;
    param_2->mPitch *= perc->field_0x14;
    param_2->field_0x1a = perc->field_0xe;
    return true;
}

/* 802984B4-802984C4 292DF4 0010+00 0/0 2/2 0/0 .text setPerc__10JASDrumSetFiPQ210JASDrumSet5TPerc
 */
void JASDrumSet::setPerc(int param_0, JASDrumSet::TPerc* param_1) {
    field_0x4[param_0] = param_1;
}

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

/* 802984C4-802984E4 292E04 0020+00 0/0 2/2 0/0 .text            __ct__Q210JASDrumSet5TPercFv */
JASDrumSet::TPerc::TPerc() {
    mVolume = 1.0f;
    mPitch = 1.0f;
    mPan = 0.5f;
    field_0xc = 1000;
}

/* 802984E4-802984EC -00001 0008+00 0/0 0/0 0/0 .text            setRelease__Q210JASDrumSet5TPercFUl
 */
void JASDrumSet::TPerc::setRelease(u32 param_0) {
    field_0xc = param_0;
}

/* 802984EC-802984F8 292E2C 000C+00 1/0 0/0 0/0 .text            getType__10JASDrumSetCFv */
u32 JASDrumSet::getType() const { return 'PERC'; }