Integrate changes into SampleClip/SamplePlayHandle
This commit is contained in:
@@ -25,7 +25,9 @@
|
||||
#ifndef LMMS_SAMPLE_CLIP_H
|
||||
#define LMMS_SAMPLE_CLIP_H
|
||||
|
||||
#include <memory>
|
||||
#include "Clip.h"
|
||||
#include "Sample.h"
|
||||
|
||||
namespace lmms
|
||||
{
|
||||
@@ -52,7 +54,7 @@ public:
|
||||
SampleClip& operator=( const SampleClip& that ) = delete;
|
||||
|
||||
void changeLength( const TimePos & _length ) override;
|
||||
const QString & sampleFile() const;
|
||||
QString sampleFile() const;
|
||||
|
||||
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
|
||||
void loadSettings( const QDomElement & _this ) override;
|
||||
@@ -61,9 +63,9 @@ public:
|
||||
return "sampleclip";
|
||||
}
|
||||
|
||||
SampleBuffer* sampleBuffer()
|
||||
std::shared_ptr<Sample> sample()
|
||||
{
|
||||
return m_sampleBuffer;
|
||||
return m_sample;
|
||||
}
|
||||
|
||||
TimePos sampleLength() const;
|
||||
@@ -76,7 +78,7 @@ public:
|
||||
void setIsPlaying(bool isPlaying);
|
||||
|
||||
public slots:
|
||||
void setSampleBuffer( lmms::SampleBuffer* sb );
|
||||
void setSampleBuffer(SampleBuffer2* sb);
|
||||
void setSampleFile( const QString & _sf );
|
||||
void updateLength();
|
||||
void toggleRecord();
|
||||
@@ -85,7 +87,7 @@ public slots:
|
||||
|
||||
|
||||
private:
|
||||
SampleBuffer* m_sampleBuffer;
|
||||
std::shared_ptr<Sample> m_sample = std::make_shared<Sample>();
|
||||
BoolModel m_recordModel;
|
||||
bool m_isPlaying;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
static QString openAudioFile(const QString& previousFile = "");
|
||||
static QString openWaveformFile(const QString& previousFile = "");
|
||||
static std::unique_ptr<SampleBuffer2> createBufferFromFile(const QString& filePath);
|
||||
static std::unique_ptr<SampleBuffer2> createBufferFromBase64(const QString& base64, int sampleRate);
|
||||
static std::unique_ptr<SampleBuffer2> createBufferFromBase64(const QString& base64, int sampleRate = Engine::audioEngine()->processingSampleRate());
|
||||
private:
|
||||
static void displayError(const QString& message);
|
||||
};
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#ifndef LMMS_SAMPLE_PLAY_HANDLE_H
|
||||
#define LMMS_SAMPLE_PLAY_HANDLE_H
|
||||
|
||||
#include "Sample.h"
|
||||
#include "SampleBuffer.h"
|
||||
#include "AutomatableModel.h"
|
||||
#include "PlayHandle.h"
|
||||
@@ -43,7 +44,7 @@ class AudioPort;
|
||||
class LMMS_EXPORT SamplePlayHandle : public PlayHandle
|
||||
{
|
||||
public:
|
||||
SamplePlayHandle( SampleBuffer* sampleBuffer , bool ownAudioPort = true );
|
||||
SamplePlayHandle(std::shared_ptr<const Sample> sampleBuffer , bool ownAudioPort = true);
|
||||
SamplePlayHandle( const QString& sampleFile );
|
||||
SamplePlayHandle( SampleClip* clip );
|
||||
~SamplePlayHandle() override;
|
||||
@@ -81,11 +82,11 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
SampleBuffer * m_sampleBuffer;
|
||||
std::shared_ptr<const Sample> m_sample;
|
||||
bool m_doneMayReturnTrue;
|
||||
|
||||
f_cnt_t m_frame;
|
||||
SampleBuffer::handleState m_state;
|
||||
Sample::PlaybackState m_state;
|
||||
|
||||
const bool m_ownAudioPort;
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <QPair>
|
||||
|
||||
#include "PlayHandle.h"
|
||||
#include "SampleBuffer2.h"
|
||||
#include "TimePos.h"
|
||||
|
||||
namespace lmms
|
||||
@@ -53,7 +54,7 @@ public:
|
||||
bool isFromTrack( const Track * _track ) const override;
|
||||
|
||||
f_cnt_t framesRecorded() const;
|
||||
void createSampleBuffer( SampleBuffer * * _sample_buf );
|
||||
void createSampleBuffer(SampleBuffer2** _sample_buf);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user