[alsa-devel] Mixer volume/decibel mapping

Colin Guthrie gmane at colin.guthr.ie
Sat May 29 20:46:00 CEST 2010


'Twas brillig, and Raymond Yau at 29/05/10 02:57 did gyre and gimble:
> 2010/5/25 James Courtier-Dutton <james.dutton at gmail.com>
> 
>>
>> Could this maybe explain why pulseaudio was having such problems with
>> alsa with regards to gain controls????
>>
> 
> 
> Did you answer PA 's developer 's question in FOMS
> 
> http://thread.gmane.org/gmane.linux.alsa.devel/50417/focus=50555
> 
> what is the answer of this question ?

What question? I'm not sure I follow what you're asking here...

> - That snd_pcm_sw_params_set_start_threshold(.. , (snd_pcm_uframes_t) -1))
>   disables automatic stopping on underrun.
> 
> snd_pcm_uframes_t is unsigned and in snd_pcm_write_areas() pcm/pcm.c
> 
> start_threshold seem used as a signed number
> 
> is this a special case , what is the difference between 1 and -1 ?
> 
> 		if (state == SND_PCM_STATE_PREPARED) {
> 			snd_pcm_sframes_t hw_avail = pcm->buffer_size - avail;
> 			hw_avail += frames;
> 			/* some plugins might automatically start the stream */
> 			state = snd_pcm_state(pcm);
> 			if (state == SND_PCM_STATE_PREPARED &&
> 			    hw_avail >= (snd_pcm_sframes_t) pcm->start_threshold) {
> 				err = snd_pcm_start(pcm);
> 				if (err < 0)
> 					goto _end;
> 			}
> 		}


It seems to be used as a signed value there, but I'm not sure if the
unsigned -1 case is treated differently in some capacity prior to
reaching this code.

The reason -1 is used is just a shortcut to get the maximum value of an
unsigned variable. I presume this "as big as possible" case is dealt
with appropriately.

I'm absolutely green when it comes to alsa lib API and programming, so
you'd be better asking Lennart directly about this.

Col



-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]



More information about the Alsa-devel mailing list