11 dragging_overlay_(
Shaders::kColorFragment) {
12 addAndMakeVisible(bottom_);
15 sample_phase_output_ =
nullptr;
18 dragging_audio_file_ =
false;
36 for (
Listener* listener : listeners_)
37 listener->sampleLoaded(file);
44 dragging_audio_file_ =
false;
50 if (sample_ ==
nullptr)
55 float center = getHeight() / 2.0f;
57 int start_index = std::min<int>(sample_length * i /
kResolution, sample_length);
59 float max = buffer[start_index];
60 for (
int i = start_index + 1; i < end_index; ++i)
61 max = std::max(max, buffer[i]);
62 setYAt(i, center - max * center);
63 bottom_.
setYAt(i, center + max * center);
78 bottom_.setBounds(getLocalBounds());
84 bottom_.
setXAt(i, getWidth() * t);
87 if (sample_phase_output_ ==
nullptr) {
111 if (sample_ ==
nullptr)
115 if (sample_phase_output_ ==
nullptr || sample_length == 0)
137 bottom_.
boostRange(last_phase_, phase, 0, decay);
148 float fill_fade = 0.0f;
165 setFillColors(fill.withMultipliedAlpha(1.0f - fill_fade), fill);
166 bottom_.
setFillColors(fill.withMultipliedAlpha(1.0f - fill_fade), fill);
183 setFillColors(fill.withMultipliedAlpha(1.0f - fill_fade), fill);
184 bottom_.
setFillColors(fill.withMultipliedAlpha(1.0f - fill_fade), fill);
190 if (dragging_audio_file_)
191 dragging_overlay_.
render(open_gl, animate);
virtual void resized() override
Called when the component is resized.
Definition open_gl_component.cpp:121
void addBottomRoundedCorners()
Adds rounded corners only at the bottom of the component.
Definition open_gl_component.cpp:143
void renderCorners(OpenGlWrapper &open_gl, bool animate, Colour color, float rounding)
Renders the corner shapes using the given color and rounding amount.
Definition open_gl_component.cpp:153
float findValue(Skin::ValueId value_id)
Finds a float value from the skin associated with this component's parent.
Definition open_gl_component.cpp:173
const SynthSection * parent_
Pointer to parent SynthSection for skin lookups.
Definition open_gl_component.h:256
A component for rendering lines with optional filling and boost effects using OpenGL.
Definition open_gl_line_renderer.h:16
force_inline void setYAt(int index, float val)
Sets the y-coordinate of a point, marking data as dirty.
Definition open_gl_line_renderer.h:98
force_inline void setFill(bool fill)
Enables or disables filling below the line.
Definition open_gl_line_renderer.h:124
void decayBoosts(vital::poly_float mult)
Decays all boosts by a multiplicative factor, allowing animated damping.
Definition open_gl_line_renderer.cpp:185
force_inline void setFillBoostAmount(float boost_amount)
Sets the boost amount that affects fill thickness.
Definition open_gl_line_renderer.h:147
force_inline void setBoostAmount(float boost_amount)
Sets the boost amount that affects line thickness.
Definition open_gl_line_renderer.h:144
force_inline void setXAt(int index, float val)
Sets the x-coordinate of a point, marking data as dirty.
Definition open_gl_line_renderer.h:105
force_inline void setFillColors(Colour fill_color_from, Colour fill_color_to)
Sets a gradient fill from one color to another.
Definition open_gl_line_renderer.h:132
bool anyBoostValue()
Checks if any boost value is set.
Definition open_gl_line_renderer.h:202
force_inline void setLineWidth(float width)
Sets the line width in pixels.
Definition open_gl_line_renderer.h:66
force_inline void setColor(Colour color)
Sets the line color.
Definition open_gl_line_renderer.h:63
void boostRange(float *boosts, float start, float end, int buffer_vertices, float min)
Boosts a range for the given boost array.
Definition open_gl_line_renderer.cpp:128
void drawLines(OpenGlWrapper &open_gl, bool left)
Draws the line and optional fill using OpenGL.
Definition open_gl_line_renderer.cpp:386
void setTargetComponent(Component *target_component)
Sets a target component to help position the quads.
Definition open_gl_multi_quad.h:358
virtual void render(OpenGlWrapper &open_gl, bool animate) override
Renders the quads using OpenGL.
Definition open_gl_multi_quad.cpp:92
force_inline void setColor(Colour color)
Sets the base color for the quads.
Definition open_gl_multi_quad.h:102
Interface for objects that want to be notified when a sample is loaded.
Definition sample_viewer.h:32
virtual ~SampleViewer()
Destructor.
Definition sample_viewer.cpp:30
bool isActive() const
Definition sample_viewer.h:77
std::string getName()
Definition sample_viewer.cpp:69
SampleViewer()
Constructor.
Definition sample_viewer.cpp:10
static constexpr float kResolution
The resolution of the waveform, in number of points.
Definition sample_viewer.h:24
static constexpr float kBoostDecay
The decay factor for line boosts.
Definition sample_viewer.h:26
void repaintAudio()
Repaints the waveform after an audio update.
Definition sample_viewer.cpp:43
void render(OpenGlWrapper &open_gl, bool animate) override
Definition sample_viewer.cpp:101
static constexpr float kSpeedDecayMult
The multiplier for decay when lines move quickly.
Definition sample_viewer.h:28
void audioFileLoaded(const File &file) override
Definition sample_viewer.cpp:35
void setLinePositions()
Sets the line positions (y-values) of the waveform based on the current sample.
Definition sample_viewer.cpp:49
void resized() override
Handles component resizing. Adjusts waveform geometry.
Definition sample_viewer.cpp:77
Manages and provides access to vertex and fragment shaders used by the OpenGL rendering pipeline.
Definition shaders.h:19
@ kWidgetFillFade
Definition skin.h:108
@ kWidgetLineBoost
Definition skin.h:106
@ kWidgetFillBoost
Definition skin.h:109
@ kWidgetPrimaryDisabled
Definition skin.h:167
@ kWidgetPrimary2
Definition skin.h:166
@ kWidgetPrimary1
Definition skin.h:165
@ kWidgetSecondary1
Definition skin.h:168
@ kWidgetSecondaryDisabled
Definition skin.h:170
@ kOverlayScreen
Definition skin.h:140
@ kWidgetSecondary2
Definition skin.h:169
const vital::StatusOutput * getStatusOutput(const std::string &name)
Retrieves a status output by name.
Definition synth_base.cpp:262
An interface class linking the Vital synthesizer backend (SynthBase) with a GUI.
Definition synth_gui_interface.h:56
SynthBase * getSynth()
Returns the SynthBase instance this interface is managing.
Definition synth_gui_interface.h:85
float findValue(Skin::ValueId value_id) const
Finds a value in the skin overrides or from the parent if not found locally.
Definition synth_section.cpp:18
std::string getName() const
Returns the user-facing name of the sample.
Definition sample_source.h:91
force_inline const mono_float * buffer() const
Returns a pointer to the (current) left channel buffer at the base upsample level.
Definition sample_source.h:121
force_inline int originalLength() const
Returns the length of the originally loaded sample in frames.
Definition sample_source.h:99
force_inline bool isClearValue(poly_float value) const
Checks if a given poly_float is the special "clear" value.
Definition synth_module.h:81
force_inline poly_float value() const
Returns the current status value.
Definition synth_module.h:49
force_inline poly_float clamp(poly_float value, mono_float min, mono_float max)
Clamps each lane of a vector to [min, max].
Definition poly_utils.h:306
force_inline poly_float max(poly_float left, poly_float right)
Returns the maximum of two poly_floats lane-by-lane.
Definition poly_utils.h:327
force_inline poly_float maskLoad(poly_float zero_value, poly_float one_value, poly_mask reset_mask)
Selects between two values (zero_value or one_value) based on a mask in each lane.
Definition poly_utils.h:351
force_inline std::pair< poly_float, poly_float > decodePhaseAndVoice(poly_float encoded)
Decodes a phase and voice from an encoded float, returning (phase, voice).
Definition poly_utils.h:987
float mono_float
Definition common.h:33
Declares the SampleViewer class that displays and animates a waveform sample.
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174
Represents a vector of floating-point values using SIMD instructions.
Definition poly_values.h:600
static force_inline simd_type vector_call abs(simd_type value)
Computes the absolute value of each element in the SIMD float register.
Definition poly_values.h:935
static force_inline mask_simd_type vector_call notEqual(simd_type one, simd_type two)
Compares two SIMD float registers for non-equality, element-wise.
Definition poly_values.h:1003
Represents a vector of integer values using SIMD instructions.
Definition poly_values.h:56