added function and improved argument order consistency #50
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I send you a PR for the following:
I added
size_t ltc_encoder_get_bufferoffset(LTCEncoder *e)
to query the write offset of the internal buffer.
I found this very useful in a variety of situations, especially when the size of the internal buffer is larger than exactly 1 frame of LTC. In my specific user case I need to change FPS in real-time so I have to allocate a buffer large enough to hold the lowest FPS allowed. However I can see how this could come handy also in situations where you want to speed-up or slow-down the timecode.
It is true that you get the offset when you get the buffer anyway, but sometimes I found myself in need of the offset only.
I changed and renamed
ltcsnd_sample_t *ltc_encoder_get_bufptr(LTCEncoder *e, int *size, int flush)
to
int ltc_encoder_get_bufferptr(LTCEncoder *e, ltcsnd_sample_t *buf, int flush)
The argument order of the latter function is now consistent with get_buffer, copy_buffer, etc...
Obviously I deprecated the former and exported it exactly like I did previously for other functions. So nothing should break.
Comments updated to refer to the new function names