Skip to content

Commit

Permalink
Setting up dedicated example plugin for host-specific extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 committed Oct 15, 2023
1 parent 782963a commit b0b5f7b
Show file tree
Hide file tree
Showing 9 changed files with 260 additions and 1,488 deletions.
1 change: 1 addition & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ endif()

add_subdirectory(GainPlugin)
add_subdirectory(NoteNamesPlugin)
add_subdirectory(HostSpecificExtensionsPlugin)
17 changes: 0 additions & 17 deletions examples/GainPlugin/GainPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,6 @@ GainPlugin::GainPlugin()
vts(*this, nullptr, juce::Identifier("Parameters"), createParameters())
{
gainDBParameter = dynamic_cast<ModulatableFloatParameter *>(vts.getParameter(gainParamTag));

reaperPluginExtension =
static_cast<const reaper_plugin_info_t *>(getExtension("cockos.reaper_extension"));
jassert(reaperPluginExtension != nullptr || !juce::PluginHostType{}.isReaper());

if (reaperPluginExtension != nullptr)
{
MediaTrack *(*getTrackFunc)(ReaProject *, int);
*((void **)&getTrackFunc) = reaperPluginExtension->GetFunc("GetTrack");
auto *track0 = (*getTrackFunc)(nullptr, 0);

int (*setMuteFunc)(MediaTrack *track, int mute, int igngroupflags);
*((void **)&setMuteFunc) = reaperPluginExtension->GetFunc("SetTrackUIMute");
auto result = (*setMuteFunc)(track0, 1, 0);
jassert (result == 1);
}

}

juce::AudioProcessorValueTreeState::ParameterLayout GainPlugin::createParameters()
Expand Down
10 changes: 0 additions & 10 deletions examples/GainPlugin/GainPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
#include <juce_dsp/juce_dsp.h>
#include "ModulatableFloatParameter.h"

JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE("-Wc++98-compat-extra-semi",
"-Wgnu-anonymous-struct",
"-Wzero-as-null-pointer-constant",
"-Wextra-semi",
"-Wunused-parameter")
#include "reaper_plugin.h"
JUCE_END_IGNORE_WARNINGS_GCC_LIKE

class ModulatableFloatParameter;
class GainPlugin : public juce::AudioProcessor,
public clap_juce_extensions::clap_juce_audio_processor_capabilities,
Expand Down Expand Up @@ -50,8 +42,6 @@ class GainPlugin : public juce::AudioProcessor,
auto *getGainParameter() { return gainDBParameter; }
auto &getValueTreeState() { return vts; }

const reaper_plugin_info_t* reaperPluginExtension = nullptr;

private:
ModulatableFloatParameter *gainDBParameter = nullptr;

Expand Down
Loading

0 comments on commit b0b5f7b

Please sign in to comment.