Add SurfaceFlags, and more formatting :)
This commit is contained in:
@@ -171,9 +171,6 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex)
|
||||
struct ReverbRingBufferItem *item;
|
||||
s32 srcPos;
|
||||
s32 dstPos;
|
||||
s32 nSamples;
|
||||
s32 numSamplesAfterDownsampling;
|
||||
s32 excessiveSamples;
|
||||
if (gReverbDownsampleRate != 1)
|
||||
{
|
||||
if (gSynthesisReverb.framesLeftToIgnore == 0)
|
||||
@@ -202,7 +199,7 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex)
|
||||
}
|
||||
item = &gSynthesisReverb.items[gSynthesisReverb.curFrame][updateIndex];
|
||||
|
||||
numSamplesAfterDownsampling = chunkLen / gReverbDownsampleRate;
|
||||
s32 numSamplesAfterDownsampling = chunkLen / gReverbDownsampleRate;
|
||||
if (numSamplesAfterDownsampling + gSynthesisReverb.nextRingBufferPos - gSynthesisReverb.bufSizePerChannel < 0)
|
||||
{
|
||||
// There is space in the ring buffer before it wraps around
|
||||
@@ -214,9 +211,8 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex)
|
||||
else
|
||||
{
|
||||
// Ring buffer wrapped around
|
||||
excessiveSamples =
|
||||
numSamplesAfterDownsampling + gSynthesisReverb.nextRingBufferPos - gSynthesisReverb.bufSizePerChannel;
|
||||
nSamples = numSamplesAfterDownsampling - excessiveSamples;
|
||||
s32 excessiveSamples = numSamplesAfterDownsampling + gSynthesisReverb.nextRingBufferPos - gSynthesisReverb.bufSizePerChannel;
|
||||
s32 nSamples = numSamplesAfterDownsampling - excessiveSamples;
|
||||
item->lengthA = nSamples * 2;
|
||||
item->lengthB = excessiveSamples * 2;
|
||||
item->startPos = gSynthesisReverb.nextRingBufferPos;
|
||||
@@ -368,14 +364,12 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen)
|
||||
{
|
||||
DEBUG_PRINT("synthesis_execute()");
|
||||
s32 chunkLen;
|
||||
s32 i;
|
||||
u32 *aiBufPtr = (u32 *)aiBuf;
|
||||
u64 *cmd = cmdBuf + 1;
|
||||
s32 v0;
|
||||
|
||||
aSegment(cmdBuf, 0, 0);
|
||||
|
||||
for (i = gAudioUpdatesPerFrame; i > 0; i--)
|
||||
for (s32 i = gAudioUpdatesPerFrame; i > 0; i--)
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
@@ -384,7 +378,7 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen)
|
||||
}
|
||||
else
|
||||
{
|
||||
v0 = bufLen / i;
|
||||
s32 v0 = bufLen / i;
|
||||
// chunkLen = v0 rounded to nearest multiple of 8
|
||||
chunkLen = v0 - (v0 & 7);
|
||||
|
||||
@@ -592,17 +586,14 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
|
||||
DEBUG_PRINT("synthesis_do_one_audio_update()");
|
||||
|
||||
UNUSED s32 pad1[1];
|
||||
s16 ra;
|
||||
s16 t4;
|
||||
UNUSED s32 pad[2];
|
||||
struct ReverbRingBufferItem *v1;
|
||||
UNUSED s32 pad2[1];
|
||||
s16 temp;
|
||||
|
||||
DEBUG_PRINT("- curFrame: %d", gSynthesisReverb.curFrame);
|
||||
DEBUG_PRINT("- updateIndex: %d", updateIndex);
|
||||
|
||||
v1 = &gSynthesisReverb.items[gSynthesisReverb.curFrame][updateIndex];
|
||||
struct ReverbRingBufferItem *v1 = &gSynthesisReverb.items[gSynthesisReverb.curFrame][updateIndex];
|
||||
DEBUG_PRINT("- v1: %x", v1);
|
||||
|
||||
if (gSynthesisReverb.useReverb == 0)
|
||||
@@ -649,8 +640,8 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
|
||||
|
||||
// Same as above but upsample the previously downsampled samples used for reverb first
|
||||
temp = 0; //! jesus christ
|
||||
t4 = (v1->startPos & 7) * 2;
|
||||
ra = ALIGN(v1->lengthA + t4, 4);
|
||||
s16 t4 = (v1->startPos & 7) * 2;
|
||||
s16 ra = ALIGN(v1->lengthA + t4, 4);
|
||||
DEBUG_PRINT("- set load buffer pair");
|
||||
aSetLoadBufferPair(cmd++, 0, v1->startPos - t4 / 2);
|
||||
if (v1->lengthB != 0)
|
||||
@@ -1126,16 +1117,14 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd)
|
||||
|
||||
u64 *load_wave_samples(u64 *cmd, struct Note *note, s32 nSamplesToLoad)
|
||||
{
|
||||
s32 a3;
|
||||
s32 i;
|
||||
aSetBuffer(cmd++, /*flags*/ 0, /*dmemin*/ DMEM_ADDR_UNCOMPRESSED_NOTE, /*dmemout*/ 0,
|
||||
/*count*/ sizeof(note->synthesisBuffers->samples));
|
||||
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->samples));
|
||||
note->samplePosInt &= note->sampleCount - 1;
|
||||
a3 = 64 - note->samplePosInt;
|
||||
s32 a3 = 64 - note->samplePosInt;
|
||||
if (a3 < nSamplesToLoad)
|
||||
{
|
||||
for (i = 0; i <= (nSamplesToLoad - a3 + 63) / 64 - 1; i++)
|
||||
for (s32 i = 0; i <= (nSamplesToLoad - a3 + 63) / 64 - 1; i++)
|
||||
{
|
||||
aDMEMMove(cmd++, /*dmemin*/ DMEM_ADDR_UNCOMPRESSED_NOTE, /*dmemout*/ DMEM_ADDR_UNCOMPRESSED_NOTE + (1 + i) * sizeof(note->synthesisBuffers->samples), /*count*/ sizeof(note->synthesisBuffers->samples));
|
||||
}
|
||||
@@ -1522,10 +1511,8 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, f32 pan, u8 reverb
|
||||
}
|
||||
else if (note->stereoHeadsetEffects && gSoundMode == SOUND_MODE_STEREO)
|
||||
{
|
||||
u8 strongLeft;
|
||||
u8 strongRight;
|
||||
strongLeft = FALSE;
|
||||
strongRight = FALSE;
|
||||
u8 strongLeft = FALSE;
|
||||
u8 strongRight = FALSE;
|
||||
note->headsetPanLeft = 0;
|
||||
note->headsetPanRight = 0;
|
||||
note->usesHeadsetPanEffects = FALSE;
|
||||
|
||||
Reference in New Issue
Block a user