qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fixed unknown audio format with SDL2


From: KJ Liew
Subject: Fixed unknown audio format with SDL2
Date: Thu, 16 Jan 2020 10:27:54 -0800

 

SDL2 (version >=2.0) prefers float32 audio format over integer audio format. QEMU sdlaudio.c does not handle any kind of AUDIO_F32 formats, but SDL_OpenAudio(req, obt) will return float32 audio format in obt and QEMU prints error about unknown format 33056 (0x8120).

 

The following simple patch fix the error by forcing SDL2 internal audio format conversion.

 

diff -ru ../orig/qemu-4.2.0/audio/sdlaudio.c ../qemu-4.2.0/audio/sdlaudio.c

--- ../orig/qemu-4.2.0/audio/sdlaudio.c 2019-12-12 10:20:47.000000000 -0800

+++ ../qemu-4.2.0/audio/sdlaudio.c      2020-01-15 15:56:25.059841600 -0800

@@ -147,10 +147,11 @@

     }

#endif

 

-    status = SDL_OpenAudio (req, obt);

+    status = SDL_OpenAudio (req, NULL);

     if (status) {

         sdl_logerr ("SDL_OpenAudio failed\n");

     }

+    memcpy(obt, req, sizeof(SDL_AudioSpec));

 

#ifndef _WIN32

     err = pthread_sigmask (SIG_SETMASK, &old, NULL);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]