DawWatcher.h (2535B)
1 /*---------------------------------------------------------------------------------------- 2 3 Copyright (c) 2023 AUDIOKINETIC Inc. 4 5 This file is licensed to use under the license available at: 6 https://github.com/audiokinetic/ReaWwise/blob/main/License.txt (the "License"). 7 You may not use this file except in compliance with the License. 8 9 Unless required by applicable law or agreed to in writing, software distributed 10 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 specific language governing permissions and limitations under the License. 13 14 ----------------------------------------------------------------------------------------*/ 15 16 #pragma once 17 18 #include "Core/DawContext.h" 19 #include "WaapiClient.h" 20 21 #include <juce_gui_basics/juce_gui_basics.h> 22 23 namespace AK::WwiseTransfer 24 { 25 class DawWatcher 26 : private juce::Timer 27 , public juce::AsyncUpdater 28 , private juce::ValueTree::Listener 29 { 30 public: 31 DawWatcher(juce::ValueTree appState, WaapiClient& waapiClient, DawContext& dawContext, int refreshInterval); 32 ~DawWatcher(); 33 34 void start(); 35 void stop(); 36 37 private: 38 juce::ValueTree applicationState; 39 juce::ValueTree hierarchyMapping; 40 juce::ValueTree previewItems; 41 42 juce::CachedValue<juce::String> importDestination; 43 juce::CachedValue<juce::String> originalsSubfolder; 44 juce::CachedValue<Import::ContainerNameExistsOption> containerNameExists; 45 juce::CachedValue<bool> previewLoading; 46 juce::CachedValue<juce::String> sessionName; 47 juce::CachedValue<bool> waqlEnabled; 48 juce::CachedValue<juce::String> projectPath; 49 juce::CachedValue<juce::String> originalsFolder; 50 juce::CachedValue<juce::String> languageSubfolder; 51 juce::CachedValue<bool> waapiConnected; 52 53 DawContext& dawContext; 54 WaapiClient& waapiClient; 55 56 unsigned int lastImportItemsHash; 57 int refreshInterval; 58 bool previewOptionsChanged; 59 60 void timerCallback() override; 61 void valueTreePropertyChanged(juce::ValueTree& treeWhosePropertyHasChanged, const juce::Identifier& property) override; 62 void valueTreeChildAdded(juce::ValueTree& parentTree, juce::ValueTree& childWhichHasBeenAdded) override; 63 void valueTreeChildRemoved(juce::ValueTree& parentTree, juce::ValueTree& childWhichHasBeenRemoved, int indexFromWhichChildWasRemoved) override; 64 void valueTreeChildOrderChanged(juce::ValueTree& parentTreeWhoseChildrenHaveMoved, int oldIndex, int newIndex) override; 65 void handleAsyncUpdate() override; 66 }; 67 } // namespace AK::WwiseTransfer