psasidisrcum
Mar 18 2009, 05:59
Hi all,
For my first foobar plugin, I want do something like this: repeat between point A and point B in a song where A and B can be chosen by the user. This seemed simple enough; whenever the playback point reaches B, just seek to A. I'm using the play_callback and playback_control interface to do this. But I found out that the on_playback_time callback only fires every second. So, for example, if point B is at 30.479, then how would I seek to point A at that exact moment?
Similarly, if A is also at some fractional second point, if I use playback_seek() with the exact time, would it actually begin playback at that exact time? I ask because I wonder if audio files also have something similar to frames in video. eg. the most granular control I would get is limited by the size of each audio 'frame'. Please correct me if I am wrong.
I'm a newbie to this and I wonder if I am even in the right direction.. many thanks in advance.
dubpistol
Mar 18 2009, 08:26
There is already a plugin with Repeat A-B:
foo_menu_addons
psasidisrcum
Mar 19 2009, 04:48
Actually, I'm interested in re-inventing the wheel here, for the sake of teaching myself.. again, any hints would be much appreciated.
Yirkha
Mar 19 2009, 13:31
The decoders are generally sample accurate, so seeking to exact point is possible. However the on_playback_time() callback is rather for UI displays etc., so it's not necessarily precise. I'm afraid you'd have to employ some hackish solution like a DSP to cut off the playback at exact time.
You can set up your own timer (SetTimer() etc) with whatever accuracy you want and poll playback position. Values returned by playback_control::playback_get_position() should be accurate enough for your needs.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.