All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaroslaw Sobierski <fycio@gucio.com>
To: perex@suse.cz
Cc: T.Motylewski@bfad.de, abramo.bagnara@libero.it,
	alsa-devel@lists.sourceforge.net
Subject: Re: Re: dmix plugin
Date: Mon, 17 Feb 2003 14:28:58 -0800	[thread overview]
Message-ID: <1045520938.3e51622ad5e37@webmail2.namezero.com> (raw)


>> On Mon, 17 Feb 2003, Jaroslav Kysela wrote:
>> 
>> > Note that your all nice ideas go to some blind alley. Who will silence the 
>> > sum buffer? Driver silences only hardware buffer which will not be used 
>> > for the calculation in your algorithm.
>> 
>> Silencing is not time critical, if buffer is big enough it does not matter
>> whether is it done 1 ms or 100 ms after the card has played the data. Therefore
>> it may be done by a separate thread/process/kernel task without any
>> interference with other processes writing to the buffer.
>
>It is time critical for the dmix plugin, because other processes might 
>write new samples to "empty" areas.
>

Clearing the sum buffer would be a task analogous, or I should probably say
reverse, to the saturation operation. You see, before you take the value in
the sum buffer and add your sample and so forth, you can check if the 
destination sample in the DMA buffer is zero. If it is, you disregard the
value in the sum (it is now considered stale), overwrite it with your sample
and proceed to saturate it normally. If another thread has already written
something there - the final buffer will be non-zero, and you proceed as
discussed before, if another thread has written zeroes,or the result has
summed up to zero - it still doesn't matter, because then the sum buffer 
would also have to contain a zero so it is right to disregard it's value. 
And that's it. OK, some synchronization would be in order so that you don't 
kill a sample just written by some other thread as in:

A                         B
check hw buff 0? yes
                          check hw buff 0? yes
                          write B sample to sum/hw
write A sample to sum/hw

A re-read after the write does not solve a problem this time, because
thread B could (though it is very unlikely) have the same sample value.
But I'm sure we can come up with something for this.

That said, I still think it would be a better solution altogether to have
a buffer in an alsa-native not hardware-native format and have the driver
do the translation / saturation and the like. Yeah, I know that's not what
you want, I got it ;-).

--------------
Fycio (J.Sobierski)
 fycio@gucio.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

             reply	other threads:[~2003-02-17 22:28 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-17 22:28 Jaroslaw Sobierski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-02-17 16:18 Re: dmix plugin Jaroslaw Sobierski
2003-02-17 15:32 Jaroslaw Sobierski
2003-02-17 19:45 ` Jaroslav Kysela
2003-02-17 20:44   ` tomasz motylewski
2003-02-17 20:59     ` Jaroslav Kysela
2003-02-18 10:00   ` Abramo Bagnara
2003-02-18 12:52     ` Jaroslav Kysela
2003-02-18 13:10       ` Jaroslaw Sobierski
2003-02-18 13:19         ` Jaroslav Kysela
2003-02-18 14:51       ` Paul Davis
2003-02-18 16:51         ` Jaroslav Kysela
2003-02-18 21:07     ` Jaroslav Kysela
2003-02-19 10:20       ` Abramo Bagnara
2003-02-19 11:01         ` Jaroslav Kysela
2003-02-19 11:17           ` Abramo Bagnara
2003-02-19 13:49             ` Abramo Bagnara
2003-02-19 15:45               ` Jaroslaw Sobierski
2003-02-19 20:39                 ` Abramo Bagnara
2003-02-19 18:34               ` Jaroslav Kysela
2003-02-19 21:24                 ` Jaroslav Kysela
2003-02-20  8:28                 ` Abramo Bagnara
2003-02-20  8:30                 ` Jaroslaw Sobierski
2003-02-20  8:48                   ` Abramo Bagnara
2003-02-20  8:53                 ` Abramo Bagnara
2003-02-20 16:49                   ` Jaroslav Kysela
2003-02-20 17:57                     ` Abramo Bagnara
2003-02-20 18:26                       ` Paul Davis
2003-02-20 22:14                         ` Abramo Bagnara
2003-02-20 19:55                       ` Jaroslav Kysela
2003-02-20 21:19                         ` tomasz motylewski
2003-02-20 21:27                           ` Jaroslav Kysela
2003-02-21 10:25                         ` Abramo Bagnara
2003-02-21 14:08                         ` Jaroslaw Sobierski
2003-02-19 10:33       ` Jaroslaw Sobierski
2003-02-19 11:08         ` Jaroslav Kysela
2003-02-17 13:12 Jaroslaw Sobierski
2003-02-17 13:22 ` Jaroslav Kysela
2003-02-17 18:15   ` Paul Davis
2003-02-18 22:36     ` Abramo Bagnara
2003-02-17 13:24 ` Jaroslav Kysela
2003-02-17 11:18 Jaroslaw Sobierski
2003-02-17 11:53 ` Jaroslav Kysela
2003-02-17 10:04 Jaroslaw Sobierski
2003-02-17 10:15 ` Jaroslav Kysela
2003-02-17 12:15   ` Abramo Bagnara
2003-02-17 13:12     ` Jaroslav Kysela
2003-02-17 13:29       ` Abramo Bagnara
2003-02-17 15:00         ` Jaroslav Kysela
2003-02-17 15:21           ` Abramo Bagnara
2003-02-17 10:32 ` tomasz motylewski

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=1045520938.3e51622ad5e37@webmail2.namezero.com \
    --to=fycio@gucio.com \
    --cc=T.Motylewski@bfad.de \
    --cc=abramo.bagnara@libero.it \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=perex@suse.cz \
    /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.