summaryrefslogtreecommitdiff
path: root/src/JSystem/JAudio/dspproc.c
blob: 781f502258964f3ec7760695757124fdbb7c9d0b (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
//
// Generated by dtk
// Translation Unit: dspproc.c
//

#include "JSystem/JSystem.h" // IWYU pragma: keep

#include "JSystem/JAudio/dspproc.h"
#include "JSystem/JAudio/dsptask.h"

u16 DSP_CreateMap2(u32 param_1);

/* 8028E600-8028E648       .text DSPReleaseHalt2__FUl */
void DSPReleaseHalt2(u32 msg) {
    u32 msgs[2];
    u16 dspMap = DSP_CreateMap2(msg);
    msgs[0] = (msg << 16) | dspMap;

    DSPSendCommands2(msgs, 0, NULL);
}

/* 8028E660-8028E694       .text DSPReleaseHalt__Fv */
void DSPReleaseHalt() {
    u32 msgs[2];
    msgs[0] = 0x30000;
    DSPSendCommands2(msgs, 0, NULL);
}

static volatile BOOL flag;

/* 8028E6A0-8028E6AC       .text setup_callback__FUs */
void setup_callback(u16 param_1) {
    flag = 0;
}

/* 8028E6C0-8028E724       .text DsetupTable__FUlUlUlUlUl */
void DsetupTable(u32 param_1, u32 param_2, u32 param_3, u32 param_4, u32 param_5) {
    u32 table[5];
    table[0] = (param_1 & 0xFFFF) | 0x81000000;
    table[1] = param_2;
    table[2] = param_3;
    table[3] = param_4;
    table[4] = param_5;
    flag = 1;
    DSPSendCommands2(table,5,setup_callback);
    while (TRUE) {
        if (flag == 0) {
            return;
        }
    }
}

static u16 DSP_MIXERLEVEL = 0x4000;

/* 8028E740-8028E764       .text DsetMixerLevel__Ff */
void DsetMixerLevel(f32 level) {
    DSP_MIXERLEVEL = 4096.0f * level;
}

/* 8028E780-8028E7C8       .text DsyncFrame__FUlUlUl */
void DsyncFrame(u32 param_1, u32 param_2, u32 param_3) {
    u32 msgs[3];
    msgs[0] = (param_1 & 0xff) << 0x10 | 0x82000000 | DSP_MIXERLEVEL;
    msgs[1] = param_2;
    msgs[2] = param_3;
    DSPSendCommands2(msgs, 3, 0);
}

static volatile BOOL d_waitflag;

/* 8028E7E0-8028E7EC       .text dummy_callback__FUs */
void dummy_callback(u16 param_1) {
    d_waitflag = 0;
}

/* 8028E800-8028E854       .text DsetDolbyDelay__FUlUs */
void DsetDolbyDelay(u32 param_1, u16 param_2) {
    u32 msgs[2];
    msgs[0] = param_2 | 0x8D000000;
    msgs[1] = param_1;
    d_waitflag = 1;
    DSPSendCommands2(msgs, 2, dummy_callback);
    while (d_waitflag) {}
}