[alsa-devel] SoftVol in user space

Riccardo Casagrande riccardo.casagrande at multiconn.it
Thu Sep 20 17:24:57 CEST 2018


Hello devs,


I have to add a volume control to my custom card (It has an i.MX6 chip and 3 FDA2100 from TI as audio chip) because the FDAs have no volume controller.


This below is the .asoundrc file I made. It works great if I manually made a speaker-test of one of devicefdaX sound card. Then I can see on alsamixer the volume control, but my need is to access and control softvol from user space. 



pcm.softvolfda0 {
         type softvol     
          slave {         
                  pcm "hw:0,0"     
         }                
         control {        
                  name "volume0"   
                  card 0           
                  device 0         
         }                
}                
                 
pcm.softvolfda1 {
         type softvol     
         slave {          
                  pcm "hw:0,1"     
         }                
         control {        
                  name "volume1"   
                  card 0           
                  device 1         
         }                
}                
                 
pcm.softvolfda2 {
         type softvol           
         slave {                
                  pcm "hw:0,2"           
         }                      
         control {              
                  name "volume2"         
                  card 0                 
                  device 2               
         }                      
}                      
                       
pcm.devicefda0 {       
         type plug              
         slave.pcm "softvolfda0"
}      



pcm.devicefda1 {       
         type plug              
         slave.pcm "softvolfda1"
}                      
                       
pcm.devicefda2 {       
         type plug              
         slave.pcm "softvolfda2"
}    





I saw that on alsalib there is this command 



int snd_pcm_softvol_open (snd_pcm_t **      pcmp,
        const char *      name,
        snd_pcm_format_t      sformat,
        int      ctl_card,
        snd_ctl_elem_id_t *      ctl_id,
        int      cchannels,
        double      min_dB,
        double      max_dB,
        int      resolution,
        snd_pcm_t *      slave,
        int      close_slave 
    ) 



but I can't find any example of usage.This is the log of the error:


mp && slave' failed.
Aborted


Any suggestion is welcome


Riccardo Casagrande






More information about the Alsa-devel mailing list