mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-17 07:16:00 +00:00
Added SDL_AUDIO_BYTESIZE
This commit is contained in:
@@ -766,7 +766,7 @@ SDL_bool SDL_OutputAudioThreadIterate(SDL_AudioDevice *device)
|
||||
case MIXSTRATEGY_MIX: {
|
||||
//SDL_Log("MIX STRATEGY: MIX");
|
||||
float *mix_buffer = (float *) ((device->spec.format == SDL_AUDIO_F32) ? device_buffer : device->mix_buffer);
|
||||
const int needed_samples = buffer_size / (SDL_AUDIO_BITSIZE(device->spec.format) / 8);
|
||||
const int needed_samples = buffer_size / SDL_AUDIO_BYTESIZE(device->spec.format);
|
||||
const int work_buffer_size = needed_samples * sizeof (float);
|
||||
SDL_AudioSpec outspec;
|
||||
|
||||
@@ -832,7 +832,7 @@ SDL_bool SDL_OutputAudioThreadIterate(SDL_AudioDevice *device)
|
||||
void SDL_OutputAudioThreadShutdown(SDL_AudioDevice *device)
|
||||
{
|
||||
SDL_assert(!device->iscapture);
|
||||
const int samples = (device->buffer_size / (SDL_AUDIO_BITSIZE(device->spec.format) / 8)) / device->spec.channels;
|
||||
const int samples = (device->buffer_size / SDL_AUDIO_BYTESIZE(device->spec.format)) / device->spec.channels;
|
||||
// Wait for the audio to drain. !!! FIXME: don't bother waiting if device is lost.
|
||||
SDL_Delay(((samples * 1000) / device->spec.freq) * 2);
|
||||
current_audio.impl.ThreadDeinit(device);
|
||||
@@ -1261,7 +1261,7 @@ static int GetDefaultSampleFramesFromFreq(int freq)
|
||||
void SDL_UpdatedAudioDeviceFormat(SDL_AudioDevice *device)
|
||||
{
|
||||
device->silence_value = SDL_GetSilenceValueForFormat(device->spec.format);
|
||||
device->buffer_size = device->sample_frames * (SDL_AUDIO_BITSIZE(device->spec.format) / 8) * device->spec.channels;
|
||||
device->buffer_size = device->sample_frames * SDL_AUDIO_BYTESIZE(device->spec.format) * device->spec.channels;
|
||||
device->work_buffer_size = device->sample_frames * sizeof (float) * device->spec.channels;
|
||||
device->work_buffer_size = SDL_max(device->buffer_size, device->work_buffer_size); // just in case we end up with a 64-bit audio format at some point.
|
||||
}
|
||||
|
Reference in New Issue
Block a user