alsa鎺ュ彛
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了alsa鎺ュ彛相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/play' title='play'>play
str ams inter channel channels 璁惧 and hand鈻?鍩烘湰娴佺▼
鎵撳紑璁惧
璁剧疆鍙傛暟
鑾峰彇fd
poll
鍐欏叆鏁版嵁/璇诲彇鏁版嵁
鍏抽棴
鈻?鍐欏叆鏁版嵁
snd_pcm_open(&u->pcm_handle, dev = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)
snd_pcm_hw_params_malloc(&hwparams)
snd_pcm_hw_params_any(pcm_handle, hwparams)
snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)
snd_pcm_hw_params_set_format(pcm_handle, hwparams, format_trans[ss->format])
snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &ss->rate, NULL)
snd_pcm_hw_params_set_channels(pcm_handle, hwparams, ss->channels)
snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, periods, NULL)
snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, buffer_size)
snd_pcm_hw_params(pcm_handle, hwparams)
snd_pcm_hw_params_free(hwparams)
*n_io_sources = snd_pcm_poll_descriptors_count(pcm_handle)
snd_pcm_poll_descriptors(pcm_handle, pfds, *n_io_sources)
poll
snd_pcm_prepare(u->pcm_handle)
snd_pcm_writei(u->pcm_handle, memchunk->memblock->data + memchunk->index, memchunk->length / u->frame_size)
snd_pcm_drop(u->pcm_handle)
snd_pcm_close(u->pcm_handle)
鈻?璇诲彇鏁版嵁
snd_pcm_open(&u->pcm_handle, dev = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK) < 0) {
snd_pcm_hw_params_malloc(&hwparams)
snd_pcm_hw_params_any(pcm_handle, hwparams)
snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)
snd_pcm_hw_params_set_format(pcm_handle, hwparams, format_trans[ss->format])
snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &ss->rate, NULL)
snd_pcm_hw_params_set_channels(pcm_handle, hwparams, ss->channels)
snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, periods, NULL)
snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, buffer_size)
snd_pcm_hw_params(pcm_handle, hwparams)
snd_pcm_hw_params_free(hwparams)
snd_pcm_poll_descriptors_count(pcm_handle)
snd_pcm_poll_descriptors(pcm_handle, pfds, *n_io_sources)
poll
snd_pcm_state(u->pcm_handle)
snd_pcm_prepare(u->pcm_handle)
snd_pcm_readi(u->pcm_handle, u->memchunk.memblock->data + u->memchunk.index, u->memchunk.length / u->frame_size))
snd_pcm_drop(u->pcm_handle);
snd_pcm_close(u->pcm_handle);
以上是关于alsa鎺ュ彛的主要内容,如果未能解决你的问题,请参考以下文章