Skip to content

Commit

Permalink
fixup! Add support for CLAP (Clever Audio PLugin API)
Browse files Browse the repository at this point in the history
  • Loading branch information
olilarkin committed May 15, 2024
1 parent bd3c3e0 commit 3559df9
Showing 1 changed file with 48 additions and 17 deletions.
65 changes: 48 additions & 17 deletions IPlug/CLAP/IPlugCLAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ void IPlugCLAP::guiDestroy() noexcept

bool IPlugCLAP::guiShow() noexcept
{
if (!mGUIOpen)
if (HasUI() && !mGUIOpen)
{
OpenWindow(mWindow);
return true;
Expand All @@ -889,19 +889,33 @@ bool IPlugCLAP::guiShow() noexcept

bool IPlugCLAP::guiHide() noexcept
{
guiDestroy();
return true;
if (HasUI())
{
guiDestroy();
return true;
}
else
{
return false;
}
}

bool IPlugCLAP::guiCanResize() const noexcept
{
return GetHostResizeEnabled();
return HasUI() && GetHostResizeEnabled();
}

bool IPlugCLAP::guiSetScale(double scale) noexcept
{
SetScreenScale(static_cast<float>(scale));
return true;
if (HasUI())
{
SetScreenScale(static_cast<float>(scale));
return true;
}
else
{
return false;
}
}

bool IPlugCLAP::guiGetSize(uint32_t* pWidth, uint32_t* pHeight) noexcept
Expand All @@ -915,17 +929,26 @@ bool IPlugCLAP::guiGetSize(uint32_t* pWidth, uint32_t* pHeight) noexcept

return true;
}

return false;
else
{
return false;
}
}

// clap_plugin_gui_cocoa
bool IPlugCLAP::GUIWindowAttach(void* pWindow) noexcept
{
OpenWindow(pWindow);
mWindow = pWindow;
mGUIOpen = true;
return true;
if (HasUI())
{
OpenWindow(pWindow);
mWindow = pWindow;
mGUIOpen = true;
return true;
}
else
{
return false;
}
}

bool IPlugCLAP::guiAdjustSize(uint32_t* pWidth, uint32_t* pHeight) noexcept
Expand All @@ -942,17 +965,25 @@ bool IPlugCLAP::guiAdjustSize(uint32_t* pWidth, uint32_t* pHeight) noexcept

return true;
}

return false;
else
{
return false;
}
}

bool IPlugCLAP::guiSetSize(uint32_t width, uint32_t height) noexcept
{
Trace(TRACELOC, "width:%i height:%i\n", width, height);

OnParentWindowResize(width, height);

return true;
if (HasUI())
{
OnParentWindowResize(width, height);
return true;
}
else
{
return false;
}
}

// TODO - wildcards (return as -1 chans...)
Expand Down

0 comments on commit 3559df9

Please sign in to comment.