[alsa-devel] Setting format to SND_PCM_FORMAT_MU_LAW does not let me apply hardware parameters

stan ghjeold_i_mwee at cox.net
Thu Jul 17 05:30:06 CEST 2008


Mitul Sen (misen) wrote:

> 
> I am making some changes to the alsa-lib code and I have built alsa-lib. But I don't think its really picking up my changes. How can I make sure that my application uses the 
modified library? I don't have to load any modules, do 
I? I am sorry if this is too basic a question but I 
couldn't find the info on a quick google search. 
Basically what I want to know is what are the steps to 
develop alsa-lib. This is what I did
> 1) Downloaded the source code
> 2) Configured the system using ./configure
> 3) Did a build using make
> 4) Did a "make install"
> 
> Am I missing something here? 

It looks correct.  Do an   ls -l /usr/lib/libasound*. 
The file there should have the same timestamp as the 
file in your build directory.  If it doesn't, it didn't 
install.  You could just copy it over.

Make sure there is no other copy in /lib.

> 
> Also regarding the original problem, when I run my program, the output of /proc/asound/card0/pcm0p/sub0/hw_params is
> 
> access: MMAP_INTERLEAVED
> format: S16_LE
> subformat: STD
> channels: 2
> rate: 48000 (48000/1)
> period_size: 32
> buffer_size: 1024
> 
> This is clearly not what it should be since the data access should be RW_NONINTERLEAVED, format should be MU_LAW, there is only one channel and rate is 8000. Which would mean that alsa assumes a different set of parameters (for mu law)from what the data actually is. Am I right in thinking this?
> 
> Just got back after a long break and trying to pick up the threads again:-)
> 
> Again, any help will be much appreciated.
> 
> 
> 

Unless your changes changed the mu-law code to use your 
card's mu-law decoder, they will still be the decoded 
values.

The best way to do this is to compile your program with 
debugging enabled (  -ggdb  -O0) and the alsa library 
with debugging enabled.  ./configure  --help should 
give you the option.  Then move only the library to 
/usr/lib and run your program as
gdb --args yourprogram yourargs   .  You can see the 
info on how to run gdb in  info gdb  .  With the 
debugger you can step through the program and the 
library to see where it is not working the way you 
expected.  But you don't want to leave it like that as 
it is very inefficient.

If your code works for the mu-law, you could submit a 
patch.  Of course, you would have to check for the 
functionality and branch to the old code if the card 
doesn't support mu-law decoding.


More information about the Alsa-devel mailing list