Product
ProductCurrent position > Product detail

inline meter

『inline meter|rotameter flow meter』Related information(clamp on meter|electromagnetic meter|venturi meterrotameter|orifice meter|ultrasonic flow meter|mass flow meter|coriolis mass flow meter|coriolis flow meter|magnetic flow meter|magmeter flow meter|magflow flow meter|mag meter flow meter|electromagnetic flow meter|vortex flow meter|turbine flow meter|thermal mass flow meter|thermal flow meter|rotameter flow meter)

1. What header file does snd_pcm_open need to include?

ALSA lib is mainly an abstract user space library for ALSA applications, which can be called by specific applications. Also utilities are mainly related operating apps that can serve as official demos for developers to refer to. The ALSA audio architecture has been presented earlier. This article mainly provides a detailed analysis of snd_pcm_open. Detailed analysis of snd_pcm_open sequence diagram code (using playback as an example) introduces the issue of using function pointers to implement the playback interface in alsa_utils aplay. c. The specific definition is as follows static snd_pcm_sframes_t (*writei_func)(snd_pcm_t *handle, const void *buffer, snd_pcm_uframes_t size); After logging in, copy and assign the following value: writable=snd_pcm_writable; readi_func = snd_pcm_readi; writen_func = snd_pcm_writen; readn_func = snd_pcm_readn; After logging in, copy snd_pcm_write and write the PCM data stream by calling _stnd_pcm-write. The prototype of the _stnd_pcm-write function is as follows static inline snd_pcm_sframes_t _snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size){/* lock handled in the callback */if (!pcm->fast_ops->writei)return -ENOSYS;return pcm->fast_ops->writei(pcm->fast_op_arg, buffer, size); // After logging in, copying the function pointer will call pcm ->fast_ops ->writable to perform the actual operation. Upon checking the source code of aplay. c, it was not found where the const snd_pcm_fast_ops_t * fast_ops structure in the PCM device was initialized. It is highly likely that the corresponding operation was performed in snd_pcm_open. The specific analysis of snd_pcm_open in alsa_utils aplay. c is as fol

inline meter|rotameter flow meter
lows .. char *pcm_name = "default"; . ..err = snd_pcm_open(&handle, pcm_name, stream, open_mode); If (err<0) {error (_ ("audio open error:% s"), snd_strerror (err)); return 1;} After logging in, copy the prototype of the snd_pcm_open function as follows int snd_pcm_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode){snd_config_t *top;int err;assert(pcmp && name);if (_snd_is_ucm_device(name)) {name = uc_mgr_alibcfg_by_device(&top, name);if (name == NULL)return -ENODEV;} else {err = snd_config_update_ref(&top);if (err < 0)return err;}err = snd_pcm_open_noupdate(pcmp, top, name, stream, mode, 0); snd_config_unref(top); return err; }Copy PCMP after logging in, which is the handle of the opened PCM device; name, The name of the PCM device to be opened, default stream, corresponding PCM stream type, mode for playing PCM stream (SND_PCM_STREAM-PLAYBACK) and recording PCM stream (SND_PCM_STREAM_CPTURE), opening method, blocking, non blocking, asynchronous, etc. snd_pcm_open retrieves configuration information from als.conf by calling snd_config.update_def, and saves parameters to snd_config.t. Using snd_pcm_open_noupdate to parse the snd_config.t configuration, the prototype of the snd_pcm_open_noupdate function is as follows static int snd_pcm_open_noupdate(snd_pcm_t **pcmp, snd_config_t *root, const char *name, snd_pcm_stream_t stream, int mode, int hop){int err;snd_config_t *pcm_conf;const char *str;err = snd_config_search_definition(root, "pcm", name, &pcm_conf);if (err < 0) {SNDERR("Unknown PCM %s", name);return err;}if (snd_config_get_string(pcm_conf, &str) >= 0) // Loop recursive parsing err=snd_pcm_open_noupdate (pcmp, root, str, stream, mode, hop+1); else {snd_config_set_hop(pcm_conf,

『SILVER Official Website SERVICE』

Copyright2026SILVER E-Commerce
+86 15365082610