-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Remove dependecy toward libsndfile on all OS #757
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
Conversation
I've fixed Android compiling and linking in my own branch. Commit 3b05ee1 fixes code issues, while 2498028 includes precompiled binaries. There's still the open issue of the new audio file loading not trying to load ressources bundled inside the APK though (will have a look at this as soon as possible before opening another PR on this branch). |
namespace sf | ||
{ | ||
//////////////////////////////////////////////////////////// | ||
bool FileInputStream::open(const std::string& filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would need some way of abstraction for Android, i.e. allowing the user to either load something off the sd card (i.e. current solution) or something inside/relative to the APK file. Maybe consider all relative paths to point to the APK file? Or should this be put into another new stream class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the loadFromFile
functions in SFML already contain Android specific code, to use the dedicated ResourceStream class (which, I imagine, takes care of this problem). Can't all this stuff be mixed nicely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably. It just needs some nice and convenient way to determine what the user wants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a look at the whole new ...InputStream
structure and I guess it's best to leave this part alone and instead modify Android's ResourceStream
to provide the same interface as FileInputStream
(so they're easily replaced).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that some loadFromFile
functions (such as Shader
) don't do anything regarding that matter. But we should probably discuss that on the forum. ;-)
@MarioLiebisch you should probably drop a line here otherwise ChronicRat might work for nothing. |
Since only Android is missing, and it requires more works, I suggest we go on with reviewing this and merge it. Android stuff can be added later. |
Just keep in mind that it breaks Android. |
That's a good point. I'll add your first two commits I guess. |
Here, can you check that it's working on Android? Thanks. (I haven't added |
It will build and link properly, but in this state it's unable to load asset files. Not sure what happens if you try to load files off the sd card/internal memory (might be a starting point for testing).
|
Ha, I missed the Maybe it should go into a dedicated directory for android (like we used to do it with sndfile on Windows/Mac/Android) since it's platform specific. And does this file change with the different Android architectures? |
Would be another idea. It shouldn't change, since it really just holds the names of integers with a fixed length. Theoretically it might change between compilers, but considering the Android version compiles with GCC by default anyway... |
@MarioLiebisch Just to be sure, there's absolutely no difference in Assuming it is the case, then: @LaurentGomila (and others): until now we had |
If it's the same then there's no reason to duplicate it per platform. There's no "spirit", let's just be pragmatic ;) |
From what I can tell, the header file is exactly the same for all Android architectures (compared armeabi, x86, and x86_64) as long as we're forcing GCC to be used. Not sure regarding other platforms and/or compilers though. |
Alright. So I've checked and got the same file on OS X than @MarioLiebisch on Android. I don't know about iOS, Linux or Windows (@eXpl0it3r, since you've build them, do you know?). For reference, |
I've only built the FLAC libraries which didn't require any |
Right, sorry about that. So, Laurent? ;) |
I just checked on Linux and the file is different. Don't know about Windows. Even though we don't provide Linux binaries, it's not that hard to make a special rules for Android in |
8b8f02b
to
69839e2
Compare
@MarioLiebisch I've updated (rebased + force pushed) the branch, can you check that it now build fine on Android? Thanks. |
Okay, this just needs a minor fix for the paths (the way you did it won't work since the relative path ( This leaves just the minor issue of the Android version trying to read the audio files from the file system rather than the assets. I've modified What do you think? |
ff9e1a6
to
0c2f306
Compare
Fixed already - really just been two changes at the same position in the file. |
👍 |
have all issues been fixed or am I mistaken? |
Yes, I think we are good to go. |
This PR has been added to my merge list, meaning it will be merged soon, unless someone raises any concerns. |
I've got some, sorry. :-P I'm pretty much done reviewing it and just spot minor typos. Won't be long. |
Done. Nothing else for me. |
It is not possible to register your own file reader/writer that has been internally registered, just for the fact that you used to search forward instead of backward.
I'm just writing to let you know. |
@a-maly Hm... yeah, overwriting built-in filters sounds like a neat tidbit some might want to do. |
I suggest that we release it now, get some feedback, and work more on it later if needed. Unless something is broken, this PR must be merged now :p |
I guess we could add a priority system, or something similar, in SFML 3 but I believe that for now this is enough. Most people will simply use the default implementation (which should be good enough in any case) I guess. So let's proceed as-is. :-) |
👏 🎉 🍸 Now let's wait for all the bug reports. 😄 |
Got one! 😋 It's a slight oversight that can lead to some hard-to-debug issues: There is one thing I'm not sure of: since If that's the case we can just make it inherit from |
|
Alright, will create a PR for that then. |
This implements #604. It's a rebase of
feature/no_libsndfile_osx
onto master (which includesfeature/no_libsndfile
) so be extra careful when proofreading it. Hopefully I haven't made any mistake but there were a lot of conflicts so...What's done & what's to be done:
It also includes the base step toward #620.