diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-04-05 02:26:02 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-04-05 02:26:02 +0200 |
commit | d035f4a3f3e73fd67d69a03c03adc9a08f30ef21 (patch) | |
tree | 52316988c7bcbd495ba4a53a337f7c9b3c813286 /src/modules/alsa | |
parent | 1c26d7e174ba54c062c0ae50d33bf4e819bb15ba (diff) |
Modify smoothing code to make cubic interpolation optional and allow 'quick fixups' on resuming
The primary reason for this change is to allow time graphs that do not
go through the origin and hence smoothing starting from the origin is
not desired. This change will allow passing time data into the smoother
while paused and then abruptly use that data without smoothing using the
'quick fixup' flag when resuming.
Primary use case is allowing recording time graphs where the data
recorded originates from a time before the stream was created. The
resulting graft will be shifted and should not be smoothened to go
through the origin.
Diffstat (limited to 'src/modules/alsa')
-rw-r--r-- | src/modules/alsa/alsa-sink.c | 15 | ||||
-rw-r--r-- | src/modules/alsa/alsa-source.c | 12 |
2 files changed, 18 insertions, 9 deletions
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index 0dc0e2b3..942b59e0 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -1286,7 +1286,7 @@ static void thread_func(void *userdata) { pa_log_info("Starting playback."); snd_pcm_start(u->pcm_handle); - pa_smoother_resume(u->smoother, pa_rtclock_usec()); + pa_smoother_resume(u->smoother, pa_rtclock_usec(), TRUE); } update_smoother(u); @@ -1495,7 +1495,6 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca snd_pcm_uframes_t period_frames, tsched_frames; size_t frame_size; pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE; - pa_usec_t usec; pa_sink_new_data data; pa_assert(m); @@ -1559,10 +1558,14 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca u->rtpoll = pa_rtpoll_new(); pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); - u->smoother = pa_smoother_new(DEFAULT_TSCHED_BUFFER_USEC*2, DEFAULT_TSCHED_BUFFER_USEC*2, TRUE, 5); - usec = pa_rtclock_usec(); - pa_smoother_set_time_offset(u->smoother, usec); - pa_smoother_pause(u->smoother, usec); + u->smoother = pa_smoother_new( + DEFAULT_TSCHED_BUFFER_USEC*2, + DEFAULT_TSCHED_BUFFER_USEC*2, + TRUE, + TRUE, + 5, + pa_rtclock_usec(), + TRUE); if (reserve_init(u, pa_modargs_get_value( ma, "device_id", diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index 348cd082..a5d2e295 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -776,7 +776,7 @@ static int unsuspend(struct userdata *u) { /* FIXME: We need to reload the volume somehow */ snd_pcm_start(u->pcm_handle); - pa_smoother_resume(u->smoother, pa_rtclock_usec()); + pa_smoother_resume(u->smoother, pa_rtclock_usec(), TRUE); pa_log_info("Resumed successfully..."); @@ -1416,8 +1416,14 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); u->alsa_rtpoll_item = NULL; - u->smoother = pa_smoother_new(DEFAULT_TSCHED_WATERMARK_USEC*2, DEFAULT_TSCHED_WATERMARK_USEC*2, TRUE, 5); - pa_smoother_set_time_offset(u->smoother, pa_rtclock_usec()); + u->smoother = pa_smoother_new( + DEFAULT_TSCHED_WATERMARK_USEC*2, + DEFAULT_TSCHED_WATERMARK_USEC*2, + TRUE, + TRUE, + 5, + pa_rtclock_usec(), + FALSE); if (reserve_init(u, pa_modargs_get_value( ma, "device_id", |