Kode / Kha

Ultra-portable, high performance, open source multimedia framework.
http://kha.tech
zlib License
1.49k stars 174 forks source link

HL/C: correctly assign sample rate to sounds from .wav files #1362

Closed MoritzBrueckner closed 3 years ago

MoritzBrueckner commented 3 years ago

If a sound was exported by Khamake for HL with quality 1.0, the sample rate wasn't correctly set because it was only set if uncompress() was called. However, sounds with quality 1.0 are already uncompressed so uncompress() directly returns, leaving the sample rate at 0. This PR fixes that.

@ RobDangerous: The length of the sound also isn't correctly set due to the same hl.Ref problem that recently occured for the global sample rate, however if I add the workaround from https://github.com/Kode/Kha/pull/1361 the length is still not correct and shows something like 5e-138. Either there is some issue with float conversion or the length isn't read correctly from the file. Should I open an issue for that?

RobDangerous commented 3 years ago

Yes yes, gimme all the issues, please.

RobDangerous commented 3 years ago

Hu, wrong button.