87 grid_lines_.
init(open_gl);
88 grid_circles_.
init(open_gl);
89 hover_circle_.
init(open_gl);
90 editing_line_.
init(open_gl);
101 grid_lines_.
render(open_gl, animate);
102 grid_circles_.
render(open_gl, animate);
103 hover_circle_.
render(open_gl, animate);
105 editing_line_.
render(open_gl, animate);
116 grid_circles_.
destroy(open_gl);
117 hover_circle_.
destroy(open_gl);
118 editing_line_.
destroy(open_gl);
127 void mouseDown(
const MouseEvent& e)
override;
134 void mouseUp(
const MouseEvent& e)
override;
141 void mouseMove(
const MouseEvent& e)
override;
148 void mouseDrag(
const MouseEvent& e)
override;
155 void mouseExit(
const MouseEvent& e)
override;
163 float valueAt(
int index) {
return values_[index]; }
192 void setGrid(
int horizontal,
int vertical);
208 void fileDragEnter(
const StringArray& files,
int x,
int y)
override;
236 void setGridPositions();
241 void setHoverPosition();
249 void changeValues(
const MouseEvent& e);
257 Point<int> getSnappedPoint(Point<int> input);
265 Point<int> snapToGrid(Point<int> input);
273 int getHoveredIndex(Point<int> position);
280 float getSnapRadius();
285 void setLineValues();
287 std::vector<Listener*> listeners_;
288 Point<int> last_edit_position_;
289 Point<int> current_mouse_position_;
296 std::unique_ptr<AudioFileDropSource> audio_file_drop_source_;
297 std::unique_ptr<float[]> values_;
299 bool dragging_audio_file_;
301 int horizontal_grid_;
A helper class for handling drag-and-drop of audio files into a JUCE component.
Definition audio_file_drop_source.h:19
A component for rendering lines with optional filling and boost effects using OpenGL.
Definition open_gl_line_renderer.h:16
virtual void init(OpenGlWrapper &open_gl) override
Initializes OpenGL resources for rendering the line.
Definition open_gl_line_renderer.cpp:78
virtual void destroy(OpenGlWrapper &open_gl) override
Destroys OpenGL resources allocated by this line renderer.
Definition open_gl_line_renderer.cpp:468
virtual void render(OpenGlWrapper &open_gl, bool animate) override
Renders the line using OpenGL.
Definition open_gl_line_renderer.cpp:464
A component for rendering multiple quads using OpenGL, with customizable colors, rounding,...
Definition open_gl_multi_quad.h:16
virtual void init(OpenGlWrapper &open_gl) override
Initializes OpenGL buffers and shader attributes.
Definition open_gl_multi_quad.cpp:37
virtual void render(OpenGlWrapper &open_gl, bool animate) override
Renders the quads using OpenGL.
Definition open_gl_multi_quad.cpp:92
virtual void destroy(OpenGlWrapper &open_gl) override
Releases OpenGL resources when the component is destroyed.
Definition open_gl_multi_quad.cpp:69
A convenience class for a single quad rendered via OpenGL.
Definition open_gl_multi_quad.h:447
Interface for receiving notifications about waveform modifications.
Definition wave_source_editor.h:26
virtual void valuesChanged(int start, int end, bool mouse_up)=0
Called when a portion of the waveform's values have changed.
virtual ~Listener()
Definition wave_source_editor.h:28
A graphical editor for manipulating a single-cycle waveform's sample values.
Definition wave_source_editor.h:20
void mouseUp(const MouseEvent &e) override
Handles a mouse up event to finalize editing and notify listeners.
Definition wave_source_editor.cpp:107
void flipHorizontal()
Flips the waveform horizontally, reversing its sample order.
Definition wave_source_editor.cpp:315
void resized() override
Adjusts layout and internal structures on component resize.
Definition wave_source_editor.cpp:66
void setGrid(int horizontal, int vertical)
Defines a grid overlay for snapping points.
Definition wave_source_editor.cpp:229
static constexpr int kNumCircles
Definition wave_source_editor.h:43
WaveSourceEditor(int size)
Constructs a WaveSourceEditor with a given waveform size.
Definition wave_source_editor.cpp:30
void loadWaveform(float *waveform)
Loads a complete waveform into the editor.
Definition wave_source_editor.cpp:217
void mouseMove(const MouseEvent &e) override
Handles a mouse move event to update the hover position.
Definition wave_source_editor.cpp:116
void clear()
Clears the entire waveform to zero.
Definition wave_source_editor.cpp:295
void fileDragEnter(const StringArray &files, int x, int y) override
Called when dragging audio files enters the component.
Definition wave_source_editor.cpp:287
void addListener(Listener *listener)
Adds a listener to be notified of value changes.
Definition wave_source_editor.h:177
virtual void init(OpenGlWrapper &open_gl) override
Initializes the OpenGL objects for drawing.
Definition wave_source_editor.h:86
float valueAt(int index)
Retrieves the waveform sample value at a given index.
Definition wave_source_editor.h:163
void mouseDrag(const MouseEvent &e) override
Handles a mouse drag event to continuously update waveform samples.
Definition wave_source_editor.cpp:121
void paintBackground(Graphics &g) override
Paints the background of the waveform editor.
Definition wave_source_editor.cpp:56
void setEditable(bool editable)
Enables or disables editing of the waveform.
Definition wave_source_editor.cpp:224
void fileDragExit(const StringArray &files) override
Called when dragging audio files leaves the component.
Definition wave_source_editor.cpp:291
virtual void destroy(OpenGlWrapper &open_gl) override
Cleans up the OpenGL resources used by the editor.
Definition wave_source_editor.h:114
virtual void render(OpenGlWrapper &open_gl, bool animate) override
Renders the waveform, grid lines, circles, and hover elements.
Definition wave_source_editor.h:100
void mouseExit(const MouseEvent &e) override
Handles a mouse exit event to clear the hover indication.
Definition wave_source_editor.cpp:132
virtual ~WaveSourceEditor()
Destructor.
Definition wave_source_editor.cpp:53
void flipVertical()
Flips the waveform vertically, inverting all sample values.
Definition wave_source_editor.cpp:305
void mouseDown(const MouseEvent &e) override
Handles a mouse down event to start editing or show the context menu.
Definition wave_source_editor.cpp:83
void audioFileLoaded(const File &file) override
Called when an audio file is dropped and loaded successfully.
Definition wave_source_editor.cpp:283
WaveSourceMenu
Context menu actions for waveform editing.
Definition wave_source_editor.h:49
@ kClear
Definition wave_source_editor.h:53
@ kFlipHorizontal
Definition wave_source_editor.h:51
@ kInitSaw
Definition wave_source_editor.h:54
@ kFlipVertical
Definition wave_source_editor.h:52
@ kCancel
Definition wave_source_editor.h:50
static constexpr int kMaxGridParts
Definition wave_source_editor.h:41
static constexpr int kMaxGrid
Maximum grid lines used by some overlays.
Definition wavetable_component_overlay.h:25
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174