[AUDIO] Use device native sample rates (#1660)

* Init MinAudio to a sample rate of 0 to let the device pick the rate.
Read the rate from the device after it starts up.
Convert AUDIO_DEVICE_SAMPLE_RATE from a #def into an int, that is set from the device's rate
Set all sample systems to use the AUDIO_DEVICE_SAMPLE_RATE as the target rate to minimize resampling.

* use device sample rate instead of separate var
let config define a device sample rate if it wants to, but let the default be 0 for native rate.

* Don't use fixed sample rates for tracker files.
Remove config default audio buffer size and replace with a function that computes one for a reasonable frame rate at the output sample rate.
This commit is contained in:
Jeffery Myers 2021-03-21 14:07:55 -07:00 committed by GitHub
parent c37f61d31f
commit b573ff3e7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 17 deletions

View file

@ -195,9 +195,8 @@
//------------------------------------------------------------------------------------
#define AUDIO_DEVICE_FORMAT ma_format_f32 // Device output format (miniaudio: float-32bit)
#define AUDIO_DEVICE_CHANNELS 2 // Device output channels: stereo
#define AUDIO_DEVICE_SAMPLE_RATE 44100 // Device output sample rate
#define AUDIO_DEVICE_SAMPLE_RATE 0 // Device sample rate (device default)
#define DEFAULT_AUDIO_BUFFER_SIZE 4096 // Default audio buffer size for streaming
#define MAX_AUDIO_BUFFER_POOL_CHANNELS 16 // Maximum number of audio pool channels
//------------------------------------------------------------------------------------