Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 8574 → Rev 8575

/source/audiolib/src/driver_adlib.cpp
117,9 → 117,9
void AdLibDrv_MIDI_Service(void)
{
int16_t * buffer16 = (int16_t *)MV_MusicBuffer;
int const samples = MV_BufferSize >> 2;
int32_t const samples = MV_MIXBUFFERSIZE;
 
for (int i = 0; i < samples; i++)
for (int32_t i = 0; i < samples; i++)
{
Bit16s buf[2];
while (MV_MIDIRenderTimer >= MV_MixRate)
130,8 → 130,13
}
if (MV_MIDIRenderTempo >= 0) MV_MIDIRenderTimer += MV_MIDIRenderTempo;
OPL3_GenerateResampled(AL_GetChip(), buf);
*buffer16++ = clamp(buf[0]<<AL_PostAmp, INT16_MIN, INT16_MAX);
*buffer16++ = clamp(buf[1]<<AL_PostAmp, INT16_MIN, INT16_MAX);
if (MV_Channels == 2)
{
*buffer16++ = clamp(buf[0]<<AL_PostAmp, INT16_MIN, INT16_MAX);
*buffer16++ = clamp(buf[1]<<AL_PostAmp, INT16_MIN, INT16_MAX);
}
else
*buffer16++ = clamp(((buf[0]<<AL_PostAmp)+(buf[1]<<AL_PostAmp))/2, INT16_MIN, INT16_MAX);
}
}
 
/source/audiolib/src/multivoc.cpp
280,13 → 280,8
MV_MusicCallback();
int16_t * __restrict source = (int16_t*)MV_MusicBuffer;
int16_t * __restrict dest = (int16_t*)MV_MixBuffer[MV_MixPage+MV_NumberOfBuffers];
for (int32_t i = 0; i < MV_BufferSize>>2; i++)
{
for (int32_t i = 0; i < MV_BufferSize>>1; i++, dest++)
*dest = clamp(*dest + *source++,INT16_MIN, INT16_MAX);
dest++;
*dest = clamp(*dest + *source++,INT16_MIN, INT16_MAX);
dest++;
}
}
}
 
814,7 → 809,7
MV_SetErrorCode(MV_Ok);
 
// MV_TotalMemory + 2: FIXME, see valgrind_errors.log
int const totalmem = Voices * sizeof(VoiceNode) + (MV_TOTALBUFFERSIZE<<1) + (MV_MIXBUFFERSIZE<<2) + 2;
int const totalmem = Voices * sizeof(VoiceNode) + (MV_TOTALBUFFERSIZE<<1) + (MV_MIXBUFFERSIZE*numchannels*2) + 2;
 
char *ptr = (char *) Xaligned_alloc(16, totalmem);