mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-23 14:31:56 +00:00
audio: Added a hint to let apps force device buffer size.
This is a hint because apps might (probably mistakenly) believe they need this to migrate from SDL2, but most things don't need to specify this.
This commit is contained in:
parent
47d8c77c67
commit
cf95721130
2 changed files with 30 additions and 2 deletions
|
|
@ -1248,6 +1248,14 @@ static void PrepareAudioFormat(SDL_bool iscapture, SDL_AudioSpec *spec)
|
|||
|
||||
static int GetDefaultSampleFramesFromFreq(const int freq)
|
||||
{
|
||||
const char *hint = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES);
|
||||
if (hint) {
|
||||
const int val = SDL_atoi(hint);
|
||||
if (val > 0) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
if (freq <= 11025) {
|
||||
return 512;
|
||||
} else if (freq <= 22050) {
|
||||
|
|
@ -1256,9 +1264,9 @@ static int GetDefaultSampleFramesFromFreq(const int freq)
|
|||
return 2048;
|
||||
} else if (freq <= 96000) {
|
||||
return 4096;
|
||||
} else {
|
||||
return 8192; // shrug
|
||||
}
|
||||
|
||||
return 8192; // shrug
|
||||
}
|
||||
|
||||
void SDL_UpdatedAudioDeviceFormat(SDL_AudioDevice *device)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue