VST3: fetch midi mappings all at once, use it for note/sound-off
[carla.git] / source / modules / carla_juce / carla_juce.h
blob2870003ae43d4f6d37a3c167074901ff4fbadd83
1 /*
2 * Carla Plugin Host
3 * Copyright (C) 2011-2022 Filipe Coelho <falktx@falktx.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 #ifndef CARLA_JUCE_HPP_INCLUDED
19 #define CARLA_JUCE_HPP_INCLUDED
21 #include "AppConfig.h"
22 #include "CarlaDefines.h"
24 #ifdef USING_JUCE
25 # if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)
26 # define USE_STANDALONE_JUCE_APPLICATION
27 # else
28 # define USE_REFCOUNTER_JUCE_MESSAGE_MANAGER
29 # endif
30 #endif
32 #ifdef USE_STANDALONE_JUCE_APPLICATION
33 # include <functional>
34 #endif
36 namespace juce {
37 class MessageManager;
40 namespace CarlaJUCE {
42 void initialiseJuce_GUI();
43 void idleJuce_GUI();
44 void shutdownJuce_GUI();
45 const char* getVersion();
47 struct ScopedJuceInitialiser_GUI {
48 ScopedJuceInitialiser_GUI();
49 ~ScopedJuceInitialiser_GUI();
52 #ifdef USE_REFCOUNTER_JUCE_MESSAGE_MANAGER
53 struct ReferenceCountedJuceMessageMessager {
54 ReferenceCountedJuceMessageMessager();
55 ~ReferenceCountedJuceMessageMessager();
56 void incRef() const;
57 void decRef() const;
60 void setMessageManagerForThisThread();
61 void dispatchMessageManagerMessages();
62 #endif
64 #ifdef USE_STANDALONE_JUCE_APPLICATION
65 void setupAndUseMainApplication(std::function<void()> idleFn, volatile bool* closedSignalPtr);
66 #endif
68 } // namespace CarlaJUCE
70 #endif // CARLA_JUCE_HPP_INCLUDED