Lines Matching full:v
61 PWVoice v; member
66 PWVoice v; member
69 #define PW_VOICE_IN(v) ((PWVoiceIn *)v) argument
70 #define PW_VOICE_OUT(v) ((PWVoiceOut *)v) argument
75 PWVoice *v = (PWVoice *) data; in stream_destroy() local
76 spa_hook_remove(&v->stream_listener); in stream_destroy()
77 v->stream = NULL; in stream_destroy()
84 PWVoice *v = data; in playback_on_process() local
91 assert(v->stream); in playback_on_process()
94 b = pw_stream_dequeue_buffer(v->stream); in playback_on_process()
106 req = b->requested * v->frame_size; in playback_on_process()
108 req = v->req; in playback_on_process()
113 avail = spa_ringbuffer_get_read_index(&v->ring, &index); in playback_on_process()
116 PWVoiceOut *vo = container_of(data, PWVoiceOut, v); in playback_on_process()
117 audio_pcm_info_clear_buf(&vo->hw.info, p, n_bytes / v->frame_size); in playback_on_process()
128 spa_ringbuffer_read_data(&v->ring, in playback_on_process()
129 v->buffer, RINGBUFFER_SIZE, in playback_on_process()
133 spa_ringbuffer_read_update(&v->ring, index); in playback_on_process()
137 buf->datas[0].chunk->stride = v->frame_size; in playback_on_process()
141 pw_stream_queue_buffer(v->stream, b); in playback_on_process()
148 PWVoice *v = (PWVoice *) data; in capture_on_process() local
155 assert(v->stream); in capture_on_process()
158 b = pw_stream_dequeue_buffer(v->stream); in capture_on_process()
173 filled = spa_ringbuffer_get_write_index(&v->ring, &index); in capture_on_process()
184 spa_ringbuffer_write_data(&v->ring, in capture_on_process()
185 v->buffer, RINGBUFFER_SIZE, in capture_on_process()
189 spa_ringbuffer_write_update(&v->ring, index); in capture_on_process()
192 pw_stream_queue_buffer(v->stream, b); in capture_on_process()
199 PWVoice *v = (PWVoice *) data; in on_stream_state_changed() local
201 trace_pw_state_changed(pw_stream_get_node_id(v->stream), in on_stream_state_changed()
223 PWVoice *v = &pw->v; in qpw_read() local
224 pwaudio *c = v->g; in qpw_read()
231 if (pw_stream_get_state(v->stream, &error) != PW_STREAM_STATE_STREAMING) { in qpw_read()
237 avail = spa_ringbuffer_get_read_index(&v->ring, &index); in qpw_read()
245 spa_ringbuffer_read_data(&v->ring, in qpw_read()
246 v->buffer, RINGBUFFER_SIZE, in qpw_read()
249 spa_ringbuffer_read_update(&v->ring, index); in qpw_read()
260 PWVoice *v = &pw->v; in qpw_buffer_get_free() local
261 pwaudio *c = v->g; in qpw_buffer_get_free()
267 if (pw_stream_get_state(v->stream, &error) != PW_STREAM_STATE_STREAMING) { in qpw_buffer_get_free()
273 filled = spa_ringbuffer_get_write_index(&v->ring, &index); in qpw_buffer_get_free()
274 avail = v->highwater_mark - filled; in qpw_buffer_get_free()
285 PWVoice *v = &pw->v; in qpw_write() local
286 pwaudio *c = v->g; in qpw_write()
292 if (pw_stream_get_state(v->stream, &error) != PW_STREAM_STATE_STREAMING) { in qpw_write()
297 filled = spa_ringbuffer_get_write_index(&v->ring, &index); in qpw_write()
298 avail = v->highwater_mark - filled; in qpw_write()
315 spa_ringbuffer_write_data(&v->ring, in qpw_write()
316 v->buffer, RINGBUFFER_SIZE, in qpw_write()
319 spa_ringbuffer_write_update(&v->ring, index); in qpw_write()
420 qpw_stream_new(pwaudio *c, PWVoice *v, const char *stream_name, in qpw_stream_new() argument
438 buf_samples = (uint64_t)v->g->dev->timer_period * v->info.rate in qpw_stream_new()
441 buf_samples, v->info.rate); in qpw_stream_new()
443 trace_pw_period(buf_samples, v->info.rate); in qpw_stream_new()
447 v->stream = pw_stream_new(c->core, stream_name, props); in qpw_stream_new()
448 if (v->stream == NULL) { in qpw_stream_new()
454 pw_stream_add_listener(v->stream, in qpw_stream_new()
455 &v->stream_listener, &capture_stream_events, v); in qpw_stream_new()
457 pw_stream_add_listener(v->stream, in qpw_stream_new()
458 &v->stream_listener, &playback_stream_events, v); in qpw_stream_new()
465 &v->info); in qpw_stream_new()
468 res = pw_stream_connect(v->stream, in qpw_stream_new()
478 pw_stream_destroy(v->stream); in qpw_stream_new()
522 PWVoice *v = &pw->v; in qpw_init_out() local
524 pwaudio *c = v->g = drv_opaque; in qpw_init_out()
531 v->info.format = audfmt_to_pw(as->fmt, as->endianness); in qpw_init_out()
532 v->info.channels = as->nchannels; in qpw_init_out()
533 qpw_set_position(as->nchannels, v->info.position); in qpw_init_out()
534 v->info.rate = as->freq; in qpw_init_out()
537 pw_to_audfmt(v->info.format, &obt_as.endianness, &v->frame_size); in qpw_init_out()
538 v->frame_size *= as->nchannels; in qpw_init_out()
540 v->req = (uint64_t)c->dev->timer_period * v->info.rate in qpw_init_out()
541 * 1 / 2 / 1000000 * v->frame_size; in qpw_init_out()
544 r = qpw_stream_new(c, v, ppdo->stream_name ? : c->dev->id, in qpw_init_out()
557 v->highwater_mark = MIN(RINGBUFFER_SIZE, in qpw_init_out()
559 * (uint64_t)v->info.rate / 1000000 * v->frame_size); in qpw_init_out()
569 PWVoice *v = &pw->v; in qpw_init_in() local
571 pwaudio *c = v->g = drv_opaque; in qpw_init_in()
578 v->info.format = audfmt_to_pw(as->fmt, as->endianness); in qpw_init_in()
579 v->info.channels = as->nchannels; in qpw_init_in()
580 qpw_set_position(as->nchannels, v->info.position); in qpw_init_in()
581 v->info.rate = as->freq; in qpw_init_in()
584 pw_to_audfmt(v->info.format, &obt_as.endianness, &v->frame_size); in qpw_init_in()
585 v->frame_size *= as->nchannels; in qpw_init_in()
588 r = qpw_stream_new(c, v, ppdo->stream_name ? : c->dev->id, in qpw_init_in()
607 qpw_voice_fini(PWVoice *v) in qpw_voice_fini() argument
609 pwaudio *c = v->g; in qpw_voice_fini()
611 if (!v->stream) { in qpw_voice_fini()
615 pw_stream_destroy(v->stream); in qpw_voice_fini()
616 v->stream = NULL; in qpw_voice_fini()
623 qpw_voice_fini(&PW_VOICE_OUT(hw)->v); in qpw_fini_out()
629 qpw_voice_fini(&PW_VOICE_IN(hw)->v); in qpw_fini_in()
633 qpw_voice_set_enabled(PWVoice *v, bool enable) in qpw_voice_set_enabled() argument
635 pwaudio *c = v->g; in qpw_voice_set_enabled()
637 pw_stream_set_active(v->stream, enable); in qpw_voice_set_enabled()
644 qpw_voice_set_enabled(&PW_VOICE_OUT(hw)->v, enable); in qpw_enable_out()
650 qpw_voice_set_enabled(&PW_VOICE_IN(hw)->v, enable); in qpw_enable_in()
654 qpw_voice_set_volume(PWVoice *v, Volume *vol) in qpw_voice_set_volume() argument
656 pwaudio *c = v->g; in qpw_voice_set_volume()
660 v->volume.channels = vol->channels; in qpw_voice_set_volume()
663 v->volume.values[i] = (float)vol->vol[i] / 255; in qpw_voice_set_volume()
666 ret = pw_stream_set_control(v->stream, in qpw_voice_set_volume()
667 SPA_PROP_channelVolumes, v->volume.channels, v->volume.values, 0); in qpw_voice_set_volume()
670 v->muted = vol->mute; in qpw_voice_set_volume()
671 float val = v->muted ? 1.f : 0.f; in qpw_voice_set_volume()
672 ret = pw_stream_set_control(v->stream, SPA_PROP_mute, 1, &val, 0); in qpw_voice_set_volume()
679 qpw_voice_set_volume(&PW_VOICE_OUT(hw)->v, vol); in qpw_volume_out()
685 qpw_voice_set_volume(&PW_VOICE_IN(hw)->v, vol); in qpw_volume_in()