Minor format tweaks
This commit is contained in:
parent
6445200a93
commit
e95d8bc655
8 changed files with 60 additions and 36 deletions
|
@ -785,7 +785,7 @@ Sound LoadSoundFromWave(Wave wave)
|
|||
//
|
||||
// First option has been selected, format conversion is done on the loading stage.
|
||||
// The downside is that it uses more memory if the original sound is u8 or s16.
|
||||
ma_format formatIn = ((wave.sampleSize == 8)? ma_format_u8 : ((wave.sampleSize == 16)? ma_format_s16 : ma_format_f32));
|
||||
ma_format formatIn = ((wave.sampleSize == 8)? ma_format_u8 : ((wave.sampleSize == 16)? ma_format_s16 : ma_format_f32));
|
||||
ma_uint32 frameCountIn = wave.sampleCount/wave.channels;
|
||||
|
||||
ma_uint32 frameCount = (ma_uint32)ma_convert_frames(NULL, 0, AUDIO_DEVICE_FORMAT, AUDIO_DEVICE_CHANNELS, AUDIO.System.device.sampleRate, NULL, frameCountIn, formatIn, wave.channels, wave.sampleRate);
|
||||
|
@ -2108,7 +2108,7 @@ static void OnSendAudioDataToDevice(ma_device *pDevice, void *pFramesOut, const
|
|||
if (framesJustRead > 0)
|
||||
{
|
||||
float *framesOut = (float *)pFramesOut + (framesRead*AUDIO.System.device.playback.channels);
|
||||
float *framesIn = tempBuffer;
|
||||
float *framesIn = tempBuffer;
|
||||
|
||||
MixAudioFrames(framesOut, framesIn, framesJustRead, audioBuffer->volume);
|
||||
|
||||
|
@ -2159,7 +2159,7 @@ static void MixAudioFrames(float *framesOut, const float *framesIn, ma_uint32 fr
|
|||
for (ma_uint32 iChannel = 0; iChannel < AUDIO.System.device.playback.channels; ++iChannel)
|
||||
{
|
||||
float *frameOut = framesOut + (iFrame*AUDIO.System.device.playback.channels);
|
||||
const float *frameIn = framesIn + (iFrame*AUDIO.System.device.playback.channels);
|
||||
const float *frameIn = framesIn + (iFrame*AUDIO.System.device.playback.channels);
|
||||
|
||||
frameOut[iChannel] += (frameIn[iChannel]*localVolume);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue