core1/audio/n_synthesizer.c done
This commit is contained in:
parent
1270e5b87a
commit
a0230555c7
|
@ -66,6 +66,12 @@ typedef struct {
|
|||
s32 maxOutSamples;
|
||||
s32 sv_dramout;
|
||||
s32 sv_first;
|
||||
ALPlayer *unk5C;
|
||||
ALPlayer *unk60;
|
||||
ALPlayer *unk64;
|
||||
ALPlayer *unk68;
|
||||
ALPlayer *unk6C;
|
||||
ALPlayer *unk70;
|
||||
} N_ALSynth;
|
||||
|
||||
|
||||
|
|
|
@ -110,16 +110,6 @@ typedef struct N_PVoice_s {
|
|||
s32 offset;
|
||||
} N_PVoice;
|
||||
|
||||
typedef struct audio_0_struct{
|
||||
N_ALSynth synth;
|
||||
ALPlayer *unk5C;
|
||||
ALPlayer *unk60;
|
||||
ALPlayer *unk64;
|
||||
ALPlayer *unk68;
|
||||
ALPlayer *unk6C;
|
||||
ALPlayer *unk70;
|
||||
} AL0s; //modified ALSynth?
|
||||
|
||||
#define N_AL_MAX_RSP_SAMPLES 184
|
||||
|
||||
|
||||
|
@ -148,7 +138,7 @@ typedef struct N_ALAuxBus_s {
|
|||
ALFx *fx_array[AL_MAX_AUX_BUS_SOURCES];
|
||||
} N_ALAuxBus;
|
||||
|
||||
extern AL0s *n_syn;
|
||||
extern N_ALSynth *n_syn;
|
||||
|
||||
/*
|
||||
* prototypes for private driver functions
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</mask>
|
||||
<g mask="url(#anybadge_1)">
|
||||
<path fill="#555" d="M0 0h44v20H0z"/>
|
||||
<path fill="#a1e000" d="M44 0h67v20H44z"/>
|
||||
<path fill="#9ce000" d="M44 0h67v20H44z"/>
|
||||
<path fill="url(#b)" d="M0 0h111v20H0z"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
||||
|
@ -17,7 +17,7 @@
|
|||
<text x="22.0" y="14">core1</text>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
||||
<text x="78.5" y="15" fill="#010101" fill-opacity=".3">64.0670%</text>
|
||||
<text x="77.5" y="14">64.0670%</text>
|
||||
<text x="78.5" y="15" fill="#010101" fill-opacity=".3">65.1321%</text>
|
||||
<text x="77.5" y="14">65.1321%</text>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
@ -9,7 +9,7 @@
|
|||
</mask>
|
||||
<g mask="url(#anybadge_1)">
|
||||
<path fill="#555" d="M0 0h150v20H0z"/>
|
||||
<path fill="#6be000" d="M150 0h67v20H150z"/>
|
||||
<path fill="#6ae000" d="M150 0h67v20H150z"/>
|
||||
<path fill="url(#b)" d="M0 0h217v20H0z"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
||||
|
@ -17,7 +17,7 @@
|
|||
<text x="75.0" y="14">Banjo-Kazooie (us.v10)</text>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
||||
<text x="184.5" y="15" fill="#010101" fill-opacity=".3">76.0831%</text>
|
||||
<text x="183.5" y="14">76.0831%</text>
|
||||
<text x="184.5" y="15" fill="#010101" fill-opacity=".3">76.2438%</text>
|
||||
<text x="183.5" y="14">76.2438%</text>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -1,21 +0,0 @@
|
|||
#include <ultra64.h>
|
||||
#include "n_synth.h"
|
||||
|
||||
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/core1/audio/n_synthesizer/func_8025C370.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/core1/audio/n_synthesizer/_n_timeToSamples.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/core1/audio/n_synthesizer/_n_freePVoice.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/core1/audio/n_synthesizer/_n_collectPVoices.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/core1/audio/n_synthesizer/__n_freeParam.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/core1/audio/n_synthesizer/__n_allocParam.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/core1/audio/n_synthesizer/func_8025C4C0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/core1/audio/n_synthesizer/n_alAudioFrame.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/core1/audio/n_synthesizer/n_alSynNew.s")
|
|
@ -5,16 +5,16 @@
|
|||
|
||||
|
||||
void func_8025F610(void){
|
||||
n_syn->synth.head = NULL;
|
||||
n_syn->synth.n_seqp1 = NULL;
|
||||
n_syn->synth.n_seqp2 = NULL;
|
||||
n_syn->head = NULL;
|
||||
n_syn->n_seqp1 = NULL;
|
||||
n_syn->n_seqp2 = NULL;
|
||||
n_syn->unk5C = NULL;
|
||||
n_syn->unk60 = NULL;
|
||||
n_syn->unk64 = NULL;
|
||||
n_syn->unk68 = NULL;
|
||||
n_syn->unk6C = NULL;
|
||||
n_syn->unk70 = NULL;
|
||||
n_syn->synth.n_sndp = NULL;
|
||||
n_syn->n_sndp = NULL;
|
||||
}
|
||||
|
||||
void func_8025F5C0(N_ALSeqPlayer *arg0, u8 arg1){
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
Acmd *n_alAuxBusPull(s32 sampleOffset, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
N_ALAuxBus *m = (N_ALAuxBus *)n_syn->synth.auxBus;
|
||||
N_ALAuxBus *m = (N_ALAuxBus *)n_syn->auxBus;
|
||||
N_PVoice **sources = m->sources;
|
||||
s32 i;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ Acmd *n_alMainBusPull( s32 sampleOffset, Acmd *p)
|
|||
aClearBuffer(ptr++, N_AL_MAIN_L_OUT, N_AL_DIVIDED<<1);
|
||||
#endif
|
||||
|
||||
ptr = (n_syn->synth.mainBus->filter.handler)(sampleOffset,ptr);
|
||||
ptr = (n_syn->mainBus->filter.handler)(sampleOffset,ptr);
|
||||
|
||||
#ifndef N_MICRO
|
||||
aSetBuffer(ptr++, 0, 0, 0, FIXED_SAMPLE<<1);
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
n_aInterleave(ptr++);
|
||||
n_aSaveBuffer(ptr++, FIXED_SAMPLE<<2, 0, n_syn->synth.sv_dramout);
|
||||
n_aSaveBuffer(ptr++, FIXED_SAMPLE<<2, 0, n_syn->sv_dramout);
|
||||
|
|
|
@ -2,16 +2,15 @@
|
|||
#include "synthInternals.h"
|
||||
#include "n_synth.h"
|
||||
|
||||
extern AL0s *n_syn;
|
||||
|
||||
void n_alSynAddPlayer( ALPlayer *client)
|
||||
{
|
||||
OSIntMask mask = osSetIntMask(OS_IM_NONE);
|
||||
|
||||
client->samplesLeft = n_syn->synth.curSamples;
|
||||
client->samplesLeft = n_syn->curSamples;
|
||||
|
||||
client->next = n_syn->synth.head;
|
||||
n_syn->synth.head = client;
|
||||
client->next = n_syn->head;
|
||||
n_syn->head = client;
|
||||
|
||||
osSetIntMask(mask);
|
||||
}
|
||||
|
@ -20,15 +19,15 @@ void n_alSynAddSndPlayer( ALPlayer *client)
|
|||
{
|
||||
OSIntMask mask = osSetIntMask(OS_IM_NONE);
|
||||
|
||||
client->samplesLeft = n_syn->synth.curSamples;
|
||||
client->samplesLeft = n_syn->curSamples;
|
||||
|
||||
#if 1
|
||||
client->next = n_syn->synth.head;
|
||||
n_syn->synth.head = client;
|
||||
client->next = n_syn->head;
|
||||
n_syn->head = client;
|
||||
#endif
|
||||
|
||||
if( !(n_syn->synth.n_sndp) )
|
||||
n_syn->synth.n_sndp = client;
|
||||
if( !(n_syn->n_sndp) )
|
||||
n_syn->n_sndp = client;
|
||||
|
||||
osSetIntMask(mask);
|
||||
}
|
||||
|
@ -37,14 +36,14 @@ void n_alSynAddSeqPlayer(ALPlayer *client)
|
|||
{
|
||||
OSIntMask mask = osSetIntMask(OS_IM_NONE);
|
||||
|
||||
client->samplesLeft = n_syn->synth.curSamples;
|
||||
client->next = n_syn->synth.head;
|
||||
n_syn->synth.head = client;
|
||||
if(n_syn->synth.n_seqp1 == 0){
|
||||
n_syn->synth.n_seqp1 = client;
|
||||
client->samplesLeft = n_syn->curSamples;
|
||||
client->next = n_syn->head;
|
||||
n_syn->head = client;
|
||||
if(n_syn->n_seqp1 == 0){
|
||||
n_syn->n_seqp1 = client;
|
||||
}
|
||||
else if(n_syn->synth.n_seqp2 == 0){
|
||||
n_syn->synth.n_seqp2 = client;
|
||||
else if(n_syn->n_seqp2 == 0){
|
||||
n_syn->n_seqp2 = client;
|
||||
}
|
||||
else if(n_syn->unk5C == 0){
|
||||
n_syn->unk5C = client;
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
|
||||
ALFxRef n_alSynAllocFX( s16 bus, ALSynConfig *c, ALHeap *hp)
|
||||
{
|
||||
n_alFxNew(&n_syn->synth.auxBus->fx_array[bus], c, hp);
|
||||
return(n_syn->synth.auxBus->fx_array[bus]);
|
||||
n_alFxNew(&n_syn->auxBus->fx_array[bus], c, hp);
|
||||
return(n_syn->auxBus->fx_array[bus]);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ s32 n_alSynAllocVoice( N_ALVoice *voice, ALVoiceConfig *vc)
|
|||
* ramp down stolen voice
|
||||
*/
|
||||
update = __n_allocParam();
|
||||
update->delta = n_syn->synth.paramSamples;
|
||||
update->delta = n_syn->paramSamples;
|
||||
update->type = AL_FILTER_SET_VOLUME;
|
||||
update->data.i = 0;
|
||||
update->moredata.i = pvoice->offset - 64;
|
||||
|
@ -52,7 +52,7 @@ s32 n_alSynAllocVoice( N_ALVoice *voice, ALVoiceConfig *vc)
|
|||
*/
|
||||
update = __n_allocParam();
|
||||
if (update) {
|
||||
update->delta = n_syn->synth.paramSamples + pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + pvoice->offset;
|
||||
update->type = AL_FILTER_STOP_VOICE;
|
||||
update->next = 0;
|
||||
n_alEnvmixerResampleParam(voice->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
|
@ -79,16 +79,16 @@ s32 _n_allocatePVoice(N_PVoice **pvoice, s16 priority)
|
|||
N_PVoice *pv;
|
||||
s32 stolen = 0;
|
||||
|
||||
if ((dl = n_syn->synth.pLameList.next) != 0) { /* check the lame list first */
|
||||
if ((dl = n_syn->pLameList.next) != 0) { /* check the lame list first */
|
||||
*pvoice = (N_PVoice *) dl;
|
||||
alUnlink(dl);
|
||||
alLink(dl, &n_syn->synth.pAllocList);
|
||||
} else if ((dl = n_syn->synth.pFreeList.next) != 0) { /* from the free list */
|
||||
alLink(dl, &n_syn->pAllocList);
|
||||
} else if ((dl = n_syn->pFreeList.next) != 0) { /* from the free list */
|
||||
*pvoice = (N_PVoice *) dl;
|
||||
alUnlink(dl);
|
||||
alLink(dl, &n_syn->synth.pAllocList);
|
||||
alLink(dl, &n_syn->pAllocList);
|
||||
} else { /* steal one */
|
||||
for (dl = n_syn->synth.pAllocList.next; dl != 0; dl = dl->next) {
|
||||
for (dl = n_syn->pAllocList.next; dl != 0; dl = dl->next) {
|
||||
pv = (PVoice *)dl;
|
||||
|
||||
/*
|
||||
|
|
|
@ -15,7 +15,7 @@ void n_alSynFreeVoice(N_ALVoice *voice)
|
|||
/*
|
||||
* set voice data
|
||||
*/
|
||||
update->delta = n_syn->synth.paramSamples + voice->pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + voice->pvoice->offset;
|
||||
update->type = AL_FILTER_FREE_VOICE;
|
||||
update->pvoice = voice->pvoice;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ void n_alSynSetFXMix(N_ALVoice *v, u8 fxmix)
|
|||
/*
|
||||
* set offset and fxmix data
|
||||
*/
|
||||
update->delta = n_syn->synth.paramSamples + v->pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
update->type = AL_FILTER_SET_FXAMT;
|
||||
if (fxmix < 0)
|
||||
update->data.i = -fxmix;
|
||||
|
|
|
@ -17,7 +17,7 @@ void n_alSynSetPan(N_ALVoice *v, u8 pan)
|
|||
/*
|
||||
* set offset and pan data
|
||||
*/
|
||||
update->delta = n_syn->synth.paramSamples + v->pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
update->type = AL_FILTER_SET_PAN;
|
||||
update->data.i = pan;
|
||||
update->next = 0;
|
||||
|
|
|
@ -17,7 +17,7 @@ void n_alSynSetPitch( N_ALVoice *v, f32 pitch)
|
|||
/*
|
||||
* set offset and pitch data
|
||||
*/
|
||||
update->delta = n_syn->synth.paramSamples + v->pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
update->type = AL_FILTER_SET_PITCH;
|
||||
update->data.f = pitch;
|
||||
update->next = 0;
|
||||
|
|
|
@ -17,7 +17,7 @@ void n_alSynSetVol( N_ALVoice *v, s16 volume, ALMicroTime t)
|
|||
/*
|
||||
* set offset and volume data
|
||||
*/
|
||||
update->delta = n_syn->synth.paramSamples + v->pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
update->type = AL_FILTER_SET_VOLUME;
|
||||
update->data.i = volume;
|
||||
update->moredata.i = _n_timeToSamples( t);
|
||||
|
|
|
@ -35,7 +35,7 @@ void n_alSynStartVoice( N_ALVoice *v, ALWaveTable *table)
|
|||
#ifdef SAMPLE_ROUND
|
||||
update->delta = SAMPLE184( n_syn->paramSamples + v->pvoice->offset);
|
||||
#else
|
||||
update->delta = n_syn->synth.paramSamples + v->pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
#endif
|
||||
|
||||
update->type = AL_FILTER_START_VOICE;
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
#include "n_synth.h"
|
||||
|
||||
|
||||
extern AL0s *n_syn;
|
||||
|
||||
void n_alSynStartVoiceParams(N_ALVoice *v, ALWaveTable *w,
|
||||
f32 pitch, s16 vol, ALPan pan, u8 fxmix,
|
||||
ALMicroTime t)
|
||||
|
@ -26,7 +24,7 @@ void n_alSynStartVoiceParams(N_ALVoice *v, ALWaveTable *w,
|
|||
/*
|
||||
* set offset and fxmix data
|
||||
*/
|
||||
update->delta = n_syn->synth.paramSamples + v->pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
update->next = 0;
|
||||
update->type = AL_FILTER_START_VOICE_ALT;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ void n_alSynStopVoice( N_ALVoice *v)
|
|||
update = __n_allocParam();
|
||||
ALFailIf(update == 0, ERR_ALSYN_NO_UPDATE);
|
||||
|
||||
update->delta = n_syn->synth.paramSamples + v->pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
update->type = AL_FILTER_STOP_VOICE;
|
||||
update->next = 0;
|
||||
|
||||
|
|
|
@ -38,84 +38,84 @@ void n_alSynNew(ALSynConfig *c)
|
|||
ALParam *params;
|
||||
ALParam *paramPtr;
|
||||
|
||||
n_syn->synth.head = NULL;
|
||||
n_syn->synth.n_seqp1 = NULL;
|
||||
n_syn->synth.n_seqp2 = NULL;
|
||||
n_syn->head = NULL;
|
||||
n_syn->n_seqp1 = NULL;
|
||||
n_syn->n_seqp2 = NULL;
|
||||
n_syn->unk5C = NULL;
|
||||
n_syn->unk60 = NULL;
|
||||
n_syn->unk64 = NULL;
|
||||
n_syn->unk68 = NULL;
|
||||
n_syn->unk6C = NULL;
|
||||
n_syn->unk70 = NULL;
|
||||
n_syn->synth.n_sndp = NULL;
|
||||
n_syn->synth.numPVoices = c->maxPVoices;
|
||||
n_syn->synth.curSamples = 0;
|
||||
n_syn->synth.paramSamples = 0;
|
||||
n_syn->synth.outputRate = c->outputRate;
|
||||
n_syn->synth.maxOutSamples = N_AL_MAX_RSP_SAMPLES;
|
||||
n_syn->synth.dma = (ALDMANew) c->dmaproc;
|
||||
n_syn->n_sndp = NULL;
|
||||
n_syn->numPVoices = c->maxPVoices;
|
||||
n_syn->curSamples = 0;
|
||||
n_syn->paramSamples = 0;
|
||||
n_syn->outputRate = c->outputRate;
|
||||
n_syn->maxOutSamples = N_AL_MAX_RSP_SAMPLES;
|
||||
n_syn->dma = (ALDMANew) c->dmaproc;
|
||||
|
||||
n_syn->synth.sv_dramout = 0;
|
||||
n_syn->synth.sv_first = 1;
|
||||
n_syn->sv_dramout = 0;
|
||||
n_syn->sv_first = 1;
|
||||
|
||||
/*
|
||||
* allocate and initialize the auxilliary effects bus. at present
|
||||
* we only support 1 effects bus.
|
||||
*/
|
||||
n_syn->synth.auxBus = alHeapAlloc(hp, 1, sizeof(N_ALAuxBus));
|
||||
n_syn->synth.auxBus->sourceCount = 0;
|
||||
n_syn->synth.auxBus->maxSources = c->maxPVoices;
|
||||
n_syn->synth.auxBus->sources = alHeapAlloc(hp, c->maxPVoices, sizeof(ALFilter *));
|
||||
n_syn->auxBus = alHeapAlloc(hp, 1, sizeof(N_ALAuxBus));
|
||||
n_syn->auxBus->sourceCount = 0;
|
||||
n_syn->auxBus->maxSources = c->maxPVoices;
|
||||
n_syn->auxBus->sources = alHeapAlloc(hp, c->maxPVoices, sizeof(ALFilter *));
|
||||
|
||||
/*
|
||||
* allocate and initialize the main bus.
|
||||
*/
|
||||
n_syn->synth.mainBus = alHeapAlloc(hp, 1, sizeof(N_ALMainBus));
|
||||
n_syn->mainBus = alHeapAlloc(hp, 1, sizeof(N_ALMainBus));
|
||||
|
||||
if (c->fxType != AL_FX_NONE){
|
||||
/*
|
||||
* Allocate an effect and set parameters
|
||||
*/
|
||||
n_syn->synth.auxBus->fx = n_alSynAllocFX(0, c, hp);
|
||||
n_syn->synth.mainBus->filter.handler = &func_8025FE6C;
|
||||
n_syn->auxBus->fx = n_alSynAllocFX(0, c, hp);
|
||||
n_syn->mainBus->filter.handler = &func_8025FE6C;
|
||||
} else{
|
||||
/*
|
||||
* Connect the aux bus to the main bus
|
||||
*/
|
||||
n_syn->synth.mainBus->filter.handler = &n_alAuxBusPull;
|
||||
n_syn->mainBus->filter.handler = &n_alAuxBusPull;
|
||||
}
|
||||
/*
|
||||
* Build the physical voice lists
|
||||
*/
|
||||
n_syn->synth.pFreeList.next = 0;
|
||||
n_syn->synth.pFreeList.prev = 0;
|
||||
n_syn->synth.pLameList.next = 0;
|
||||
n_syn->synth.pLameList.prev = 0;
|
||||
n_syn->synth.pAllocList.next = 0;
|
||||
n_syn->synth.pAllocList.prev = 0;
|
||||
n_syn->pFreeList.next = 0;
|
||||
n_syn->pFreeList.prev = 0;
|
||||
n_syn->pLameList.next = 0;
|
||||
n_syn->pLameList.prev = 0;
|
||||
n_syn->pAllocList.next = 0;
|
||||
n_syn->pAllocList.prev = 0;
|
||||
|
||||
pvoices = alHeapAlloc(hp, c->maxPVoices, sizeof(N_PVoice));
|
||||
for (i = 0; i < c->maxPVoices; i++) {
|
||||
pv = &pvoices[i];
|
||||
alLink((ALLink *)pv, &n_syn->synth.pFreeList);
|
||||
alLink((ALLink *)pv, &n_syn->pFreeList);
|
||||
pv->vvoice = 0;
|
||||
alN_PVoiceNew(pv, n_syn->synth.dma, hp);
|
||||
n_syn->synth.auxBus->sources[n_syn->synth.auxBus->sourceCount] = pv;
|
||||
n_syn->synth.auxBus->sourceCount++;
|
||||
alN_PVoiceNew(pv, n_syn->dma, hp);
|
||||
n_syn->auxBus->sources[n_syn->auxBus->sourceCount] = pv;
|
||||
n_syn->auxBus->sourceCount++;
|
||||
}
|
||||
|
||||
/*
|
||||
* build the parameter update list
|
||||
*/
|
||||
params = alHeapAlloc(hp, c->maxUpdates, sizeof(ALParam));
|
||||
n_syn->synth.paramList = 0;
|
||||
n_syn->paramList = 0;
|
||||
for (i = 0; i < c->maxUpdates; i++) {
|
||||
paramPtr= ¶ms[i];
|
||||
paramPtr->next = n_syn->synth.paramList;
|
||||
n_syn->synth.paramList = paramPtr;
|
||||
paramPtr->next = n_syn->paramList;
|
||||
n_syn->paramList = paramPtr;
|
||||
}
|
||||
|
||||
n_syn->synth.heap = hp;
|
||||
n_syn->heap = hp;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -129,7 +129,6 @@ Acmd *n_alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen)
|
|||
ALFilter *output;
|
||||
s16 tmp; /* Starting buffer in DMEM */
|
||||
Acmd *cmdlEnd = cmdList;
|
||||
Acmd *cmdPtr;
|
||||
s32 nOut;
|
||||
s16 *lOutBuf = outBuf;
|
||||
|
||||
|
@ -137,7 +136,7 @@ Acmd *n_alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen)
|
|||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
if (n_syn->synth.head == 0) {
|
||||
if (n_syn->head == 0) {
|
||||
*cmdLen = 0;
|
||||
return cmdList; /* nothing to do */
|
||||
}
|
||||
|
@ -163,11 +162,11 @@ Acmd *n_alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen)
|
|||
* during the client handler.
|
||||
*/
|
||||
|
||||
for (n_syn->synth.paramSamples = func_8025C370(&client);
|
||||
n_syn->synth.paramSamples - n_syn->synth.curSamples < outLen;
|
||||
n_syn->synth.paramSamples = func_8025C370(&client))
|
||||
for (n_syn->paramSamples = func_8025C370(&client);
|
||||
n_syn->paramSamples - n_syn->curSamples < outLen;
|
||||
n_syn->paramSamples = func_8025C370(&client))
|
||||
{
|
||||
n_syn->synth.paramSamples &= ~0xf;
|
||||
n_syn->paramSamples &= ~0xf;
|
||||
client->samplesLeft += _n_timeToSamplesNoRound((*client->handler)(client));
|
||||
}
|
||||
|
||||
|
@ -176,7 +175,7 @@ Acmd *n_alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen)
|
|||
* routine (alSynAllocVoice) it will get timestamped with an aligned value and
|
||||
* will be processed immediately next audio frame.
|
||||
*/
|
||||
n_syn->synth.paramSamples &= ~0xf;
|
||||
n_syn->paramSamples &= ~0xf;
|
||||
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
|
@ -187,17 +186,17 @@ Acmd *n_alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen)
|
|||
* Now build the command list in small chunks
|
||||
*/
|
||||
while (outLen > 0){
|
||||
nOut = MIN(n_syn->synth.maxOutSamples, outLen);
|
||||
nOut = MIN(n_syn->maxOutSamples, outLen);
|
||||
|
||||
/*
|
||||
* construct the command list for each physical voice by calling
|
||||
* the head of the filter chain.
|
||||
*/
|
||||
n_syn->synth.sv_dramout = (s32) lOutBuf;
|
||||
cmdlEnd = n_alSavePull(n_syn->synth.curSamples, cmdlEnd);
|
||||
n_syn->sv_dramout = (s32) lOutBuf;
|
||||
cmdlEnd = n_alSavePull(n_syn->curSamples, cmdlEnd);
|
||||
outLen -= nOut;
|
||||
lOutBuf += nOut<<1; /* For Stereo */
|
||||
n_syn->synth.curSamples += nOut;
|
||||
n_syn->curSamples += nOut;
|
||||
|
||||
}
|
||||
*cmdLen = (s32) (cmdlEnd - cmdList);
|
||||
|
@ -218,9 +217,9 @@ ALParam *__allocParam()
|
|||
{
|
||||
ALParam *update = 0;
|
||||
|
||||
if (n_syn->synth.paramList) {
|
||||
update = n_syn->synth.paramList;
|
||||
n_syn->synth.paramList =n_syn->synth.paramList->next;
|
||||
if (n_syn->paramList) {
|
||||
update = n_syn->paramList;
|
||||
n_syn->paramList =n_syn->paramList->next;
|
||||
update->next = 0;
|
||||
}
|
||||
return update;
|
||||
|
@ -228,8 +227,8 @@ ALParam *__allocParam()
|
|||
|
||||
void __n_freeParam(ALParam *param)
|
||||
{
|
||||
param->next = n_syn->synth.paramList;
|
||||
n_syn->synth.paramList = param;
|
||||
param->next = n_syn->paramList;
|
||||
n_syn->paramList = param;
|
||||
}
|
||||
|
||||
void _n_collectPVoices()
|
||||
|
@ -237,13 +236,13 @@ void _n_collectPVoices()
|
|||
ALLink *dl;
|
||||
N_PVoice *pv;
|
||||
|
||||
while ((dl = n_syn->synth.pLameList.next) != 0) {
|
||||
while ((dl = n_syn->pLameList.next) != 0) {
|
||||
pv = (N_PVoice *)dl;
|
||||
|
||||
/* ### remove from mixer */
|
||||
|
||||
alUnlink(dl);
|
||||
alLink(dl, &n_syn->synth.pFreeList);
|
||||
alLink(dl, &n_syn->pFreeList);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,7 +252,7 @@ void _n_freePVoice(N_PVoice *pvoice)
|
|||
* move the voice from the allocated list to the lame list
|
||||
*/
|
||||
alUnlink((ALLink *)pvoice);
|
||||
alLink((ALLink *)pvoice, &n_syn->synth.pLameList);
|
||||
alLink((ALLink *)pvoice, &n_syn->pLameList);
|
||||
}
|
||||
|
||||
|
||||
|
@ -264,7 +263,7 @@ void _n_freePVoice(N_PVoice *pvoice)
|
|||
*/
|
||||
s32 _n_timeToSamplesNoRound(s32 micros)
|
||||
{
|
||||
f32 tmp = ((f32)micros) * n_syn->synth.outputRate / 1000000.0 + 0.5;
|
||||
f32 tmp = ((f32)micros) * n_syn->outputRate / 1000000.0 + 0.5;
|
||||
|
||||
return (s32)tmp;
|
||||
}
|
||||
|
@ -294,34 +293,33 @@ s32 _n_timeToSamples(s32 micros)
|
|||
|
||||
static s32 func_8025C370(ALPlayer **client)
|
||||
{
|
||||
ALMicroTime delta = 0x7fffffff; /* max delta for s32 */
|
||||
ALMicroTime idelta;
|
||||
ALMicroTime delta = 0x7fffffff; /* max delta for s32 */
|
||||
ALPlayer *cl;
|
||||
|
||||
*client = 0;
|
||||
|
||||
cl = n_syn->synth.n_sndp;
|
||||
if(n_syn->synth.n_sndp != NULL){
|
||||
idelta = (cl->samplesLeft - n_syn->synth.curSamples);
|
||||
|
||||
if(n_syn->n_sndp != NULL){
|
||||
idelta = (n_syn->n_sndp->samplesLeft - n_syn->curSamples);
|
||||
if (idelta < delta) {
|
||||
*client = n_syn->n_sndp;
|
||||
delta = idelta;
|
||||
}
|
||||
}
|
||||
|
||||
cl = n_syn->n_seqp1;
|
||||
if(cl != NULL){
|
||||
idelta = (cl->samplesLeft - n_syn->curSamples);
|
||||
if (idelta < delta) {
|
||||
*client = cl;
|
||||
delta = idelta;
|
||||
}
|
||||
}
|
||||
|
||||
cl = n_syn->synth.n_seqp1;
|
||||
cl = n_syn->n_seqp2;
|
||||
if(cl != NULL){
|
||||
idelta = (cl->samplesLeft - n_syn->synth.curSamples);
|
||||
if (idelta < delta) {
|
||||
*client = cl;
|
||||
delta = idelta;
|
||||
}
|
||||
}
|
||||
|
||||
cl = n_syn->synth.n_seqp2;
|
||||
if(cl != NULL){
|
||||
idelta = (cl->samplesLeft - n_syn->synth.curSamples);
|
||||
if (idelta < delta) {
|
||||
if ((cl->samplesLeft - n_syn->curSamples) < delta) {
|
||||
*client = cl;
|
||||
delta = idelta;
|
||||
}
|
||||
|
@ -329,8 +327,7 @@ static s32 func_8025C370(ALPlayer **client)
|
|||
|
||||
cl = n_syn->unk5C;
|
||||
if(cl != NULL){
|
||||
idelta = (cl->samplesLeft - n_syn->synth.curSamples);
|
||||
if (idelta < delta) {
|
||||
if ((cl->samplesLeft - n_syn->curSamples) < delta) {
|
||||
*client = cl;
|
||||
delta = idelta;
|
||||
}
|
||||
|
@ -338,8 +335,7 @@ static s32 func_8025C370(ALPlayer **client)
|
|||
|
||||
cl = n_syn->unk60;
|
||||
if(cl != NULL){
|
||||
idelta = (cl->samplesLeft - n_syn->synth.curSamples);
|
||||
if (idelta < delta) {
|
||||
if ((cl->samplesLeft - n_syn->curSamples) < delta) {
|
||||
*client = cl;
|
||||
delta = idelta;
|
||||
}
|
||||
|
@ -347,8 +343,7 @@ static s32 func_8025C370(ALPlayer **client)
|
|||
|
||||
cl = n_syn->unk64;
|
||||
if(cl != NULL){
|
||||
idelta = (cl->samplesLeft - n_syn->synth.curSamples);
|
||||
if (idelta < delta) {
|
||||
if ((cl->samplesLeft - n_syn->curSamples) < delta) {
|
||||
*client = cl;
|
||||
delta = idelta;
|
||||
}
|
||||
|
@ -356,8 +351,7 @@ static s32 func_8025C370(ALPlayer **client)
|
|||
|
||||
cl = n_syn->unk68;
|
||||
if(cl != NULL){
|
||||
idelta = (cl->samplesLeft - n_syn->synth.curSamples);
|
||||
if (idelta < delta) {
|
||||
if ((cl->samplesLeft - n_syn->curSamples) < delta) {
|
||||
*client = cl;
|
||||
delta = idelta;
|
||||
}
|
||||
|
@ -365,8 +359,7 @@ static s32 func_8025C370(ALPlayer **client)
|
|||
|
||||
cl = n_syn->unk6C;
|
||||
if(cl != NULL){
|
||||
idelta = (cl->samplesLeft - n_syn->synth.curSamples);
|
||||
if (idelta < delta) {
|
||||
if ((cl->samplesLeft - n_syn->curSamples) < delta) {
|
||||
*client = cl;
|
||||
delta = idelta;
|
||||
}
|
||||
|
@ -374,8 +367,7 @@ static s32 func_8025C370(ALPlayer **client)
|
|||
|
||||
cl = n_syn->unk70;
|
||||
if(cl != NULL){
|
||||
idelta = (cl->samplesLeft - n_syn->synth.curSamples);
|
||||
if (idelta < delta) {
|
||||
if ((cl->samplesLeft - n_syn->curSamples) < delta) {
|
||||
*client = cl;
|
||||
delta = idelta;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ segments:
|
|||
- [0x1E6E0, c, code_1E6E0] #DONE
|
||||
- [0x1E820, c, code_1E820]
|
||||
- [0x1E8C0, c, done/code_1E8C0] #DONE
|
||||
- [0x1E950, c, done/audio/n_synthesizer] # audio/n_synthesizer]
|
||||
- [0x1E950, c, done/audio/n_synthesizer] #DONE
|
||||
- [0x1F330, c, done/audio/event] #DONE
|
||||
- [0x1F610, c, done/audio/n_synaddplayer] #DONE
|
||||
- [0x1F7E0, c, done/audio/n_synallocvoice] #DONE
|
||||
|
|
Loading…
Reference in New Issue