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

libsndfile: use a macro instead of redefining the struct #5761

Merged
merged 2 commits into from
Apr 25, 2022

Conversation

dyfer
Copy link
Member

@dyfer dyfer commented Apr 19, 2022

Purpose and Motivation

Fixes compatibility with libsndfile >=1.1.0
Fixes #5756

See #5756 (comment) for previous discussion.

Thanks @Spacechild1 for providing this fix.

I also had to add additional Windows includes in SC_HiddenWorld.h, similarly to SC_SndFileHelpers.hpp.

Please review carefully, as I have limited experience with this aspect of the project.

Types of changes

  • Bug fix

To-do list

  • Code is tested
  • All tests are passing
  • Updated documentation
  • This PR is ready for review

@dyfer dyfer added the comp: 3rd party 3rd party libraries/dependencies label Apr 19, 2022
@dyfer dyfer force-pushed the topic/libsndfile-fix-2 branch from ae836a9 to 3907231 Compare April 19, 2022 00:17
@@ -126,17 +126,17 @@ void DiskIOMsg::Perform() {
memset(buf->data + mPos * buf->channels, 0, mFrames * buf->channels * sizeof(float));
goto leave;
}
count = sf_readf_float(buf->sndfile, buf->data + mPos * buf->channels, mFrames);
count = sf_readf_float(GetSndFile(buf), buf->data + mPos * buf->channels, mFrames);
Copy link
Member

Choose a reason for hiding this comment

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

this may not matter, but I wonder if it is cleaner to store the result of GetSndFile(but) into a variable and pass that around, rather than calling GetSndFile over and over again?

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO it's fine because GetSndFile is just a getter macro and not a real function call. I find it quite readable. After all, it's just 3 characters longer than the original code.

Copy link
Member

@joshpar joshpar left a comment

Choose a reason for hiding this comment

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

@dyfer - I think this mostly is fine, but the readability of the change feels a little off to me. that being said, if you feel ok with it, I can go with it as well.
I think in other places, macros use all upper case? Maybe that would help this from looking like a method / class call? GETSNDFILE instead?
Let me know what you think. This is a stylistic question more than a functional one.

@Spacechild1
Copy link
Contributor

Spacechild1 commented Apr 19, 2022

I think in other places, macros use all upper case?

It depends. For example, the macros in SC_InterfaceTable.h are camel case.

Anyway, GETSNDFILE would be fine as well. I really have no preference.

@dyfer
Copy link
Member Author

dyfer commented Apr 19, 2022

@dyfer - I think this mostly is fine, but the readability of the change feels a little off to me. that being said, if you feel ok with it, I can go with it as well. I think in other places, macros use all upper case? Maybe that would help this from looking like a method / class call? GETSNDFILE instead? Let me know what you think. This is a stylistic question more than a functional one.

I also wasn't convinced by the readability. I'll change it to all caps.

@dyfer dyfer force-pushed the topic/libsndfile-fix-2 branch from 3907231 to 70ee9a8 Compare April 19, 2022 19:13
server/scsynth/SC_World.cpp Outdated Show resolved Hide resolved
@dyfer dyfer force-pushed the topic/libsndfile-fix-2 branch from 70ee9a8 to e93a0c8 Compare April 19, 2022 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: 3rd party 3rd party libraries/dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libsndfile version 1.1.0 breaks building from source
4 participants