XDF_SEEK(3)

πŸ’– XDF_SEEK(3) πŸ’–

okay so bestie, we're in the xdffileio library manual and today's main character is xdf_seek β€” the glow-up move that slides your sample pointer around inside a xDF file. no cap, this is the one you want when you're like "take me to sample 5000 pls" and the file is like "say less" πŸ’…


✨ NAME ✨

xdf_seek β€” move the sample pointer of a xDF file πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

#include <xdfio.h>

off_t xdf_seek(struct xdf* xdf, off_t offset, int whence);

πŸ’œ DESCRIPTION πŸ’œ

So xdf_seek() repositions the current sample pointer according to the couple (offset, whence) β€” and whence can be any of these three icons:

  • SEEK_SET β€” the offset gets set to offset bytes. fresh start energy, we're going exactly where you said 🎯
  • SEEK_CUR β€” the offset gets set to its current location plus offset bytes. it's giving "nudge me from where I'm standing" πŸšΆβ™€οΈ
  • SEEK_END β€” the offset gets set to the size of the file plus offset bytes. measuring from the very end, dramatic much πŸ’€
k so important: the file referenced by xdf should have been opened with mode XDF_READ, and xdf_prepare_arrays(3) should have been successfully called on it. no prep, no seek, that's just how it is 🌸

πŸ”₯ RETURN VALUE πŸ”₯

Upon successful completion, xdf_seek() returns the resulting offset location β€” measured in number of samples from the beginning of the recording (yes bestie, samples, not bytes, don't let anyone gaslight you). Otherwise, a value of -1 is returned and errno is set to indicate the error. classic 😭


🌈 ERRORS 🌈

  • EINVAL β€” xdf is NULL or whence is none of the allowed values. like hello?? pick a real whence πŸ™ˆ
  • EPERM β€” no successful call to xdf_prepare_transfer(3) have been done on xdf, or it has been opened using the mode XDF_WRITE. you skipped the ritual, so no pointer movement for you 🚫
  • ERANGE β€” the requested offset is out of the range of the recording. you aimed past the end of the timeline, girlie 🫠
  • EINTR β€” the call was interrupted by a signal before any data was read; see signal(7) ⚑
  • EIO β€” a low-level I/O error occurred while reading from the inode πŸ’€
  • ESTALE β€” Stale file handle. This error can occur for NFS and for other file systems πŸ“

πŸ¦‹ SEE ALSO πŸ¦‹


and that's the whole vibe check, bestie πŸ’– this page comes to you from EPFL, dated 2010, and it lives in the XDF_SEEK(3) slot of the manual β€” go forth and seek responsibly, mwah πŸ’…βœ¨πŸŽ€