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

Outsource a few GLIB related functions to fluid_sys #901

Merged
merged 2 commits into from
Dec 21, 2021

Conversation

MrSapps
Copy link
Contributor

@MrSapps MrSapps commented May 30, 2021

No description provided.

@derselbst derselbst requested a review from mawe42 May 30, 2021 16:40
mawe42
mawe42 previously requested changes May 30, 2021
Copy link
Member

@mawe42 mawe42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Before we dive in to discuss the actual changes, please make sure that your commits are nicely separated and on topic. There are numerous changes that fix typos, change example code, formatting changes etc. While those smaller changes are probably very welcome, please provide them in a separate PR and keep this one focussed only on the glib stuff. Thanks!

@MrSapps
Copy link
Contributor Author

MrSapps commented May 30, 2021

@mawe42 thanks - this is now only the GLIB changes, opened 2 more PRs for warnings + typo fix

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

38.5% 38.5% Coverage
0.0% 0.0% Duplication

@mawe42
Copy link
Member

mawe42 commented May 30, 2021

Regarding the actual changes to make glib replaceable... I think it's a start, but I have to admit I'm not really fond of the many #ifdefs for GLIB_SUPPORT in the code. I would rather see a new include that bundles the whole glib stuff into a single file. I also don't like the hardcoded "glib_replacement.h" in fluidsynth_priv.h.

If we were to officially include such an option to build FluidSynth without glib, then users would expect us to officially support, maintain and document this use-case. Which means we need documentation, a clear example of what the "glib-replacement" needs to provide. Expecting people to hunt around in the code and glib docs to find out which functions and interfaces they need to provide is probably going to backfire on us. Don't get me wrong... it's great that you can remove glib and provide your own replacement with such a small changeset. But that's a completely different thing compared to us officially including it.

So I still think a more comprehensive approach is needed here. Refactor all platform related / glib code into an abstraction layer. Write documentation for the interface of that layer, functions, calling conventions. Then write an example replacement platform layer that people can modify to their needs. And maybe even provide a cmake option to allow users to specify their own source for that layer, ideally even out-of-tree to keep their fork nice and clean.

TLDR: in my opinion, this is not ready for merge and more discussion on the actual approach would be necessary.

@derselbst What's your take on this?

@mawe42 mawe42 requested a review from derselbst May 30, 2021 20:07
@MrSapps
Copy link
Contributor Author

MrSapps commented May 30, 2021

Is it possible to have wrapper functions for the atomic stuff? I figured that would make it not atomic anymore if there is a function call between them?

If there has to be an example implementation what should it use? SDL2? A Win32 impl?

@mawe42
Copy link
Member

mawe42 commented May 30, 2021

Good questions, which would all need to be discussed. Maybe we should continue throwing ideas around in #847.

And please don't get me wrong: I'm personally not opposed to making changes to the FS code to make it easier for people to "hack away" glib. But introducing a cmake option to disable glib and having a placeholder header file hardcoded somewhere is crossing the border towards "new feature". A feature that directly touches on the matters we are currently discussing in #847 and where we have not reached a good solution yet.

@derselbst
Copy link
Member

I must admit that I don't like this change too much either for the reasons you've just mentioned. However, I could befriend with this PR if we agree to move on to C++11 anyway. Because then I would see this only as temporary change, which is not worth to engineer any further.

I will make a new comment in #847 in a few seconds. And then give it some time so we see how the feedback is and we better know in which direction we should go.

@MrSapps
Copy link
Contributor Author

MrSapps commented May 31, 2021

Btw @derselbst / @mawe42 what do you think of this PR without the cmake change/ifdefs? (i.e just pushing all of the glib stuff into the priv/sys header?).

@mawe42
Copy link
Member

mawe42 commented May 31, 2021

just pushing all of the glib stuff into the priv/sys header?

Sounds good to me. That is actually what I expected you would propose in this PR after reading the discussion in #899 :-)

@derselbst
Copy link
Member

stuff into the priv/sys header?

Sounds good to me. That is actually what I expected you would propose in this PR after reading the discussion in #899 :-)

I second that.

@derselbst derselbst changed the title Add new "enable-glib" option to compile out use of glib bar LADSPA Outsource a few GLIB related functions to fluid_sys Dec 21, 2021
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

38.5% 38.5% Coverage
0.0% 0.0% Duplication

Copy link
Member

@derselbst derselbst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented what Marcus and I had in mind. Should be good now. Thanks.

@derselbst derselbst merged commit 13b3768 into FluidSynth:master Dec 21, 2021
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

Successfully merging this pull request may close these issues.

3 participants