* \brief Initialize the ALSA soundcard channels (capture AND playback) used by one interface (a multichannel soundcard can be used by multiple interfaces)
* \param p the gsmopen_pvt of the interface
*
* This function call alsa_open_dev to initialize the ALSA soundcard for each channel (capture AND playback) used by one interface (a multichannel soundcard can be used by multiple interfaces). Called by sound_init
* \brief Shutdown the ALSA soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces)
* \param p the gsmopen_pvt of the interface
*
* This function shutdown the ALSA soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces). Called by sound_init
*
* \return zero on success, -1 on error.
*/
intalsa_shutdown(private_t*tech_pvt)
{
interr;
if(tech_pvt->alsap){
err=snd_pcm_drop(tech_pvt->alsap);
if(err<0){
ERRORA("device [%s], snd_pcm_drop failed with error '%s'\n",GSMOPEN_P_LOG,tech_pvt->alsapname,snd_strerror(err));
return-1;
}
err=snd_pcm_close(tech_pvt->alsap);
if(err<0){
ERRORA("device [%s], snd_pcm_close failed with error '%s'\n",GSMOPEN_P_LOG,tech_pvt->alsapname,snd_strerror(err));
return-1;
}
tech_pvt->alsap=NULL;
}
if(tech_pvt->alsac){
err=snd_pcm_drop(tech_pvt->alsac);
if(err<0){
ERRORA("device [%s], snd_pcm_drop failed with error '%s'\n",GSMOPEN_P_LOG,tech_pvt->alsacname,snd_strerror(err));
return-1;
}
err=snd_pcm_close(tech_pvt->alsac);
if(err<0){
ERRORA("device [%s], snd_pcm_close failed with error '%s'\n",GSMOPEN_P_LOG,tech_pvt->alsacname,snd_strerror(err));
return-1;
}
tech_pvt->alsac=NULL;
}
return0;
}
/*!
* \brief Setup and open the ALSA device (capture OR playback)
* \param p the gsmopen_pvt of the interface
* \param stream the ALSA capture/playback definition
*
* This function setup and open the ALSA device (capture OR playback). Called by alsa_init
("snd_pcm_open failed with error '%s' on device '%s', if you are using a plughw:n device please change it to be a default:n device (so to allow it to be shared with other concurrent programs), or maybe you are using an ALSA voicemodem and slmodemd"
" is running?\n",GSMOPEN_P_LOG,snd_strerror(err),stream==SND_PCM_STREAM_CAPTURE?tech_pvt->alsacname:tech_pvt->alsapname);