All of lore.kernel.org
 help / color / mirror / Atom feed
* Bug in ALSA OSS mixer emulation. Volume++ does not work.
@ 2003-12-03  3:27 James Courtier-Dutton
  2003-12-03  8:27 ` Jaroslav Kysela
  0 siblings, 1 reply; 3+ messages in thread
From: James Courtier-Dutton @ 2003-12-03  3:27 UTC (permalink / raw)
  To: alsa-devel

Hi,

  The alsa keeps state of all mixer levels in alsa's internal format 
which has min,max info. So, for example if alsa has 0-31 levels, 
converting that to the OSS 0-100 range is easy with a simple 
calculation, but if an OSS app just does Volume++, the change will be 
lost in the conversion from OSS to ALSA to actually set the state. So, 
to work the way it should, OSS will have to cache all mixer state in OSS 
format, thus requiring 2 state tables.

E.g.
OSS Volume(0-100)   ALSA Volume(0-31)
OSS = ALSA * 100/31;

0		    0
1                   0
2                   0
3                   1
4                   1
etc.

So, if OSS Volume is 2, and the OSS application does Volume++, the OSS 
volume will be set to 3. but if OSS Volume is 3, and the OSS application 
does Volume++, the OSS volume will stay at 3!

Cheers
James



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug in ALSA OSS mixer emulation. Volume++ does not work.
  2003-12-03  3:27 Bug in ALSA OSS mixer emulation. Volume++ does not work James Courtier-Dutton
@ 2003-12-03  8:27 ` Jaroslav Kysela
  2003-12-03 21:36   ` James Courtier-Dutton
  0 siblings, 1 reply; 3+ messages in thread
From: Jaroslav Kysela @ 2003-12-03  8:27 UTC (permalink / raw)
  To: James Courtier-Dutton; +Cc: alsa-devel

On Wed, 3 Dec 2003, James Courtier-Dutton wrote:

> Hi,
> 
>   The alsa keeps state of all mixer levels in alsa's internal format 
> which has min,max info. So, for example if alsa has 0-31 levels, 
> converting that to the OSS 0-100 range is easy with a simple 
> calculation, but if an OSS app just does Volume++, the change will be 
> lost in the conversion from OSS to ALSA to actually set the state. So, 
> to work the way it should, OSS will have to cache all mixer state in OSS 
> format, thus requiring 2 state tables.
> 
> E.g.
> OSS Volume(0-100)   ALSA Volume(0-31)
> OSS = ALSA * 100/31;
> 
> 0		    0
> 1                   0
> 2                   0
> 3                   1
> 4                   1
> etc.
> 
> So, if OSS Volume is 2, and the OSS application does Volume++, the OSS 
> volume will be set to 3. but if OSS Volume is 3, and the OSS application 
> does Volume++, the OSS volume will stay at 3!

I don't undestand. Actually we have volumes in OSS format (in the kernel's 
mixer emulation), because some applications simply does not work for 
reason as you described (++ or -- applied). Note that these values are 
valid per application (so the resolution is reverted to ALSA's when 
another application changes volume too much). I don't see any other way to 
do it.

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug in ALSA OSS mixer emulation. Volume++ does not work.
  2003-12-03  8:27 ` Jaroslav Kysela
@ 2003-12-03 21:36   ` James Courtier-Dutton
  0 siblings, 0 replies; 3+ messages in thread
From: James Courtier-Dutton @ 2003-12-03 21:36 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel

Jaroslav Kysela wrote:
> On Wed, 3 Dec 2003, James Courtier-Dutton wrote:
> 
> 
>>Hi,
>>
>>  The alsa keeps state of all mixer levels in alsa's internal format 
>>which has min,max info. So, for example if alsa has 0-31 levels, 
>>converting that to the OSS 0-100 range is easy with a simple 
>>calculation, but if an OSS app just does Volume++, the change will be 
>>lost in the conversion from OSS to ALSA to actually set the state. So, 
>>to work the way it should, OSS will have to cache all mixer state in OSS 
>>format, thus requiring 2 state tables.
>>
>>E.g.
>>OSS Volume(0-100)   ALSA Volume(0-31)
>>OSS = ALSA * 100/31;
>>
>>0		    0
>>1                   0
>>2                   0
>>3                   1
>>4                   1
>>etc.
>>
>>So, if OSS Volume is 2, and the OSS application does Volume++, the OSS 
>>volume will be set to 3. but if OSS Volume is 3, and the OSS application 
>>does Volume++, the OSS volume will stay at 3!
> 
> 
> I don't undestand. Actually we have volumes in OSS format (in the kernel's 
> mixer emulation), because some applications simply does not work for 
> reason as you described (++ or -- applied). Note that these values are 
> valid per application (so the resolution is reverted to ALSA's when 
> another application changes volume too much). I don't see any other way to 
> do it.
> 
> 						Jaroslav
> 
> -----
> Jaroslav Kysela <perex@suse.cz>
> Linux Kernel Sound Maintainer
> ALSA Project, SuSE Labs
> 
> 
Why is the OSS volume value kept for each application?
Surely, mixer volumes should be globally stored?
Or does the OSS volume for one application only control the volume of 
the sound from that particular application ?

What about the mixer open/close transition?
If a single application does: -
open
volume++
close
...
open
volume++
close

Will the OSS volume settings be reset from the alsa levels ?

Cheers
James





-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-12-03 21:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-03  3:27 Bug in ALSA OSS mixer emulation. Volume++ does not work James Courtier-Dutton
2003-12-03  8:27 ` Jaroslav Kysela
2003-12-03 21:36   ` James Courtier-Dutton

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.