============================================================================== */
| 29 | /* |
| 30 | */ |
| 31 | class ArcSpectrogram : public juce::AnimatedAppComponent, juce::Thread { |
| 32 | public: |
| 33 | ArcSpectrogram(Parameters& parameters); |
| 34 | ~ArcSpectrogram() override; |
| 35 | |
| 36 | void update() override {} |
| 37 | void paint(juce::Graphics &) override; |
| 38 | void resized() override; |
| 39 | |
| 40 | void mouseMove(const juce::MouseEvent& evt) override; |
| 41 | void mouseExit(const juce::MouseEvent&) override; |
| 42 | |
| 43 | void reset(); |
| 44 | bool shouldLoadImage(ParamUI::SpecType type) { return !mIsProcessing && !mImagesComplete[type]; } |
| 45 | void loadSpecBuffer(Utils::SpecBuffer *buffer, ParamUI::SpecType type); |
| 46 | void loadWaveformBuffer(juce::AudioBuffer<float> *audioBuffer); // Raw audio samples from file |
| 47 | void loadPreset(); |
| 48 | void setMidiNotes(const juce::Array<Utils::MidiNote> &midiNotes); |
| 49 | void setSpecType(ParamUI::SpecType type) { mSpecType.setSelectedId(type + 1, juce::sendNotificationSync); } |
| 50 | |
| 51 | //============================================================================ |
| 52 | void run() override; |
| 53 | |
| 54 | private: |
| 55 | static constexpr auto BUFFER_PROCESS_TIMEOUT = 10000; |
| 56 | static constexpr auto REFRESH_RATE_FPS = 30; |
| 57 | |
| 58 | // UI variables |
| 59 | static constexpr auto SPEC_TYPE_HEIGHT = 30; |
| 60 | static constexpr auto SPEC_TYPE_WIDTH = 100; |
| 61 | static constexpr auto CANDIDATE_BUBBLE_SIZE = 14; |
| 62 | static constexpr auto NUM_COLS = 600; |
| 63 | // Colours |
| 64 | static constexpr auto COLOUR_MULTIPLIER = 20.0f; |
| 65 | |
| 66 | typedef struct ArcGrain { |
| 67 | ParamGenerator *paramGenerator; |
| 68 | float gain; |
| 69 | Utils::PitchClass pitchClass; |
| 70 | ArcGrain(ParamGenerator *paramGenerator_, float gain_, Utils::PitchClass pitchClass_) |
| 71 | : paramGenerator(paramGenerator_), gain(gain_), pitchClass(pitchClass_) {} |
| 72 | } ArcGrain; |
| 73 | |
| 74 | enum CloudType { WAIT, SINGING, TOUCH, COUNT }; |
| 75 | |
| 76 | typedef struct Cloud { |
| 77 | std::array<juce::Image, CloudType::COUNT> images; |
| 78 | CloudType type = CloudType::WAIT; |
| 79 | juce::Rectangle<float> rect; |
| 80 | juce::Image& getImage() { return images[type]; } |
| 81 | } Cloud; |
| 82 | |
| 83 | // Parameters |
| 84 | // Use to save state since if the plugin is closed and open, will need these |
| 85 | // to restore the state |
| 86 | Parameters& mParameters; |
| 87 | |
| 88 | // Bookkeeping |
nothing calls this directly
no outgoing calls
no test coverage detected