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
allow extension independent soundfile path, fix #642 #773
Conversation
|
Use FS::Path::Extension and FS::Path::BaseName instead of doing it manually. Looks good otherwise. |
|
Please consider using the same approach as in tr_image: https://github.com/Unvanquished/Unvanquished/blob/master/daemon/src/engine/renderer/tr_image.cpp#L2030 as it handles paks dependencies too. |
|
Hm, I didn't read the code close enough. I agree with kangz that we should prefer extension if given, otherwise, if none is provided or the extension given is not found, then we try all the available extensions and see what sticks. |
Hum, it's ok for Sorry if I fooled you with the “basename” variable, I need the full path without extension. Is there a FS::Path function to achieve that? |
|
Oh sorry, the correct function should have been FS::Path::StripExtension |
|
Thanks, and I will use another variable name to be more explicit. :-) |
|
So, I modified my patch using The travis-ci's build errored because of [Edit: after a force-push with the exact same code, travis-ci is fine] |
|
That's much better, thanks for the iteration! I'll merge it soon unless @DolceTriade or @Amanieu have other concerns. |
|
@Amanieu, @Kangz, @DolceTriade, do you need something more (perhaps spacing?) to be able to merge this PR in unv 0.42.0 ? |
|
LGTM |
allow extension independent soundfile path, fix #642
|
Thanks for the merge. |
Hi, this PR allows the engine to use extension independent sound path, so mappers can just write elemusic to load elemusic.wav or elemusic.opus, if one of them is available.
Also, the engine can load the elemusic.opus path if the bsp was compiled with elemusic.wav path. It allows asset managers to convert sound file without having to recompile the bsp.
It's the first time I'm writing some c++ lines in my life, so your comments are welcome, perhaps there is a better way to do it! 😉
This will also help out-of-tree map packaging, allowing mappers to compile their map against lossless assets and distribute them with lossy assets.
This PR fixes issue #642.