Skip to content

Conversation

@swesterfeld
Copy link
Collaborator

Fixes #69.

It turned out that the reason CLAP support is currently unreliable is not in the CLAP code itself, but caused by the fact that the CLAP device never gets activated, and thus ignores midi events if you follow the steps to reproduce the problem (described in #69).

@tim-janik
Copy link
Owner

@greptile

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Greptile Summary

This PR fixes a critical issue with CLAP plugin support by ensuring newly created tracks are properly activated when the project is already active. The change adds a simple conditional activation call (track->_activate()) immediately after creating a new track in ProjectImpl::create_track(). This addresses issue #69 where CLAP devices on newly created tracks would ignore MIDI events because they were never activated, making CLAP support appear unreliable.

The fix follows the existing activation pattern found in the project's _activate() method, which activates all tracks when the project becomes active. However, there was previously no corresponding logic to activate individual tracks created after the project was already active. This change ensures consistency in the activation lifecycle by mirroring the project-level activation behavior at the track creation level.

Important Files Changed

Changed Files
Filename Score Overview
ase/project.cc 5/5 Adds conditional track activation for new tracks when project is active

Confidence score: 5/5

  • This PR is extremely safe to merge with minimal risk of causing production issues
  • Score reflects a simple, well-targeted fix that follows existing code patterns and directly addresses a specific bug without introducing complex logic changes
  • No files require special attention as the change is minimal and follows established activation patterns in the codebase

Sequence Diagram

sequenceDiagram
    participant User
    participant ProjectImpl
    participant TrackImpl
    participant Engine

    User->>ProjectImpl: "create_track()"
    ProjectImpl->>TrackImpl: "TrackImpl::make_shared(*this, !havemaster)"
    ProjectImpl->>ProjectImpl: "tracks_.insert(track)"
    ProjectImpl->>ProjectImpl: "emit_event('track', 'insert')"
    ProjectImpl->>TrackImpl: "_set_parent(this)"
    
    alt Project is active
        ProjectImpl->>ProjectImpl: "is_active()"
        ProjectImpl->>TrackImpl: "_activate()"
    end
    
    ProjectImpl->>ProjectImpl: "emit_notify('all_tracks')"
    ProjectImpl-->>User: "return track"
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

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.

CLAP support is unreliable

2 participants