Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc omission regarding src_process #42

Open
p-i- opened this issue May 19, 2018 · 3 comments
Open

Doc omission regarding src_process #42

p-i- opened this issue May 19, 2018 · 3 comments

Comments

@p-i-
Copy link

p-i- commented May 19, 2018

https://github.com/erikd/libsamplerate/blob/master/src/samplerate.h#L86

Doc is here: http://www.mega-nerd.com/SRC/api_simple.html

Documentation doesn't mention what happens if the output buffer is not big enough to hold the samplerate-converted input buffer.

It isn't certain if this will return an error or simply fill the output buffer, correctly making a note of how many input samples have been consumed in the data structure.

It would be very helpful to have this documented, as it would save a development test-cycle.

@erikd
Copy link
Member

erikd commented May 20, 2018

The person who wrote the code is rarely the best person to document the API, because the author makes assumptions about it that a newcomer is unlikely to make.

PR more than welcome.

@p-i-
Copy link
Author

p-i- commented May 20, 2018

Can you tell me off the top of your head what would be the actual behaviour?

@erikd
Copy link
Member

erikd commented May 20, 2018

src_process is designed to to not overflow the input or output buffers, and to operate correctly in a loop where it is constantly being called with updated SRC_DATA data.

If you call it with a zero length output buffer, it may consume input (and store it internally, but there is a limit to its internal storage), but it will not generate output and it will not result in an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants