Skip to content

Commit

Permalink
Handle AUv2 No UI case (#260)
Browse files Browse the repository at this point in the history
* Handle AUv2 No UI case

The AUV2 No UI case was still trying to construct a UI despite
_ext._gui being null. Add the appropirate defenisve guards
in three locations

Closes #257

* Clang format; rebase to next; check API as well as _gui
  • Loading branch information
baconpaul authored Jun 11, 2024
1 parent f4ee4ea commit dbe33d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/detail/auv2/build-helper/build-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ int main(int argc, char **argv)
else
{
fillOSS << "\n if (strcmp(_plugin->_plugin->desc->id,\"" << u.clapid << "\") == 0) {\n";
fillOSS << " if (!_plugin->_ext._gui) return false;\n";
fillOSS << " return fillAUCV_" << on << "(viewInfo);\n";
fillOSS << " }\n";
}
Expand Down
5 changes: 4 additions & 1 deletion src/wrapasauv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ OSStatus WrapAsAUV2::GetPropertyInfo(AudioUnitPropertyID inID, AudioUnitScope in
break;

case kAudioUnitProperty_CocoaUI:
if (!_plugin->_ext._gui) return kAudioUnitErr_InvalidProperty;
if (!_plugin->_ext._gui->is_api_supported(_plugin->_plugin, CLAP_WINDOW_API_COCOA, false))
return kAudioUnitErr_InvalidProperty;
outWritable = false;
outDataSize = sizeof(struct AudioUnitCocoaViewInfo);
return noErr;
Expand Down Expand Up @@ -676,7 +679,7 @@ OSStatus WrapAsAUV2::GetProperty(AudioUnitPropertyID inID, AudioUnitScope inScop
case kAudioUnitProperty_CocoaUI:
LOGINFO("[clap-wrapper] Property: kAudioUnitProperty_CocoaUI {}",
(_plugin) ? "plugin" : "no plugin");
if (_plugin &&
if (_plugin && _plugin->_ext._gui &&
(_plugin->_ext._gui->is_api_supported(_plugin->_plugin, CLAP_WINDOW_API_COCOA, false)))
{
fillAudioUnitCocoaView(((AudioUnitCocoaViewInfo*)outData), _plugin);
Expand Down

0 comments on commit dbe33d8

Please sign in to comment.