-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fixes style on "SampleBuffer.cpp" and "SampleBuffer.h" #5791
Fixes style on "SampleBuffer.cpp" and "SampleBuffer.h" #5791
Conversation
This PR attempts to fix code style issues, refactor code and remove small bugs on the SampleBuffer.cpp file. Changes so far: include/SampleBuffer.h - Fixes parameters names to use cammelCase and remove spaces from parenthesis on the methods below: SampleBuffer::handleState::handleState SampleBuffer::handleState::setFrameIndex SampleBuffer::handleState::setBackwards SampleBuffer::SampleBuffer SampleBuffer::update SampleBuffer::play SampleBuffer::resample SampleBuffer::normalizeSampleRate SampleBuffer::convertIntToFloat SampleBuffer::directFloatWrite SampleBuffer::decodeSampleSF SampleBuffer::decodeSampleOGGVorbis SampleBuffer::decodeSampleDS SampleBuffer::getSampleFragment SampleBuffer::getLoopedIndex SampleBuffer::getPingPongIndex src/core/SampleBuffer.cpp - Fixes spacing on method/function calls, if-conditionals, while/for loops. - Replaces NULL with nullptr where appropriate. - Fixes variable names to use camelCase. SampleBuffer::SampleBuffer SampleBuffer::~SampleBuffer SampleBuffer::sampleRateChanged SampleBuffer::update SampleBuffer::convertIntToFloat SampleBuffer::directFloatWrite SampleBuffer::normalizeSampleRate SampleBuffer::decodeSampleSF * qfileReadCallback qfileSeekCallback qfileCloseCallback qfileTellCallback SampleBuffer::decodeSampleOGGVorbis * SampleBuffer::decodeSampleDS SampleBuffer::play SampleBuffer::getSampleFragment SampleBuffer::getLoopedIndex SampleBuffer::getPingPongIndex SampleBuffer::resample SampleBuffer::handleState::handleState Fixes bug on SampleBuffer::decodeSampleSF The variable sf_rr (now renamed to sfFramesRead) was declared as a boolean, but was used to store the return value of sf_read_float which is of type sf_count_t, representing the number of frames read. If was later used to check if there was an error during the read by using the following comparison: if( sf_rr < sf_info.channels * frames ). This comparison was probably not working as intended because the types being compared were not the ones expected (bool and int). Removes comment from OV_ENOTVORBIS error on SampleBuffer::decodeSampleOGGVorbis
Continues to fix code style issues on the following methods: SampleBuffer::visualize() SampleBuffer::openAudioFile() SampleBuffer::openAndSetAudioFile() SampleBuffer::openAndSetWaveformFile() Removes a leftover space on SampleBuffer::play arguments list.
Refactors the code style on the following methods: -SampleBuffer::toBase64() -SampleBuffer::setAudioFile() -flacStreamEncoderWriterCallback() -flacStreamEncoderMetadataCallback() Removes forgotten whitespace at SampleBuffer::resample().
Refactors the struct flacStreamDecoderClientData and the following methods: -flacStreamDecodeReadCallback() -flacStreamDecodeWriteCallback() -flacStreamDecodeMetadataCallback() -flacStreamDecodeErrorCallback()
Fixes the code style of the following methods: -SampleBuffer::setLoopStartFrame() -SampleBuffer::setLoopEndFrame() -SampleBuffer::setAllPointFrames() -SampleBuffer::sampleLength() -SampleBuffer::setFrequency() -SampleBuffer::setSampleRate() -SampleBuffer::userWaveSample() -SampleBuffer::loadFromBase64() -SampleBuffer::setStartFrame() -SampleBuffer::setEndFrame() -SampleBuffer::setAmplification() -SampleBuffer::setReversed()
🤖 Hey, I'm @LmmsBot from github.com/lmms/bot and I made downloads for this pull request, click me to make them magically appear! 🎩
Linux
Windows
macOS🤖{"platform_name_to_artifacts": {"Linux": [{"artifact": {"title": {"title": "(AppImage)", "platform_name": "Linux"}, "link": {"link": "https://11341-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.48%2Bgfaebb86-linux-x86_64.AppImage"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/11341?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}], "Windows": [{"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://11342-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.48%2Bgfaebb86e0-mingw-win32.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/11342?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://11344-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.48%2Bgfaebb86e0-mingw-win64.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/11344?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/xtbbhmp17xfegwmy/artifacts/build/lmms-1.3.0-alpha-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/36679436"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/k493imr45bpdg5mv/artifacts/build/lmms-1.3.0-alpha-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/36679436"}], "macOS": [{"artifact": {"title": {"title": "", "platform_name": "macOS"}, "link": {"link": "https://11343-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.48%2Bgfaebb86e0-mac10.14.dmg"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/11343?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}]}, "commit_sha": "553e2ca502a75ba7245076ee0aad31d1be629d8c"} |
Improves the formatting on the method declarations that span multiple lines. Also removes some unnecessary line breaks from SampleBuffer.cpp.
Could you split this to fixes and style changes so we can merge fixes first? |
Sure, I'll do it later today! |
Fixes conflicts introduced by LMMS#5765.
Merged master and fixed conflict with changes from PR #5765 |
@IanCaio I can review this. There are currently conflicts with master. Could you please do a rebase in your local repo to the current master and force-push it over this PR? |
Thanks! The conflicts aren't showing here on Github (there was one fixed on the last commit) but I'll merge master, fix any that show and push soon. I'm just trying to address a review on another PR first. |
@IanCaio Still conflicting files 😄 |
Fixes conflict introduced by LMMS#5816.
I'm just writing down my own strategy to check that this PR is valid:
Can anyone check whether my strategy would be correct, and complete? |
I think the per-method approach would be the most fail-proof, but from what I read the logic is fine and covers it all! As far as I remember, most name substitutions didn't cause conflict. |
I'm through all formatting changes and variable renames. I'll only do a few checks for other things. @IanCaio when all is OK, shall I squash & merge this? |
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.
Review finished. Only 1 minor comment.
Sure! When you think it's good you can merge it |
Merged. Thanks for the contribution! |
Fix code style issues in the `SampleBuffer` class. Remove strange comments around "not an Ogg Vorbis file" warning.
Fix code style issues in the `SampleBuffer` class. Remove strange comments around "not an Ogg Vorbis file" warning.
Fix code style issues in the `SampleBuffer` class. Remove strange comments around "not an Ogg Vorbis file" warning.
The code style on the files
src/core/SampleBuffer.cpp
andinclude/SampleBuffer.h
was fixed. Most of the fixes were indentation, spacing, variable names (dropping the underscore on arguments and using camelCase) and changes to improve readability. A list of the affected methods is at the end of the PR message.The bugfix mentioned below was extracted to a separate PR (#5796) which is already merged:
On
SampleBuffer::decodeSampleOGGVorbis()
I removed the comment block of one of theprintfs
that warns the user of an error value being returned on the vorbis library read method. It seems to be triggered when loading certain types of files even though they load fine (I noticed it on .ds files), so I can comment it out again. I'm not sure that's an appropriate fix though, maybe hiding them behind the DEBUG macro would be better.As agreed upon, #5765 should be merged before this PR to avoid the merge conflicts on his end. Also, these changes shouldn't cause any issues to classes that use
SampleBuffer
since they were only internal, no method names or parameters list were changed.Methods that were affected:
Some issues that this PR doesn't fix (TODO):
sampleFrame
toSampleFrame
: Spans several files.handleState
toHandleState
: Spans fewer files, but is used outsideSampleBuffer.cpp
.buf
andfbuf
declarations fromSampleBuffer::update
and let them be declared on the decode methods instead.qMin(frames, loopEnd - index);
because there was a previous conditional withif (index + frames <= loopEnd) ... return;
, meaning thatframes
will be smaller thanloopEnd - index
. (Need to double check. Might be safer to keep the call for the long-term code maintenance, just bringing it up)SampleBuffer::getSampleFragment
to use a reference to a pointer instead of a pointer to a pointer.SampleBuffer::visualize
).