Only set sample clips for valid files (#7224)
Check if a non-empty buffer was loaded and only set the sample clip if that's the case. ## Other changes 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. An unnecessary `static_cast` was removed while carrying over the code. Add the method `SampleClip::hasSampleFileLoaded` which checks if the loaded sample corresponds to a given file name. Fix code formatting.
This commit is contained in:
committed by
GitHub
parent
c0a4df49a2
commit
bb6a77aa0f
@@ -55,7 +55,9 @@ public:
|
||||
SampleClip& operator=( const SampleClip& that ) = delete;
|
||||
|
||||
void changeLength( const TimePos & _length ) override;
|
||||
void changeLengthToSampleLength();
|
||||
const QString& sampleFile() const;
|
||||
bool hasSampleFileLoaded(const QString & filename) const;
|
||||
|
||||
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
|
||||
void loadSettings( const QDomElement & _this ) override;
|
||||
|
||||
Reference in New Issue
Block a user