Skip to content

Commit

Permalink
Handle AUv2 No UI case
Browse files Browse the repository at this point in the history
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
  • Loading branch information
baconpaul committed Jun 10, 2024
1 parent eb8b190 commit f73d56e
Show file tree
Hide file tree
Showing 2 changed files with 4 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
4 changes: 3 additions & 1 deletion src/wrapasauv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,8 @@ OSStatus WrapAsAUV2::GetPropertyInfo(AudioUnitPropertyID inID, AudioUnitScope in
break;

case kAudioUnitProperty_CocoaUI:
if (!_plugin->_ext._gui)
return kAudioUnitErr_InvalidProperty;
outWritable = false;
outDataSize = sizeof(struct AudioUnitCocoaViewInfo);
return noErr;
Expand Down Expand Up @@ -676,7 +678,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 f73d56e

Please sign in to comment.