XDF_DEFINE_ARRAYS(3)

πŸ’– XDF_DEFINE_ARRAYS(3) πŸ’–

okay bestie, so this one's from the xdffileio library manual and it's literally the glow-up moment where you tell your transfer how many arrays it's getting and how they're spaced. it's giving ✨setup era✨. let's get into it 🫢


🌸 NAME 🌸

xdf_define_arrays β€” Specify the number of input/output arrays πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <xdfio.h>

int xdf_define_arrays(struct xdf* xdf,
                      unsigned int narrays, const size_t *strides);

no cap, that's the whole vibe right there ⭐


πŸ¦‹ DESCRIPTION πŸ¦‹

so xdf_define_arrays() specifies the number of arrays and its strides for the upcoming calls to xdf_write(3) and xdf_read(3) that are gonna use xdf. it's the function you use to configure the upcoming transfer. and because it's the setup step, it must be called before xdf_prepare_transfer(3) β€” like, calling it after will straight up produce an error πŸ’€ no skipping steps, bestie.

but here's the cute part: you can call this function several times. it's not a one-and-done. just know that only the last call is meaningful for the transfer β€” everything before it is giving "deleted draft" energy πŸ™ˆ

narrays specifies the number of arrays that will be provided in the argument list of xdf_write(3) or xdf_read(3). so like, how many little containers are you showing up with πŸ‘‘

strides argument should point to an array of narrays unsigned int corresponding respectively to the stride of each arrays that will be supplied to the upcoming call to xdf_write(3) or xdf_read(3). and what even is a stride, you ask? 🧚 the stride corresponds to the length in byte between two consecutive samples of the same channel in the array. that's it. that's the whole thing. it's the distance between your samples, measured in bytes. periodt πŸ’–


πŸ‘‘ RETURN VALUE πŸ‘‘

xdf_define_arrays() returns 0 in case of success πŸŽ‰ otherwise it returns -1 and errno is set appropriately 😭 (she's dramatic but she's honest)


🌈 ERRORS 🌈

  • ENOMEM β€” the system is unable to allocate resources. not enough room, bestie, the vibes are constrained πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

go read those too, they're all part of the same friend group fr fr 🫢


and that's the whole page, bestie ✨ this one came from EPFL, 2010 β€” so yeah, it's been slaying since 2010 and it's still iconic πŸ’… mwah, take care of your strides πŸŒΈπŸŽ€