Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
gpu_spectral_morph.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <vector>
5
8
9namespace pulp::gpu_audio {
10
18 public:
24 bool prepare(uint32_t fft_size,
26 render::GpuCompute* shared_device = nullptr);
27
28 bool gpu_available() const { return stft_.gpu_available(); }
30 bool device_usable() const {
31 return stft_.device_usable();
32 }
33 uint32_t fft_size() const { return stft_.fft_size(); }
34 bool ready() const { return has_a_ && has_b_; }
35
36 bool capture_a(const float* frame_in);
37 bool capture_b(const float* frame_in);
38
42 bool render(float t, float* frame_out);
43
44private:
45 GpuStft stft_;
46 std::vector<float> a_, b_, mix_; // 2*fft_size interleaved-complex spectra
47 bool has_a_ = false;
48 bool has_b_ = false;
49};
50
51} // namespace pulp::gpu_audio
Spectral morph: capture two spectra (A and B) and render a blend at position t ∈ [0,...
Definition gpu_spectral_morph.hpp:17
bool gpu_available() const
Definition gpu_spectral_morph.hpp:28
bool device_usable() const
False once the prepared device is lost or its generation changed.
Definition gpu_spectral_morph.hpp:30
bool capture_b(const float *frame_in)
bool ready() const
Definition gpu_spectral_morph.hpp:34
uint32_t fft_size() const
Definition gpu_spectral_morph.hpp:33
bool prepare(uint32_t fft_size, signal::WindowFunction::Type window=signal::WindowFunction::Type::hann, render::GpuCompute *shared_device=nullptr)
shared_device (optional) reuses an existing GpuCompute so this morph and a sibling spectral primitive...
bool render(float t, float *frame_out)
Render the morph at position t (clamped to [0,1]) into frame_out (fft_size real samples).
bool capture_a(const float *frame_in)
GPU short-time Fourier transform primitive (spectral toolkit).
Definition gpu_stft.hpp:21
GPU compute pipeline for non-rendering workloads (e.g.
Definition gpu_compute.hpp:48
Type
Definition windowing.hpp:43
@ hann
Definition windowing.hpp:45
Definition flow_pans.hpp:19