audio: recording devices also need to update their streams' channel maps.

This commit is contained in:
Ryan C. Gordon 2024-07-19 20:35:18 -04:00
parent 068c785491
commit e1aa995732
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
1 changed files with 9 additions and 1 deletions

View File

@ -234,7 +234,15 @@ static SDL_bool AudioDeviceCanUseSimpleCopy(SDL_AudioDevice *device)
// should hold device->lock before calling.
static void UpdateAudioStreamFormatsPhysical(SDL_AudioDevice *device)
{
if (!device->recording) { // for recording devices, we only want to move to float32 for postmix, which we'll handle elsewhere.
if (device->recording) { // for recording devices, we only want to move to float32 for postmix and gain, which we'll handle elsewhere.
// we _do_ need to make sure the channel map is correct, though...
for (SDL_LogicalAudioDevice *logdev = device->logical_devices; logdev; logdev = logdev->next) {
for (SDL_AudioStream *stream = logdev->bound_streams; stream; stream = stream->next_binding) {
// set the proper end of the stream to the device's channel map. This will obtain stream->lock itself.
SetAudioStreamChannelMap(stream, &stream->src_spec, &stream->src_chmap, device->chmap, device->spec.channels, -1);
}
}
} else {
const SDL_bool simple_copy = AudioDeviceCanUseSimpleCopy(device);
SDL_AudioSpec spec;