54 lines
1.5 KiB
C++
54 lines
1.5 KiB
C++
#pragma once
|
|
#include "PixelShaderViewer.h"
|
|
#include "PeakFile/PeakFile.h"
|
|
#include "PluginHost/Sampler.h"
|
|
|
|
class FSamplePatternInstance;
|
|
|
|
class IWaveformHandle
|
|
{
|
|
public:
|
|
virtual ~IWaveformHandle() = default;
|
|
virtual TArrayView<const FSamplePeak> GetWaveform(int32 SizeX) = 0;
|
|
};
|
|
|
|
class ARONA_API SWaveformViewer : public SLeafWidget
|
|
{
|
|
public:
|
|
SWaveformViewer();
|
|
SLATE_BEGIN_ARGS(SWaveformViewer)
|
|
{
|
|
}
|
|
SLATE_ARGUMENT(TSharedPtr<IWaveformHandle>, WaveformHandle)
|
|
SLATE_END_ARGS()
|
|
|
|
/** Constructs this widget with InArgs */
|
|
void Construct(const FArguments& InArgs);
|
|
|
|
virtual void Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) override;
|
|
virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
|
|
virtual FVector2D ComputeDesiredSize(float LayoutScaleMultiplier) const override { return RenderTarget->GetSize(); }
|
|
private:
|
|
TSharedPtr<FSlateRenderTarget> RenderTarget;
|
|
TSharedPtr<FSlateComputeShader> ComputeShader;
|
|
TSharedPtr<FSlateShaderParam> Params;
|
|
TSharedPtr<IComputeShaderSlateElement> ComputeElement;
|
|
|
|
struct UpdateTask
|
|
{
|
|
TArray<float> Array;
|
|
FIntPoint Size;
|
|
float LineUV;
|
|
};
|
|
mutable TQueue<UpdateTask, EQueueMode::Mpsc> UpdateQueue;
|
|
|
|
struct FCSParam
|
|
{
|
|
FLinearColor WaveColor;
|
|
FLinearColor BgColor;
|
|
float LineUV;
|
|
float PeaksPerPixel;
|
|
} mutable Param;
|
|
TSharedPtr<IWaveformHandle> WaveformHandle;
|
|
};
|