All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Courtier-Dutton <James@superbug.demon.co.uk>
To: ALSA development <alsa-devel@alsa-project.org>
Subject: Improving wine support for alsa.
Date: Thu, 06 May 2004 18:15:56 +0000	[thread overview]
Message-ID: <409A80DC.2080601@superbug.demon.co.uk> (raw)

Hi,

I have been updating the wine alsa driver to work better with alsa.
So far, all I have done is update it to use the new alsa api.
Windows uses an api called Direct Sound.
Direct Sound uses direct hardware buffer access.
A Win32 program can quiry the sound driver and ask for the currently 
playing position, together with the first available possition that the 
application could write to. I will call these "PlayPos" and "WritePos" 
respectively.
E.g. If the hardware is halfway through playing one period(the PlayPos 
is in the middle of a period), the beginning of the next period's 
position is returned as the "WritePos".

The problem arrives because the Win32 app expects to have full write 
access to the hardware buffer, and can write to any parts of it at any 
time. The sound card should just happily move through the buffer playing 
each sample as it goes, and when it reaches the end, just start at the 
beginning again.

The alsa api is based more around the sound card asking for the next 
block of samples.

Strangely enough, it Direct Sound works fine when using oss emulation in 
alsa.

I was trying to just get alsa to copy samples from the Direct Sound 
buffer on a just in time basis.

I was starting with writing one period to the sound card, calling 
snd_pcm_start(), then setting snd_async_add_pcm_handler(), expecting the 
handler to be called on each period, but the handler is never called.

For some reason, the handler does not seem to get called on each period 
elasped as I was expecting.

Another problem is that if I want to stop the stream, I call 
"snd_pcm_drop(). With this I would expect snd_pcm_delay()==0 and 
snd_pcm_avail_update()==buffer_size.
It seems that these values are only reset to 0 after first calling 
snd_pcm_prepare().
After stopping the stream in this way, I want to restart it again 
without having to close/open the pcm.

Can anyone give me advice as to what I am doing wrong ?

Cheers
James


-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3

             reply	other threads:[~2004-05-06 18:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-06 18:15 James Courtier-Dutton [this message]
2004-05-06 22:30 ` Improving wine support for alsa Arve Knudsen
2004-05-06 23:42   ` Glenn Maynard
2004-05-07  1:49     ` Paul Davis
2004-05-07  4:02       ` Glenn Maynard
2004-05-07 10:12         ` Ferenc Wagner
2004-05-07 11:03         ` Paul Davis
2004-05-07 12:35       ` James Courtier-Dutton
2004-05-07  1:14 ` Ove Kaaven

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=409A80DC.2080601@superbug.demon.co.uk \
    --to=james@superbug.demon.co.uk \
    --cc=alsa-devel@alsa-project.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.