Revamp audio plugins module#33535
Conversation
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).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds 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)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/app/internal/audiopluginsappconfigmodule.cpp (2)
71-77: 💤 Low valueMinor: migration overwrites any pre-existing
hasNativeEditorSupportinattributes.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 withif (!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 winUse
audio::HAS_NATIVE_EDITOR_SUPPORT_ATTRIBUTEfor the JSON key in the v2→v3 migration
src/app/internal/audiopluginsappconfigmodule.cppwrites the attribute under the literal"hasNativeEditorSupport", whilesrc/project/internal/projectaudiosettings.cppreads/migrates it usingaudio::HAS_NATIVE_EDITOR_SUPPORT_ATTRIBUTE. Replace the hard-coded occurrences in the migration with the shared constant (using the appropriate conversion/type formuse::JsonObjectkeys) 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
📒 Files selected for processing (14)
musesrc/app/CMakeLists.txtsrc/app/appfactory.cppsrc/app/internal/audiopluginsappconfigmodule.cppsrc/app/internal/audiopluginsappconfigmodule.hsrc/converter/internal/compat/notationmeta.cppsrc/notationscene/qml/MuseScore/NotationScene/percussionpanel/percussionpanelmodel.cppsrc/playback/internal/drumsetloader.cppsrc/playback/internal/playbackcontroller.cppsrc/playback/internal/soundprofilesrepository.cppsrc/playback/qml/MuseScore/Playback/inputresourceitem.cppsrc/playback/qml/MuseScore/Playback/outputresourceitem.cppsrc/project/internal/projectaudiosettings.cppsrc/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.
Framework PR: musescore/muse_framework#47
Audacity PR: audacity/audacity#10989
Adapt MuseScore to the revamped
muse::audiopluginsframework.Adapted MuseScore to the moved framework types and
AudioResourceTypenow being an opaque wire string.New app-side
AudioPluginsAppConfigModuleregisters the v2→v3known_audio_plugins.jsonmigration — lifts the legacyhasNativeEditorSupportboolean intometa.attributes. (The framework auto-registers v0→v1 and v1→v2.)Replaced direct
AudioResourceTypeenum comparisons with theaudio::isResourceType()/ typed helpers across playback, project, and notation-scene.hasNativeEditorSupportis no longer a struct field — it lives inmeta.attributes.projectaudiosettingsdrops it from the saved JSON and migrates the legacy field on load, so existing project files still open.CATEGORIES_ATTRIBUTEmoved to thevstnamespace (it is VST-specific).Bumps the
musesubmodule 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)