#pragma once /* ============================================================================== Copyright 2022 Nicolas Chambert This program is free software : you can redistribute itand /or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.If not, see < http://www.gnu.org/licenses/>. ============================================================================== */ #include #include "MesurePanel.h" #include "BPMPanel.h" #include "TempoPanel.h" #include "PlayPanel.h" #include "OptionsPanel.h" #include "Metronome.h" //============================================================================== /* This component lives inside our window, and this is where you should put all your controls and content. */ class MainComponent : private juce::Timer, public juce::AudioAppComponent { public: //============================================================================== MainComponent(Config& conf); ~MainComponent(); //============================================================================== void prepareToPlay (int , double sampleRate) override; void getNextAudioBlock (const juce::AudioSourceChannelInfo& bufferToFill) override; void releaseResources() override; //============================================================================== void paint (juce::Graphics& g) override; void resized() override; void saveConfig(); private: MesurePanel measures; BPMPanel bpm; PlayPanel playButton; TempoPanel tempo; OptionsPanel options; Metronome metronome; // conserve la dernière mesure pour déclencher le highlight en cas de changement int lastcur; // Utilisation d'un timer pour relire les signaux du metronome // timer de 20ms, largement suffisant pour un retour graphique sans surcharger le processeur (~50fps) void timerCallback() override; // permet de faire clignoter le bouton play sur le temps void highlight(); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainComponent) };