Merge pull request #132 from RevoSucks/naudio

n_mainbus
This commit is contained in:
Revo
2024-09-15 10:40:11 -04:00
committed by GitHub
3 changed files with 77 additions and 4 deletions

View File

@@ -1,3 +0,0 @@
#include "global.h"
#pragma GLOBAL_ASM("asm/us/nonmatchings/518A0/n_alMainBusPull.s")

76
src/libnaudio/n_mainbus.c Normal file
View File

@@ -0,0 +1,76 @@
/*====================================================================
*
* Copyright 1993, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
* Inc.; the contents of this file may not be disclosed to third
* parties, copied or duplicated in any form, in whole or in part,
* without the prior written permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS
* 252.227-7013, and/or in similar or successor clauses in the FAR,
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
#include "n_synthInternals.h"
// This function appears to be different than the stock n_alMainBusPull.
extern u8 D_800FC824;
extern u8 D_80077D98;
extern u8* D_800FC6D8;
extern u32 D_800FD6F0;
extern u8* D_800FCF28[];
extern u32 D_800FCF30[];
Acmd *n_alMainBusPull(s32 sampleOffset, Acmd *p)
{
Acmd *ptr = p;
s32 i;
aClearBuffer(ptr++, N_AL_MAIN_L_OUT, N_AL_DIVIDED<<1);
ptr = (n_syn->mainBus->filter.handler)(sampleOffset,ptr);
aMix(ptr++, 0, 0x7fff, N_AL_AUX_L_OUT, N_AL_MAIN_L_OUT);
aMix(ptr++, 0, 0x7fff, N_AL_AUX_R_OUT, N_AL_MAIN_R_OUT);
// theres more code after?
if (D_800FC824 != 0) {
aClearBuffer(ptr++, 0x7C0, 0x2E0);
n_aLoadBuffer(ptr++, 0x170, 0x7C0, osVirtualToPhysical(&D_800FC6D8[D_800FD6F0 * 2]));
n_aLoadBuffer(ptr++, 0x170, 0x930, osVirtualToPhysical(&D_800FC6D8[D_800FD6F0 * 2]));
D_800FD6F0 += 0xB8;
if (D_800FD6F0 >= 0xB80) {
D_800FD6F0 = 0;
}
aMix(ptr++, 0, 0x7fff, N_AL_AUX_L_OUT, N_AL_MAIN_L_OUT);
aMix(ptr++, 0, 0x7fff, N_AL_AUX_R_OUT, N_AL_MAIN_R_OUT);
aClearBuffer(ptr++, 0x7C0, 0x2E0);
}
if (D_80077D98 != 0) {
for (i = 0; i < 2; i++) {
aClearBuffer(ptr++, 0x7C0, 0x2E0);
n_aLoadBuffer(ptr++, 0x170, 0x7C0, osVirtualToPhysical(&D_800FCF28[i][D_800FCF30[i] * 2]));
n_aLoadBuffer(ptr++, 0x170, 0x930, osVirtualToPhysical(&D_800FCF28[i][D_800FCF30[i] * 2]));
D_800FCF30[i] += 0xB8;
if (D_800FCF30[i] >= 0x8A0) {
D_800FCF30[i] = 0;
}
aMix(ptr++, 0, 0x7fff, N_AL_AUX_L_OUT, N_AL_MAIN_L_OUT);
aMix(ptr++, 0, 0x7fff, N_AL_AUX_R_OUT, N_AL_MAIN_R_OUT);
}
}
return ptr;
}

View File

@@ -123,7 +123,7 @@
- [0x51740, c]
- [0x517A0, c] # yay0 audio decoder
- [0x51850, c, libnaudio/n_save]
- [0x518A0, c] # this is n_alMainBusPull but the function appears to have changed.
- [0x518A0, c, libnaudio/n_mainbus]
- [0x51B20, c, libnaudio/n_synsetvol]
# libleo