Lines Matching refs:pcm

47 static struct pcm *pcm;  variable
87 static int set_params(struct pcm *pcm) in set_params() argument
94 unsigned int requestedRate = pcm->rate; in set_params()
105 … (pcm->flags & PCM_MMAP)? SNDRV_PCM_ACCESS_MMAP_INTERLEAVED : SNDRV_PCM_ACCESS_RW_INTERLEAVED); in set_params()
106 param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, pcm->format); in set_params()
115 pcm->channels * 16); in set_params()
117 pcm->channels); in set_params()
118 param_set_int(params, SNDRV_PCM_HW_PARAM_RATE, pcm->rate); in set_params()
120 param_set_hw_refine(pcm, params); in set_params()
122 if (param_set_hw_params(pcm, params)) { in set_params()
129 pcm->buffer_size = pcm_buffer_size(params); in set_params()
130 pcm->period_size = pcm_period_size(params); in set_params()
131 pcm->period_cnt = pcm->buffer_size/pcm->period_size; in set_params()
133 fprintf (stderr,"period_size (%d)", pcm->period_size); in set_params()
134 fprintf (stderr," buffer_size (%d)", pcm->buffer_size); in set_params()
135 fprintf (stderr," period_cnt (%d)\n", pcm->period_cnt); in set_params()
145 if (pcm->flags & PCM_MONO) { in set_params()
146 sparams->avail_min = pcm->period_size/2; in set_params()
147 sparams->xfer_align = pcm->period_size/2; in set_params()
148 } else if (pcm->flags & PCM_QUAD) { in set_params()
149 sparams->avail_min = pcm->period_size/8; in set_params()
150 sparams->xfer_align = pcm->period_size/8; in set_params()
151 } else if (pcm->flags & PCM_5POINT1) { in set_params()
152 sparams->avail_min = pcm->period_size/12; in set_params()
153 sparams->xfer_align = pcm->period_size/12; in set_params()
155 sparams->avail_min = pcm->period_size/4; in set_params()
156 sparams->xfer_align = pcm->period_size/4; in set_params()
164 if (param_set_sw_params(pcm, sparams)) { in set_params()
202 pcm = pcm_open(flags, device); in record_file()
203 if (!pcm_ready(pcm)) { in record_file()
204 pcm_close(pcm); in record_file()
207 pcm->channels = channels; in record_file()
208 pcm->rate = rate; in record_file()
209 pcm->flags = flags; in record_file()
210 pcm->format = format; in record_file()
211 if (set_params(pcm)) { in record_file()
213 pcm_close(pcm); in record_file()
218 if (pcm_prepare(pcm)) { in record_file()
220 pcm_close(pcm); in record_file()
223 if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_START)) { in record_file()
225 pcm_close(pcm); in record_file()
233 struct snd_pcm_sync_ptr *sync_ptr1 = pcm->sync_ptr; in record_file()
236 if (mmap_buffer(pcm)) { in record_file()
238 pcm_close(pcm); in record_file()
244 if (pcm_prepare(pcm)) { in record_file()
246 pcm_close(pcm); in record_file()
250 bufsize = pcm->period_size; in record_file()
253 if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_START)) { in record_file()
257 pcm->running = 0; in record_file()
264 pfd[0].fd = pcm->fd; in record_file()
268 if (pcm->flags & PCM_MONO) { in record_file()
270 } else if (pcm->flags & PCM_QUAD) { in record_file()
272 } else if (pcm->flags & PCM_5POINT1) { in record_file()
279 if (!pcm->running) { in record_file()
280 if (pcm_prepare(pcm)) in record_file()
285pcm->sync_ptr->flags = SNDRV_PCM_SYNC_PTR_APPL | SNDRV_PCM_SYNC_PTR_AVAIL_MIN;//SNDRV_PCM_SYNC_PTR… in record_file()
286 err = sync_ptr(pcm); in record_file()
291 pcm->running = 0; in record_file()
298 avail = pcm_avail(pcm); in record_file()
303 if (avail < pcm->sw_p->avail_min) { in record_file()
314 dst_addr = dst_address(pcm); in record_file()
325 pcm->sync_ptr->c.control.appl_ptr += frames; in record_file()
326 pcm->sync_ptr->flags = 0; in record_file()
327 err = sync_ptr(pcm); in record_file()
331 pcm->running = 0; in record_file()
346 bufsize = pcm->period_size; in record_file()
347 if (pcm_prepare(pcm)) { in record_file()
349 pcm_close(pcm); in record_file()
359 while (!pcm_read(pcm, data, bufsize)) { in record_file()
379 pcm_close(pcm); in record_file()
383 fprintf(stderr, "Arec:pcm error: %s\n", pcm_error(pcm)); in record_file()
507 pcm = NULL; in signal_handler()