Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
CLAPPluginFormat.h
1// SPDX-FileCopyrightText: © 2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <juce_wrapper.h>
7
8namespace zrythm::plugins
9{
10
11class CLAPPluginFormat final : public juce::AudioPluginFormat
12{
13public:
14 CLAPPluginFormat () = default;
15 ~CLAPPluginFormat () override;
16
21 static auto get_hash_for_range (auto &&range) -> int
22 {
23 return static_cast<int> (std::ranges::fold_left (
24 range, uint32_t{ 0 }, [] (uint32_t acc, auto &&item) {
25 return (acc * 31) + static_cast<uint32_t> (item);
26 }));
27 };
28
29 static juce::String getFormatName () { return "CLAP"; }
30 juce::String getName () const override { return getFormatName (); }
31 bool canScanForPlugins () const override { return true; }
32 bool isTrivialToScan () const override { return false; }
33
34 void findAllTypesForFile (
35 juce::OwnedArray<juce::PluginDescription> &,
36 const juce::String &fileOrIdentifier) override;
37 bool
38 fileMightContainThisPluginType (const juce::String &fileOrIdentifier) override;
39 juce::String
40 getNameOfPluginFromIdentifier (const juce::String &fileOrIdentifier) override;
41 bool pluginNeedsRescanning (const juce::PluginDescription &) override;
42 juce::StringArray
43 searchPathsForPlugins (const juce::FileSearchPath &, bool recursive, bool)
44 override;
45 bool doesPluginStillExist (const juce::PluginDescription &) override;
46 juce::FileSearchPath getDefaultLocationsToSearch () override;
47
48private:
49 void createPluginInstance (
50 const juce::PluginDescription &desc,
51 double initialSampleRate,
52 int initialBufferSize,
53 PluginCreationCallback) override;
54 bool requiresUnblockedMessageThreadDuringCreation (
55 const juce::PluginDescription &desc) const override;
56 void recursiveFileSearch (
57 juce::StringArray &results,
58 const juce::File &directory,
59 bool recursive);
60
61 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CLAPPluginFormat)
62};
63}
static auto get_hash_for_range(auto &&range) -> int
Used for hashing CLAP IDs.