Convert std::shared_ptr<Sample> to Sample

This conversion does not apply to Patman as there seems to be issues
with it causing heap-use-after-free issues, such as with
PatmanInstrument::unloadCurrentPatch
This commit is contained in:
sakertooth
2023-09-27 17:20:59 -04:00
parent 8689a68ad5
commit 900e52cc1a
8 changed files with 53 additions and 54 deletions

View File

@@ -63,7 +63,7 @@ public:
return "sampleclip";
}
std::shared_ptr<Sample> sample()
const Sample& sample()
{
return m_sample;
}
@@ -87,7 +87,7 @@ public slots:
private:
std::shared_ptr<Sample> m_sample = std::make_shared<Sample>();
Sample m_sample;
BoolModel m_recordModel;
bool m_isPlaying;

View File

@@ -44,7 +44,7 @@ class AudioPort;
class LMMS_EXPORT SamplePlayHandle : public PlayHandle
{
public:
SamplePlayHandle(std::shared_ptr<const Sample> sampleBuffer , bool ownAudioPort = true);
SamplePlayHandle(const Sample* sample, bool ownAudioPort = true);
SamplePlayHandle( const QString& sampleFile );
SamplePlayHandle( SampleClip* clip );
~SamplePlayHandle() override;
@@ -82,7 +82,7 @@ public:
private:
std::shared_ptr<const Sample> m_sample;
const Sample* m_sample;
bool m_doneMayReturnTrue;
f_cnt_t m_frame;