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.
If the system falls back to an alternative mix format with a different sample rate than preferred by Kinc, it could happen that the sample rate in the Haxe API wasn't correctly updated because it it was read before the audio was initialized.
Also, audio buffers used a hard-coded sample rate which would fail in the same situation. This would lead to playback with a wrong speed because the resampling code in resampling audio channels depends on the sample rate passed here.
Btw, what's the reason why the sample rate is stored in each buffer when it's also a globally accessible variable? Are the buffers designed to be used for multiple purposes?
On Krom there are similar issues but I couldn't get Krom audio to work even after enabling it in main.cpp (see Kode/Krom#138 (comment); I know of the issues because they exist in Armorcore and they are likely to exist in Kode/Krom as well). I will try to dig deeper in the next days and then eventually open an issue or add something to the linked issue.