qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: malc <malc@pulsesoft.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] PC speaker emulation
Date: Thu, 19 Jan 2006 03:32:41 +0300 (MSK)	[thread overview]
Message-ID: <Pine.LNX.4.61.0601190326030.4127@home.oyster.ru> (raw)
In-Reply-To: <66187480-AA25-4749-B6E7-8630B804A6EA@gmx.de>

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?

Nope.

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.

--
mailto:malc@pulsesoft.com

  parent reply	other threads:[~2006-01-19  0:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-09 19:01 [Qemu-devel] [patch] minimal PC speaker output Joachim Henke
2006-01-09 20:40 ` Fabrice Bellard
2006-01-10  9:11   ` he.jo
2006-01-18 23:05   ` [Qemu-devel] [PATCH] PC speaker emulation Joachim Henke
2006-01-18 23:32     ` [Qemu-devel] " Joachim Henke
2006-01-19  0:32     ` malc [this message]
2006-01-19 20:44       ` [Qemu-devel] [PATCH] PC speaker emulation (fixed) Joachim Henke
2006-01-19 23:29         ` malc
2006-01-20  9:42           ` Joachim Henke
2006-01-20 13:03             ` Johannes Schindelin
2006-01-20 12:03           ` Sebastian Kaliszewski
2006-01-23 21:10             ` [Qemu-devel] [PATCH] PC speaker emulation (fixed point) Joachim Henke
2006-01-24 12:35               ` Sebastian Kaliszewski
2006-01-24 15:50                 ` Joachim Henke
2006-01-24 18:29                   ` Sebastian Kaliszewski
2006-01-24 21:45                     ` Fabrice Bellard
2006-01-25  0:38                       ` Sebastian Kaliszewski
2006-01-25 21:54                       ` [Qemu-devel] [PATCH] PC speaker emulation (square wave) Joachim Henke
2006-01-26  4:50                         ` Jamie Lokier
2006-01-26 16:55                         ` Sebastian Kaliszewski
2006-01-29 10:44                           ` Joachim Henke
  -- strict thread matches above, loose matches on Subject: below --
2006-02-06 20:57 [Qemu-devel] [PATCH] PC speaker emulation Joachim Henke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0601190326030.4127@home.oyster.ru \
    --to=malc@pulsesoft.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).