First, thanks to the Membrane team for creating this awesome framework!
Based on SimplePipeline I’m trying to build a simple music player. Following functionality is required:
- Start playback from file, get notification on finish
- use
handle_element_(start|end)_of_stream/4
hooks on sink
- use
- Get current playback position
- Save
Time.monotonic_time()
on playback start and calculate difference to now?
- Save
- Nice to have: play/pause
- Possible with the
soft-corking
patch?
- Possible with the
I made some experiments on how to get the current timestamp. First intuition was to create a :tick
timer and then query the current time from the sink – couldn’t quite figure it out, yet.
For some reason the timer runs very unsteady. My above example gives me (expected interval: 5000, off is a factor):
handle_element_start_of_stream:
16:03:34.304 [debug] Membrane.Demo.SimplePipeline/:portaudio received start of stream
:portaudio
:input
===============================
handle_tick:
:tick
last_tick: -576460742608535951
interval: 5068.75382 (off 1.013750764)
===============================
handle_tick:
:tick
last_tick: -576460737539782131
interval: 2.763771 (off 5.527542e-4)
===============================
handle_tick:
:tick
last_tick: -576460737537018360
interval: 2148.508728 (off 0.42970174559999996)
===============================
handle_tick:
:tick
last_tick: -576460735388509632
interval: 2558.596995 (off 0.511719399)
===============================
handle_tick:
:tick
last_tick: -576460732829912637
interval: 2535.085853 (off 0.5070171706)
===============================
My clock subscription does not seem to have any effect.
When terminating the pipeline (Pipeline.terminate
) and starting it again, I start to notice artifacts in the output, everything seems to slow down. CPU load is <5%, though. Is there anything else to do for a clean restart?
Sincerely,
Steffen