[Top][All Lists]

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

Re: [Qemu-devel] [PATCH] PC speaker emulation

From: malc
Subject: Re: [Qemu-devel] [PATCH] PC speaker emulation
Date: Thu, 19 Jan 2006 03:32:41 +0300 (MSK)

On Thu, 19 Jan 2006, Joachim Henke wrote:

Ok, here is it - my first attempt for emulating the PC speaker using the audio API. This needs some testing, tough it seems to work well with full system emulation on my iMac G5. Would be nice if someone could test this in a different environment (on a PC, in user mode, ...).

With my patch, QEMU plays a sine wave, that is calculated on base of the count value in PIT channel 2. So it only supports tone generation (typical for system beeps), but no sample playing using two PITs (I mean that noisy sound from old DOS programs :) - It would probably be not that easy to emulate this in realtime.

The attached zip file also includes a DOS program, that came with an old computer book. It plays a long tone scale, each tone half a second. You can use this for testing, but maybe you have some more interesting applications.

The patch is probably a bit too hackish to be included yet. As I am a bit busy these days, I just sent it as a request for comments. I would prefer to use a sample rate of 32000 instead of 44100 Hz, but when playing with sample rates of 22050 or 32000 Hz, QEMU becomes so slow and unusable, that I need to kill it. I don't know if this is something Mac specific. malc, could you please have a look, if I use your audio API correctly?


a. Writing more than `free' bytes of data is pointless
b. Once AUD_write return zero one should stop writing untill some space
   becomes available (for all intents and purposes after callback
   will be called next time)

Item b is probably why it hangs: you try to write N bytes, AUD_write
returns zero, yet you are tring again immediately - ad nauseam. We
have only one thread - hence audio can not push the data out of
internal buffers into the host, and what you get is an infinite loop.


reply via email to

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