-
-
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
Only set sample clips for valid files #7224
Only set sample clips for valid files #7224
Conversation
Check if a non-empty buffer was loaded and only set the sample clip if that's the case. Fix code formatting.
Move setting the song to modified towards the core in the context of `SampleClip`. Previously the `SampleClipView` did this but it's none of it's business. Introduce `SampleClip::changeLengthToSampleLength` which changes the length of the clip to the length of the sample. This was also previously done by the view which is again the wrong place to do the necessary calculations.
Remove the `QMessageBox` include which is a left over of another fix attempt.
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.
The comments are a bit much. I feel like the code is simple enough that it can be understood very well without them. Also, we might want to change SampleLoader::createBufferFromFile
to return nullptr
later. It returned an empty buffer just in case callers did not handle it properly, but it may make checking for validity more simplistic.
Remove an unnecessary `static_cast`.
Do we really need all of these comments? The code is very simple to understand without them. |
Add the method `SampleClip::hasSampleFileLoaded` and remove some comments.
Most of the comments have been kept and slightly adjusted from the previous code. With commit 4d5bf7c I have removed them. I have also introduced |
Check if a non-empty buffer was loaded and only set the sample clip if that's the case.
Fix code formatting.
Fixes #6287.