Vital
Loading...
Searching...
No Matches
synth_editor.h
Go to the documentation of this file.
1#pragma once
2
3#include "JuceHeader.h"
4
5#include "synth_base.h"
7
10
19class SynthEditor : public AudioAppComponent,
20 public SynthBase,
21 public SynthGuiInterface,
22 public Timer {
23public:
29 SynthEditor(bool use_gui = true);
30
35
44 void prepareToPlay(int buffer_size, double sample_rate) override;
45
51 void getNextAudioBlock(const AudioSourceChannelInfo& buffer) override;
52
56 void releaseResources() override;
57
63 void paint(Graphics& g) override { }
64
68 void resized() override;
69
75 const CriticalSection& getCriticalSection() override { return critical_section_; }
76
82 void pauseProcessing(bool pause) override {
83 if (pause)
84 critical_section_.enter();
85 else
86 critical_section_.exit();
87 }
88
94 SynthGuiInterface* getGuiInterface() override { return this; }
95
101 AudioDeviceManager* getAudioDeviceManager() override { return &deviceManager; }
102
106 void timerCallback() override;
107
113 void animate(bool animate);
114
115private:
119 std::unique_ptr<SynthComputerKeyboard> computer_keyboard_;
120
124 CriticalSection critical_section_;
125
129 StringArray current_midi_ins_;
130
134 double current_time_;
135
136 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SynthEditor)
137};
A base class providing foundational functionality for the Vital synthesizer’s engine,...
Definition synth_base.h:42
Provides a computer-keyboard-based MIDI input mechanism for the Vital standalone application.
Definition synth_computer_keyboard.h:21
The main editor component for the SynthPlugin audio processor.
Definition synth_editor.h:24
SynthGuiInterface * getGuiInterface() override
Returns a pointer to the GUI interface of this synth.
Definition synth_editor.h:94
void paint(Graphics &g) override
Called to repaint any custom graphics, which are not currently used here.
Definition synth_editor.h:63
void resized() override
Called when the component is resized. Resizes internal GUI components if present.
void pauseProcessing(bool pause) override
Pauses or resumes audio processing by locking or unlocking the critical section.
Definition synth_editor.h:82
void prepareToPlay(int buffer_size, double sample_rate) override
Prepares the audio engine to begin playing.
Definition synth_editor.cpp:104
AudioDeviceManager * getAudioDeviceManager() override
Returns a pointer to the AudioDeviceManager for this standalone app.
Definition synth_editor.h:101
void getNextAudioBlock(const AudioSourceChannelInfo &buffer) override
Callback for the audio device. Processes incoming audio and MIDI.
Definition synth_editor.cpp:118
void timerCallback() override
Timer callback used to periodically scan for new MIDI devices.
Definition synth_editor.cpp:166
const CriticalSection & getCriticalSection() override
Returns the critical section used for thread-safe operations.
Definition synth_editor.h:75
SynthEditor(SynthPlugin &synth)
Constructs the SynthEditor.
Definition synth_editor.cpp:13
void releaseResources() override
Releases resources allocated for audio playback.
Definition synth_editor.cpp:148
~SynthEditor()
Destructor. Cleans up resources, shutting down audio and dismissing menus.
Definition synth_editor.cpp:90
void animate(bool animate)
Enables or disables animation in the GUI (e.g., for meters or visualizations).
Definition synth_editor.cpp:184
An interface class linking the Vital synthesizer backend (SynthBase) with a GUI.
Definition synth_gui_interface.h:56