Skip to content

Revamp audio plugins module#33535

Open
luapmartin wants to merge 5 commits into
musescore:mainfrom
luapmartin:luapmartin/revamp-audio_plugins-module
Open

Revamp audio plugins module#33535
luapmartin wants to merge 5 commits into
musescore:mainfrom
luapmartin:luapmartin/revamp-audio_plugins-module

Conversation

@luapmartin
Copy link
Copy Markdown
Contributor

Framework PR: musescore/muse_framework#47
Audacity PR: audacity/audacity#10989

Adapt MuseScore to the revamped muse::audioplugins framework.

  • Adapted MuseScore to the moved framework types and AudioResourceType now being an opaque wire string.

  • New app-side AudioPluginsAppConfigModule registers the v2→v3 known_audio_plugins.json migration — lifts the legacy hasNativeEditorSupport boolean into meta.attributes. (The framework auto-registers v0→v1 and v1→v2.)

  • Replaced direct AudioResourceType enum comparisons with the audio::isResourceType() / typed helpers across playback, project, and notation-scene.

  • hasNativeEditorSupport is no longer a struct field — it lives in meta.attributes. projectaudiosettings drops it from the saved JSON and migrates the legacy field on load, so existing project files still open.

  • CATEGORIES_ATTRIBUTE moved to the vst namespace (it is VST-specific).

  • Bumps the muse submodule to the shared framework branch.

  • I signed the CLA

  • The title of the PR describes the problem it addresses

  • Each commit's message describes its purpose and effects, and references the issue it resolves

  • If changes are extensive, there is a sequence of easily reviewable commits

  • The code in the PR follows the coding rules

  • There are no unnecessary changes

  • The code compiles and runs on my machine, preferably after each commit individually

  • I created a unit test or vtest to verify the changes I made (if applicable)

igorkorsukov and others added 4 commits May 21, 2026 16:53
Companion to the muse_framework audioplugins revamp:

- New AudioPluginsAppConfigModule wires v0->v1 (hasNativeEditorSupport
  into attributes) and v1->v2 (enabled boolean -> state string) cache
  migrations plus the runtime attribute defaults.
- Adopts the new typed plugin format helpers (audio::isResourceType,
  audio::resourceTypeFromString, audio::hasNativeEditorSupport) at
  call sites in playback, project, notationscene, converter.
- Consumes vst::CATEGORIES_ATTRIBUTE (moved out of the audio module).
Replaces the remaining literal-string plugin-type comparisons (e.g. meta.type == "MuseSamplerSoundPack") with audio::isResourceType(meta, AudioResourceType::X). Single source of truth for the wire strings now lives in the framework enum's bridge, plus a unit test pinning them. Bumps muse/ to pick up the framework changes.
KnownAudioPluginsMigrationRegister's constructor now pre-registers the
framework-owned migrations so apps don't have to copy-paste them:

  v0 -> v1: structural (envelope intro, no-op callback)
  v1 -> v2: enabled boolean -> state string (AudioPluginState is a
            framework enum, so this transformation belongs here)

Apps register only their own field migrations on top. Bumps
CURRENT_KNOWN_AUDIO_PLUGINS_VERSION 2 -> 3 since the MuseScore-specific
hasNativeEditorSupport migration moves to v2 -> v3 (app-owned).
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 087b74fe-f819-4662-b61c-4045bcbc01c9

📥 Commits

Reviewing files that changed from the base of the PR and between ebccb36 and d75af1c.

📒 Files selected for processing (2)
  • src/app/internal/audiopluginsappconfigmodule.cpp
  • src/project/internal/projectaudiosettings.cpp

📝 Walkthrough

Walkthrough

Adds a new AudioPluginsAppConfigModule (implementation, header, build inclusion) and registers it in app initialization. The module sets runtime default audio-resource attributes and registers a v2→v3 migration that moves legacy top-level hasNativeEditorSupport into attributes. The changebase replaces direct resource-type and attribute accesses with helper APIs (isResourceType, resourceTypeFromString, intAttribute, hasNativeEditorSupport), updates VST attribute keys, and makes ProjectAudioSettings use audioplugins::AudioResourceType and corresponding JSON import/export adjustments.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Revamp audio plugins module' clearly and concisely summarizes the main objective of the PR—overhauling the audio plugins module framework integration.
Description check ✅ Passed The description comprehensively covers the PR's purpose, key changes, and implementation details, and all required checklist items are marked as completed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/app/internal/audiopluginsappconfigmodule.cpp (2)

71-77: 💤 Low value

Minor: migration overwrites any pre-existing hasNativeEditorSupport in attributes.

If a v2 record already has the key in meta.attributes (e.g., from manual editing or partial migration), this code unconditionally replaces it with the legacy top-level value. Probably acceptable since legacy v2 data shouldn't have populated this attribute, but consider guarding with if (!attrs.contains("hasNativeEditorSupport")) to be defensive.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/internal/audiopluginsappconfigmodule.cpp` around lines 71 - 77, The
migration unconditionally overwrites meta.attributes["hasNativeEditorSupport"];
modify the block that reads meta and sets attrs (variables meta and attrs, and
the bool b derived from meta.value("hasNativeEditorSupport")) to only set
attrs.set("hasNativeEditorSupport", ...) when attrs does not already contain
that key (i.e., wrap the attrs.set call in if
(!attrs.contains("hasNativeEditorSupport")) so existing v2 attributes are
preserved), then write attrs back to meta as before.

65-92: ⚡ Quick win

Use audio::HAS_NATIVE_EDITOR_SUPPORT_ATTRIBUTE for the JSON key in the v2→v3 migration

src/app/internal/audiopluginsappconfigmodule.cpp writes the attribute under the literal "hasNativeEditorSupport", while src/project/internal/projectaudiosettings.cpp reads/migrates it using audio::HAS_NATIVE_EDITOR_SUPPORT_ATTRIBUTE. Replace the hard-coded occurrences in the migration with the shared constant (using the appropriate conversion/type for muse::JsonObject keys) to prevent silent drift.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/internal/audiopluginsappconfigmodule.cpp` around lines 65 - 92, The
migration lambda registered via migrations->registerMigration (v2→v3) currently
uses the hard-coded key "hasNativeEditorSupport"; change all occurrences to use
the shared constant audio::HAS_NATIVE_EDITOR_SUPPORT_ATTRIBUTE (convert it to
the appropriate std::string type if necessary) when calling meta.contains(...),
meta.value(...).toBool(), attrs.set(...), and when filtering keys into
metaWithoutLegacy so the legacy key is removed by comparing against that
constant rather than the literal.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/app/internal/audiopluginsappconfigmodule.cpp`:
- Around line 71-77: The migration unconditionally overwrites
meta.attributes["hasNativeEditorSupport"]; modify the block that reads meta and
sets attrs (variables meta and attrs, and the bool b derived from
meta.value("hasNativeEditorSupport")) to only set
attrs.set("hasNativeEditorSupport", ...) when attrs does not already contain
that key (i.e., wrap the attrs.set call in if
(!attrs.contains("hasNativeEditorSupport")) so existing v2 attributes are
preserved), then write attrs back to meta as before.
- Around line 65-92: The migration lambda registered via
migrations->registerMigration (v2→v3) currently uses the hard-coded key
"hasNativeEditorSupport"; change all occurrences to use the shared constant
audio::HAS_NATIVE_EDITOR_SUPPORT_ATTRIBUTE (convert it to the appropriate
std::string type if necessary) when calling meta.contains(...),
meta.value(...).toBool(), attrs.set(...), and when filtering keys into
metaWithoutLegacy so the legacy key is removed by comparing against that
constant rather than the literal.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8146db70-bf03-4abb-ba77-be7a898068bc

📥 Commits

Reviewing files that changed from the base of the PR and between 526b45f and ebccb36.

📒 Files selected for processing (14)
  • muse
  • src/app/CMakeLists.txt
  • src/app/appfactory.cpp
  • src/app/internal/audiopluginsappconfigmodule.cpp
  • src/app/internal/audiopluginsappconfigmodule.h
  • src/converter/internal/compat/notationmeta.cpp
  • src/notationscene/qml/MuseScore/NotationScene/percussionpanel/percussionpanelmodel.cpp
  • src/playback/internal/drumsetloader.cpp
  • src/playback/internal/playbackcontroller.cpp
  • src/playback/internal/soundprofilesrepository.cpp
  • src/playback/qml/MuseScore/Playback/inputresourceitem.cpp
  • src/playback/qml/MuseScore/Playback/outputresourceitem.cpp
  • src/project/internal/projectaudiosettings.cpp
  • src/project/internal/projectaudiosettings.h

Replace the hard-coded "hasNativeEditorSupport" string literal in the
audio-plugin cache migration and the project-file migration with the
shared muse::audio constant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants