Decompiled most of synthesizer.c

This commit is contained in:
David Benepe
2021-07-22 23:20:51 -05:00
parent 2375ac84a5
commit 6f234d2041
15 changed files with 222 additions and 303 deletions
@@ -1,16 +0,0 @@
glabel __allocParam
/* 066268 80065668 3C02800E */ lui $v0, %hi(alGlobals) # $v0, 0x800e
/* 06626C 8006566C 8C423780 */ lw $v0, %lo(alGlobals)($v0)
/* 066270 80065670 00001825 */ move $v1, $zero
/* 066274 80065674 8C44002C */ lw $a0, 0x2c($v0)
/* 066278 80065678 00000000 */ nop
/* 06627C 8006567C 10800005 */ beqz $a0, .L80065694
/* 066280 80065680 00000000 */ nop
/* 066284 80065684 8C8E0000 */ lw $t6, ($a0)
/* 066288 80065688 00801825 */ move $v1, $a0
/* 06628C 8006568C AC4E002C */ sw $t6, 0x2c($v0)
/* 066290 80065690 AC800000 */ sw $zero, ($a0)
.L80065694:
/* 066294 80065694 03E00008 */ jr $ra
/* 066298 80065698 00601025 */ move $v0, $v1
@@ -1,28 +0,0 @@
glabel __collectPVoices
/* 0662BC 800656BC 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 0662C0 800656C0 AFBF0024 */ sw $ra, 0x24($sp)
/* 0662C4 800656C4 AFB20020 */ sw $s2, 0x20($sp)
/* 0662C8 800656C8 AFB1001C */ sw $s1, 0x1c($sp)
/* 0662CC 800656CC AFB00018 */ sw $s0, 0x18($sp)
/* 0662D0 800656D0 8C900014 */ lw $s0, 0x14($a0)
/* 0662D4 800656D4 00808825 */ move $s1, $a0
/* 0662D8 800656D8 1200000A */ beqz $s0, .L80065704
/* 0662DC 800656DC 24920004 */ addiu $s2, $a0, 4
.L800656E0:
/* 0662E0 800656E0 0C0321D8 */ jal alUnlink
/* 0662E4 800656E4 02002025 */ move $a0, $s0
/* 0662E8 800656E8 02002025 */ move $a0, $s0
/* 0662EC 800656EC 0C0321E4 */ jal alLink
/* 0662F0 800656F0 02402825 */ move $a1, $s2
/* 0662F4 800656F4 8E300014 */ lw $s0, 0x14($s1)
/* 0662F8 800656F8 00000000 */ nop
/* 0662FC 800656FC 1600FFF8 */ bnez $s0, .L800656E0
/* 066300 80065700 00000000 */ nop
.L80065704:
/* 066304 80065704 8FBF0024 */ lw $ra, 0x24($sp)
/* 066308 80065708 8FB00018 */ lw $s0, 0x18($sp)
/* 06630C 8006570C 8FB1001C */ lw $s1, 0x1c($sp)
/* 066310 80065710 8FB20020 */ lw $s2, 0x20($sp)
/* 066314 80065714 03E00008 */ jr $ra
/* 066318 80065718 27BD0028 */ addiu $sp, $sp, 0x28
@@ -1,16 +0,0 @@
glabel __freePVoices
/* 06631C 8006571C 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 066320 80065720 AFBF0014 */ sw $ra, 0x14($sp)
/* 066324 80065724 AFA40018 */ sw $a0, 0x18($sp)
/* 066328 80065728 AFA5001C */ sw $a1, 0x1c($sp)
/* 06632C 8006572C 0C0321D8 */ jal alUnlink
/* 066330 80065730 00A02025 */ move $a0, $a1
/* 066334 80065734 8FA50018 */ lw $a1, 0x18($sp)
/* 066338 80065738 8FA4001C */ lw $a0, 0x1c($sp)
/* 06633C 8006573C 0C0321E4 */ jal alLink
/* 066340 80065740 24A50014 */ addiu $a1, $a1, 0x14
/* 066344 80065744 8FBF0014 */ lw $ra, 0x14($sp)
/* 066348 80065748 27BD0018 */ addiu $sp, $sp, 0x18
/* 06634C 8006574C 03E00008 */ jr $ra
/* 066350 80065750 00000000 */ nop
@@ -1,10 +0,0 @@
glabel __freeParam
/* 06629C 8006569C 3C02800E */ lui $v0, %hi(alGlobals) # $v0, 0x800e
/* 0662A0 800656A0 8C423780 */ lw $v0, %lo(alGlobals)($v0)
/* 0662A4 800656A4 00000000 */ nop
/* 0662A8 800656A8 8C4E002C */ lw $t6, 0x2c($v0)
/* 0662AC 800656AC 00000000 */ nop
/* 0662B0 800656B0 AC8E0000 */ sw $t6, ($a0)
/* 0662B4 800656B4 03E00008 */ jr $ra
/* 0662B8 800656B8 AC44002C */ sw $a0, 0x2c($v0)
@@ -1,35 +0,0 @@
glabel __nextSampleTime
/* 0663EC 800657EC ACA00000 */ sw $zero, ($a1)
/* 0663F0 800657F0 8C830000 */ lw $v1, ($a0)
/* 0663F4 800657F4 3C027FFF */ lui $v0, (0x7FFFFFFF >> 16) # lui $v0, 0x7fff
/* 0663F8 800657F8 10600012 */ beqz $v1, .L80065844
/* 0663FC 800657FC 3442FFFF */ ori $v0, (0x7FFFFFFF & 0xFFFF) # ori $v0, $v0, 0xffff
/* 066400 80065800 8C860020 */ lw $a2, 0x20($a0)
/* 066404 80065804 00000000 */ nop
.L80065808:
/* 066408 80065808 8C6E0010 */ lw $t6, 0x10($v1)
/* 06640C 8006580C 00000000 */ nop
/* 066410 80065810 01C67823 */ subu $t7, $t6, $a2
/* 066414 80065814 01E2082A */ slt $at, $t7, $v0
/* 066418 80065818 10200006 */ beqz $at, .L80065834
/* 06641C 8006581C 00000000 */ nop
/* 066420 80065820 ACA30000 */ sw $v1, ($a1)
/* 066424 80065824 8C780010 */ lw $t8, 0x10($v1)
/* 066428 80065828 8C860020 */ lw $a2, 0x20($a0)
/* 06642C 8006582C 00000000 */ nop
/* 066430 80065830 03061023 */ subu $v0, $t8, $a2
.L80065834:
/* 066434 80065834 8C630000 */ lw $v1, ($v1)
/* 066438 80065838 00000000 */ nop
/* 06643C 8006583C 1460FFF2 */ bnez $v1, .L80065808
/* 066440 80065840 00000000 */ nop
.L80065844:
/* 066444 80065844 8CB90000 */ lw $t9, ($a1)
/* 066448 80065848 00000000 */ nop
/* 06644C 8006584C 8F220010 */ lw $v0, 0x10($t9)
/* 066450 80065850 03E00008 */ jr $ra
/* 066454 80065854 00000000 */ nop
/* 066458 80065858 00000000 */ nop
/* 06645C 8006585C 00000000 */ nop
@@ -1,12 +0,0 @@
glabel __timeToSamples
/* 0663C4 800657C4 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0663C8 800657C8 AFBF0014 */ sw $ra, 0x14($sp)
/* 0663CC 800657CC 0C0195D5 */ jal __timeToSamplesNoRound
/* 0663D0 800657D0 00000000 */ nop
/* 0663D4 800657D4 8FBF0014 */ lw $ra, 0x14($sp)
/* 0663D8 800657D8 2401FFF0 */ li $at, -16
/* 0663DC 800657DC 00417024 */ and $t6, $v0, $at
/* 0663E0 800657E0 01C01025 */ move $v0, $t6
/* 0663E4 800657E4 03E00008 */ jr $ra
/* 0663E8 800657E8 27BD0018 */ addiu $sp, $sp, 0x18
@@ -1,35 +0,0 @@
.late_rodata
glabel D_800E6EC0
.double 1000000.0
.text
glabel __timeToSamplesNoRound
/* 066354 80065754 8C8E0044 */ lw $t6, 0x44($a0)
/* 066358 80065758 44852000 */ mtc1 $a1, $f4
/* 06635C 8006575C 448E4000 */ mtc1 $t6, $f8
/* 066360 80065760 468021A0 */ cvt.s.w $f6, $f4
/* 066364 80065764 3C01800E */ lui $at, %hi(D_800E6EC0 + 4) # $at, 0x800e
/* 066368 80065768 C4256EC0 */ lwc1 $f5, %lo(D_800E6EC0)($at)
/* 06636C 8006576C 468042A0 */ cvt.s.w $f10, $f8
/* 066370 80065770 C4246EC4 */ lwc1 $f4, %lo(D_800E6EC0 + 4)($at)
/* 066374 80065774 3C013FE0 */ li $at, 0x3FE00000 # 1.750000
/* 066378 80065778 460A3402 */ mul.s $f16, $f6, $f10
/* 06637C 8006577C 44803000 */ mtc1 $zero, $f6
/* 066380 80065780 44813800 */ mtc1 $at, $f7
/* 066384 80065784 460084A1 */ cvt.d.s $f18, $f16
/* 066388 80065788 00000000 */ nop
/* 06638C 8006578C 46249203 */ div.d $f8, $f18, $f4
/* 066390 80065790 46264280 */ add.d $f10, $f8, $f6
/* 066394 80065794 46205020 */ cvt.s.d $f0, $f10
/* 066398 80065798 444FF800 */ cfc1 $t7, $31
/* 06639C 8006579C 00000000 */ nop
/* 0663A0 800657A0 35E10003 */ ori $at, $t7, 3
/* 0663A4 800657A4 38210002 */ xori $at, $at, 2
/* 0663A8 800657A8 44C1F800 */ ctc1 $at, $31
/* 0663AC 800657AC 00000000 */ nop
/* 0663B0 800657B0 46000424 */ cvt.w.s $f16, $f0
/* 0663B4 800657B4 44028000 */ mfc1 $v0, $f16
/* 0663B8 800657B8 44CFF800 */ ctc1 $t7, $31
/* 0663BC 800657BC 03E00008 */ jr $ra
/* 0663C0 800657C0 00000000 */ nop
@@ -1,126 +0,0 @@
glabel alAudioFrame
/* 066094 80065494 27BDFF90 */ addiu $sp, $sp, -0x70
/* 066098 80065498 AFB20024 */ sw $s2, 0x24($sp)
/* 06609C 8006549C 3C12800E */ lui $s2, %hi(alGlobals) # $s2, 0x800e
/* 0660A0 800654A0 8E523780 */ lw $s2, %lo(alGlobals)($s2)
/* 0660A4 800654A4 AFBF003C */ sw $ra, 0x3c($sp)
/* 0660A8 800654A8 AFB70038 */ sw $s7, 0x38($sp)
/* 0660AC 800654AC AFB60034 */ sw $s6, 0x34($sp)
/* 0660B0 800654B0 AFB50030 */ sw $s5, 0x30($sp)
/* 0660B4 800654B4 AFB4002C */ sw $s4, 0x2c($sp)
/* 0660B8 800654B8 AFB30028 */ sw $s3, 0x28($sp)
/* 0660BC 800654BC AFB10020 */ sw $s1, 0x20($sp)
/* 0660C0 800654C0 AFB0001C */ sw $s0, 0x1c($sp)
/* 0660C4 800654C4 AFA50074 */ sw $a1, 0x74($sp)
/* 0660C8 800654C8 A7A00062 */ sh $zero, 0x62($sp)
/* 0660CC 800654CC 8E4E0000 */ lw $t6, ($s2)
/* 0660D0 800654D0 00808825 */ move $s1, $a0
/* 0660D4 800654D4 00E09825 */ move $s3, $a3
/* 0660D8 800654D8 0080A025 */ move $s4, $a0
/* 0660DC 800654DC 15C00004 */ bnez $t6, .L800654F0
/* 0660E0 800654E0 00C0A825 */ move $s5, $a2
/* 0660E4 800654E4 ACA00000 */ sw $zero, ($a1)
/* 0660E8 800654E8 10000054 */ b .L8006563C
/* 0660EC 800654EC 00801025 */ move $v0, $a0
.L800654F0:
/* 0660F0 800654F0 27B0006C */ addiu $s0, $sp, 0x6c
/* 0660F4 800654F4 02002825 */ move $a1, $s0
/* 0660F8 800654F8 02402025 */ move $a0, $s2
/* 0660FC 800654FC 0C0195FB */ jal __nextSampleTime
/* 066100 80065500 AFB10070 */ sw $s1, 0x70($sp)
/* 066104 80065504 8E580020 */ lw $t8, 0x20($s2)
/* 066108 80065508 AE42001C */ sw $v0, 0x1c($s2)
/* 06610C 8006550C 0058C823 */ subu $t9, $v0, $t8
/* 066110 80065510 0333082A */ slt $at, $t9, $s3
/* 066114 80065514 1020001B */ beqz $at, .L80065584
/* 066118 80065518 2411FFF0 */ li $s1, -16
.L8006551C:
/* 06611C 8006551C 8E48001C */ lw $t0, 0x1c($s2)
/* 066120 80065520 00000000 */ nop
/* 066124 80065524 01114824 */ and $t1, $t0, $s1
/* 066128 80065528 AE49001C */ sw $t1, 0x1c($s2)
/* 06612C 8006552C 8FA4006C */ lw $a0, 0x6c($sp)
/* 066130 80065530 00000000 */ nop
/* 066134 80065534 8C990008 */ lw $t9, 8($a0)
/* 066138 80065538 00000000 */ nop
/* 06613C 8006553C 0320F809 */ jalr $t9
/* 066140 80065540 00000000 */ nop
/* 066144 80065544 02402025 */ move $a0, $s2
/* 066148 80065548 0C0195D5 */ jal __timeToSamplesNoRound
/* 06614C 8006554C 00402825 */ move $a1, $v0
/* 066150 80065550 8FAB006C */ lw $t3, 0x6c($sp)
/* 066154 80065554 02402025 */ move $a0, $s2
/* 066158 80065558 8D6C0010 */ lw $t4, 0x10($t3)
/* 06615C 8006555C 02002825 */ move $a1, $s0
/* 066160 80065560 01826821 */ addu $t5, $t4, $v0
/* 066164 80065564 0C0195FB */ jal __nextSampleTime
/* 066168 80065568 AD6D0010 */ sw $t5, 0x10($t3)
/* 06616C 8006556C 8E4E0020 */ lw $t6, 0x20($s2)
/* 066170 80065570 AE42001C */ sw $v0, 0x1c($s2)
/* 066174 80065574 004E7823 */ subu $t7, $v0, $t6
/* 066178 80065578 01F3082A */ slt $at, $t7, $s3
/* 06617C 8006557C 1420FFE7 */ bnez $at, .L8006551C
/* 066180 80065580 00000000 */ nop
.L80065584:
/* 066184 80065584 8E58001C */ lw $t8, 0x1c($s2)
/* 066188 80065588 2411FFF0 */ li $s1, -16
/* 06618C 8006558C 03114024 */ and $t0, $t8, $s1
/* 066190 80065590 1A600022 */ blez $s3, .L8006561C
/* 066194 80065594 AE48001C */ sw $t0, 0x1c($s2)
/* 066198 80065598 27B70062 */ addiu $s7, $sp, 0x62
/* 06619C 8006559C 3C160700 */ lui $s6, 0x700
.L800655A0:
/* 0661A0 800655A0 8E420048 */ lw $v0, 0x48($s2)
/* 0661A4 800655A4 02608025 */ move $s0, $s3
/* 0661A8 800655A8 0053082A */ slt $at, $v0, $s3
/* 0661AC 800655AC 10200003 */ beqz $at, .L800655BC
/* 0661B0 800655B0 00000000 */ nop
/* 0661B4 800655B4 10000001 */ b .L800655BC
/* 0661B8 800655B8 00408025 */ move $s0, $v0
.L800655BC:
/* 0661BC 800655BC AE960000 */ sw $s6, ($s4)
/* 0661C0 800655C0 AE800004 */ sw $zero, 4($s4)
/* 0661C4 800655C4 8E510038 */ lw $s1, 0x38($s2)
/* 0661C8 800655C8 24050006 */ li $a1, 6
/* 0661CC 800655CC 8E390008 */ lw $t9, 8($s1)
/* 0661D0 800655D0 02A03025 */ move $a2, $s5
/* 0661D4 800655D4 0320F809 */ jalr $t9
/* 0661D8 800655D8 02202025 */ move $a0, $s1
/* 0661DC 800655DC 8E470020 */ lw $a3, 0x20($s2)
/* 0661E0 800655E0 26890008 */ addiu $t1, $s4, 8
/* 0661E4 800655E4 AFA90010 */ sw $t1, 0x10($sp)
/* 0661E8 800655E8 8E390004 */ lw $t9, 4($s1)
/* 0661EC 800655EC 02202025 */ move $a0, $s1
/* 0661F0 800655F0 02E02825 */ move $a1, $s7
/* 0661F4 800655F4 0320F809 */ jalr $t9
/* 0661F8 800655F8 02003025 */ move $a2, $s0
/* 0661FC 800655FC 8E4D0020 */ lw $t5, 0x20($s2)
/* 066200 80065600 02709823 */ subu $s3, $s3, $s0
/* 066204 80065604 00106080 */ sll $t4, $s0, 2
/* 066208 80065608 01B05821 */ addu $t3, $t5, $s0
/* 06620C 8006560C 0040A025 */ move $s4, $v0
/* 066210 80065610 02ACA821 */ addu $s5, $s5, $t4
/* 066214 80065614 1E60FFE2 */ bgtz $s3, .L800655A0
/* 066218 80065618 AE4B0020 */ sw $t3, 0x20($s2)
.L8006561C:
/* 06621C 8006561C 8FAE0070 */ lw $t6, 0x70($sp)
/* 066220 80065620 8FA80074 */ lw $t0, 0x74($sp)
/* 066224 80065624 028E7823 */ subu $t7, $s4, $t6
/* 066228 80065628 000FC0C3 */ sra $t8, $t7, 3
/* 06622C 8006562C 02402025 */ move $a0, $s2
/* 066230 80065630 0C0195AF */ jal __collectPVoices
/* 066234 80065634 AD180000 */ sw $t8, ($t0)
/* 066238 80065638 02801025 */ move $v0, $s4
.L8006563C:
/* 06623C 8006563C 8FBF003C */ lw $ra, 0x3c($sp)
/* 066240 80065640 8FB0001C */ lw $s0, 0x1c($sp)
/* 066244 80065644 8FB10020 */ lw $s1, 0x20($sp)
/* 066248 80065648 8FB20024 */ lw $s2, 0x24($sp)
/* 06624C 8006564C 8FB30028 */ lw $s3, 0x28($sp)
/* 066250 80065650 8FB4002C */ lw $s4, 0x2c($sp)
/* 066254 80065654 8FB50030 */ lw $s5, 0x30($sp)
/* 066258 80065658 8FB60034 */ lw $s6, 0x34($sp)
/* 06625C 8006565C 8FB70038 */ lw $s7, 0x38($sp)
/* 066260 80065660 03E00008 */ jr $ra
/* 066264 80065664 27BD0070 */ addiu $sp, $sp, 0x70
+1 -2
View File
@@ -264,8 +264,7 @@ typedef struct {
void *dmaproc;
ALHeap *heap;
s32 outputRate; /* output sample rate */
ALFxId fxType;
u8 unk1d;
ALFxId fxType[2];
s32 *params;
} ALSynConfig;
+1
View File
@@ -264,6 +264,7 @@ typedef struct PVoice_s {
ALResampler resampler;
ALEnvMixer envmixer;
s32 offset;
s32 unkDC;
} PVoice;
#endif
+218
View File
@@ -0,0 +1,218 @@
/* The comment below is needed for this file to be picked up by generate_ld */
/* RAM_POS: 0x80065130 */
#include "types.h"
#include "audio_internal.h"
#include "macros.h"
#ifdef NON_MATCHING
s32 __nextSampleTime(ALSynth *drvr, ALPlayer **client);
s32 _timeToSamplesNoRound(ALSynth *ALSynth, s32 micros);
// Regalloc issue. s7 and s8 need to swap places; there is also an extra 8 bytes on the stack.
void alSynNew(ALSynth *drvr, ALSynConfig *c)
{
s32 i;
ALVoice *vv;
PVoice *pv;
ALVoice *vvoices;
PVoice *pvoices;
ALHeap *hp = c->heap;
ALSave *save;
ALFilter *sources;
ALParam *params;
ALParam *paramPtr;
drvr->head = NULL;
drvr->numPVoices = c->maxPVoices;
drvr->curSamples = 0;
drvr->paramSamples = 0;
drvr->outputRate = c->outputRate;
drvr->maxOutSamples = AL_MAX_RSP_SAMPLES;
drvr->dma = (ALDMANew) c->dmaproc;
save = alHeapAlloc(hp, 1, sizeof(ALSave));
alSaveNew(save);
drvr->outputFilter = (ALFilter *)save;
drvr->auxBus = alHeapAlloc(hp, 2, sizeof(ALAuxBus));
drvr->maxAuxBusses = 2;
sources = alHeapAlloc(hp, c->maxPVoices, sizeof(ALFilter *));
alAuxBusNew(drvr->auxBus, sources, c->maxPVoices);
sources = alHeapAlloc(hp, c->maxPVoices, sizeof(ALFilter *));
alAuxBusNew(drvr->auxBus + 1, sources, c->maxPVoices);
drvr->mainBus = alHeapAlloc(hp, 1, sizeof(ALMainBus));
sources = alHeapAlloc(hp, c->maxPVoices, sizeof(ALFilter *));
alMainBusNew(drvr->mainBus, sources, c->maxPVoices);
for(i = 0; i < 2; i++) {
if (c->fxType[i] != 0) {
alSynAllocFX(drvr, (s16)i, c, c);
} else {
alMainBusParam(drvr->mainBus, 2, drvr->auxBus + i);
}
}
drvr->pFreeList.next = 0;
drvr->pFreeList.prev = 0;
drvr->pLameList.next = 0;
drvr->pLameList.prev = 0;
drvr->pAllocList.next = 0;
drvr->pAllocList.prev = 0;
pvoices = alHeapAlloc(hp, c->maxPVoices, sizeof(PVoice));
for (i = 0; i < c->maxPVoices; i++) {
pv = &pvoices[i];
alLink((ALLink *)pv, &drvr->pFreeList);
pv->vvoice = 0;
alLoadNew(&pv->decoder, drvr->dma, hp);
alLoadParam(&pv->decoder, AL_FILTER_SET_SOURCE, 0);
alResampleNew(&pv->resampler, hp);
alResampleParam(&pv->resampler, AL_FILTER_SET_SOURCE, &pv->decoder);
alEnvmixerNew(&pv->envmixer, hp);
alEnvmixerParam(&pv->envmixer, AL_FILTER_SET_SOURCE, &pv->resampler);
alAuxBusParam(drvr->auxBus, AL_FILTER_ADD_SOURCE, &pv->envmixer);
pv->channelKnob = (ALFilter *)&pv->envmixer;
}
alSaveParam(save, AL_FILTER_SET_SOURCE, drvr->mainBus);
params = alHeapAlloc(hp, c->maxUpdates, sizeof(ALParam));
drvr->paramList = 0;
for (i = 0; i < c->maxUpdates; i++) {
paramPtr= &params[i];
paramPtr->next = drvr->paramList;
drvr->paramList = paramPtr;
}
drvr->heap = hp;
}
#else
GLOBAL_ASM("lib/asm/non_matchings/synthesizer/alSynNew.s")
#endif
void __collectPVoices(ALSynth *drvr);
s32 __timeToSamplesNoRound(ALSynth *synth, s32 micros);
Acmd *alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen)
{
ALPlayer *client;
ALFilter *output;
ALSynth *drvr = &alGlobals->drvr;
s16 tmp = 0; /* Starting buffer in DMEM */
Acmd *cmdlEnd = cmdList;
Acmd *cmdPtr;
s32 nOut;
s16 *lOutBuf = outBuf;
if (drvr->head == 0) {
*cmdLen = 0;
return cmdList; /* nothing to do */
}
for (drvr->paramSamples = __nextSampleTime(drvr, &client);
drvr->paramSamples - drvr->curSamples < outLen;
drvr->paramSamples = __nextSampleTime(drvr, &client))
{
drvr->paramSamples &= ~0xf;
client->samplesLeft += __timeToSamplesNoRound(drvr, (*client->handler)(client));
}
drvr->paramSamples &= ~0xf;
while (outLen > 0){
nOut = MIN(drvr->maxOutSamples, outLen);
cmdPtr = cmdlEnd;
aSegment(cmdPtr++, 0, 0);
output = drvr->outputFilter;
(*output->setParam)(output, AL_FILTER_SET_DRAM, lOutBuf);
cmdlEnd = (*output->handler)(output, &tmp, nOut, drvr->curSamples,
cmdPtr);
outLen -= nOut;
lOutBuf += nOut<<1;
drvr->curSamples += nOut;
}
*cmdLen = (s32) (cmdlEnd - cmdList);
__collectPVoices(drvr);
return cmdlEnd;
}
ALParam *__allocParam()
{
ALParam *update = 0;
ALSynth *drvr = &alGlobals->drvr;
if (drvr->paramList) {
update = drvr->paramList;
drvr->paramList = drvr->paramList->next;
update->next = 0;
}
return update;
}
void __freeParam(ALParam *param)
{
ALSynth *drvr = &alGlobals->drvr;
param->next = drvr->paramList;
drvr->paramList = param;
}
void __collectPVoices(ALSynth *drvr)
{
ALLink *dl;
PVoice *pv;
while ((dl = drvr->pLameList.next) != 0) {
pv = (PVoice *)dl;
alUnlink(dl);
alLink(dl, &drvr->pFreeList);
}
}
void __freePVoices(ALSynth *drvr, PVoice *pvoice)
{
alUnlink((ALLink *)pvoice);
alLink((ALLink *)pvoice, &drvr->pLameList);
}
s32 __timeToSamplesNoRound(ALSynth *synth, s32 micros)
{
f32 tmp = ((f32)micros) * synth->outputRate / 1000000.0 + 0.5;
return (s32)tmp;
}
s32 __timeToSamples(ALSynth *synth, s32 micros)
{
return __timeToSamplesNoRound(synth, micros) & ~0xF;
}
s32 __nextSampleTime(ALSynth *drvr, ALPlayer **client)
{
ALMicroTime delta = 0x7fffffff;
ALPlayer *cl;
*client = 0;
for (cl = drvr->head; cl != 0; cl = cl->next) {
if ((cl->samplesLeft - drvr->curSamples) < delta) {
*client = cl;
delta = cl->samplesLeft - drvr->curSamples;
}
}
return (*client)->samplesLeft;
}
+2 -2
View File
@@ -184,8 +184,8 @@ void audio_init(u32 arg0){
synth_config.maxPVoices = 40;
synth_config.maxUpdates = 96;
synth_config.dmaproc = NULL;
synth_config.fxType = 6;
synth_config.unk1d = 2;
synth_config.fxType[0] = 6;
synth_config.fxType[1] = 2;
synth_config.outputRate = 0;
synth_config.heap = &gALHeap;
audioNewThread(&synth_config, 12, arg0);
-17
View File
@@ -1,17 +0,0 @@
/* The comment below is needed for this file to be picked up by generate_ld */
/* RAM_POS: 0x80065130 */
#include "unknown_065D30.h"
#include "types.h"
#include "macros.h"
GLOBAL_ASM("asm/non_matchings/unknown_065D30/alSynNew.s")
GLOBAL_ASM("asm/non_matchings/unknown_065D30/alAudioFrame.s")
GLOBAL_ASM("asm/non_matchings/unknown_065D30/__allocParam.s")
GLOBAL_ASM("asm/non_matchings/unknown_065D30/__freeParam.s")
GLOBAL_ASM("asm/non_matchings/unknown_065D30/__collectPVoices.s")
GLOBAL_ASM("asm/non_matchings/unknown_065D30/__freePVoices.s")
GLOBAL_ASM("asm/non_matchings/unknown_065D30/__timeToSamplesNoRound.s")
GLOBAL_ASM("asm/non_matchings/unknown_065D30/__timeToSamples.s")
GLOBAL_ASM("asm/non_matchings/unknown_065D30/__nextSampleTime.s")
-4
View File
@@ -1,4 +0,0 @@
#ifndef _UNKNOWN_065D30_H_
#define _UNKNOWN_065D30_H_
#endif