Skip to content

Commit

Permalink
Workarounds in case user loads the plugin on REAPER's mater track
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 committed Oct 16, 2023
1 parent 953dad7 commit 6e9736e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ HostSpecificExtensionsPlugin::HostSpecificExtensionsPlugin()
{
// we want to check that we can load/use the extensions in the plugin constructor.
// for REAPER our silly test is to try muting track 0.
using GetTrackFunc = MediaTrack *(*)(ReaProject *, int);
auto getTrackFunc =
reinterpret_cast<GetTrackFunc>(reaperPluginExtension->GetFunc("GetTrack"));
auto *track0 = getTrackFunc(nullptr, 0);
using GetMasterTrackFunc = MediaTrack *(*)(ReaProject *);
auto getMasterTrackFunc =
reinterpret_cast<GetMasterTrackFunc>(reaperPluginExtension->GetFunc("GetMasterTrack"));
auto *masterTrack = getMasterTrackFunc(nullptr);

using SetMuteFunc = int (*)(MediaTrack *track, int mute, int igngroupflags);
auto setMuteFunc =
reinterpret_cast<SetMuteFunc>(reaperPluginExtension->GetFunc("SetTrackUIMute"));
auto result = (*setMuteFunc)(track0, 1, 0);
auto result = (*setMuteFunc)(masterTrack, 1, 0);
jassert(result == 1);
}
}
Expand Down
2 changes: 2 additions & 0 deletions examples/HostSpecificExtensionsPlugin/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ PluginEditor::PluginEditor(HostSpecificExtensionsPlugin &plug)
using GetTrackFunc = MediaTrack *(*)(ReaProject *, int);
auto getTrackFunc = reinterpret_cast<GetTrackFunc>(reaperExt->GetFunc("GetTrack"));
auto *track0 = getTrackFunc(nullptr, 0);
if (track0 == nullptr)
return;

using ColorToNativeFunc = int (*)(int r, int g, int b);
auto colorToNativeFunc =
Expand Down

0 comments on commit 6e9736e

Please sign in to comment.