Repository navigation
9769 spectrogram painting - #9948
Conversation
1ccd96d to
f105fda
Compare
|
Stereo tracks channel height ratio change should also reflect on the spectrogram on multiview. |
There was a problem hiding this comment.
Pull request overview
This PR implements spectrogram painting functionality for Audacity, allowing spectrograms to be rendered dynamically based on track settings. The implementation includes a preview/apply mechanism with automatic revert-on-cancel functionality.
Key Changes
- Added spectrogram painter infrastructure with AU3 integration to render spectrogram visuals
- Implemented settings management with preview, apply, and automatic revert functionality using snapshot pattern
- Refactored UI components to support both waveform and spectrogram views through a common abstract base class
Reviewed changes
Copilot reviewed 66 out of 66 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/trackedit/view/trackspectrogramsettingsmodel.* | Adds preview/apply logic and destructor-based revert using configuration snapshots |
| src/trackedit/internal/trackspectrogramsettingsupdater.* | Manages global settings propagation to tracks using global settings |
| src/trackedit/internal/snapshotspectrogramconfiguration.h | Immutable snapshot class for storing/reverting spectrogram settings |
| src/spectrogram/ispectrogrampainter.h | Defines painter interface for rendering spectrograms |
| src/spectrogram/internal/au3/au3spectrogrampainter.* | Implements spectrogram painting using AU3 backend |
| src/spectrogram/internal/au3/au3spectrogramclipchannelpainter.* | Handles per-channel spectrogram rendering with caching |
| src/spectrogram/internal/spectrogramutils.* | Utility functions for time/position conversion and pixel alignment |
| src/spectrogram/internal/spectrogramcolors.* | Pre-computed color gradients for spectrogram visualization |
| src/projectscene/view/tracksitemsview/abstractclipview.* | New base class extracting common clip view properties and behavior |
| src/projectscene/view/tracksitemsview/spectrogramview.* | Spectrogram-specific view implementation with viewport observation |
| src/projectscene/view/tracksitemsview/waveview.* | Refactored to inherit from AbstractClipView |
| src/appshell/internal/appshellconfiguration.* | Adds notification for settings apply events |
| au3/libraries/lib-wave-track-settings/SpectrogramSettings.cpp | Updates window caching logic for spectrogram algorithms |
| CMakeLists.txt files | Adds new source files to build system |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
785f72b to
dd61129
Compare
dd61129 to
ccabb60
Compare
| // First time assignment of global variable identifying a colour | ||
| iIndex = index; | ||
| mColourNames.push_back(Name); | ||
| wxASSERT(allNames.insert(Name).second); |
There was a problem hiding this comment.
Remove asserts from wxWidgets?
There was a problem hiding this comment.
Yeah, it's possible. I'll push a commit where all wx references are removed from the spectrogram module.
|
|
||
| #include <QColor> | ||
|
|
||
| #include <wx/arrstr.h> |
There was a problem hiding this comment.
More wxWidgets dependencies. Is it too much work to remove these dependencies?
There was a problem hiding this comment.
| // RegisterImage( myFlags, bmpRecordButton, some image, wxT("RecordButton")); | ||
| int myFlags = resFlagPaired; | ||
| NameSet allNames; | ||
| #define SPECTROGRAM_COLORS_INITS |
There was a problem hiding this comment.
This seems like a code smell to me but I know this is a legacy code and you are not suppose to improve all of it.
There was a problem hiding this comment.
It's an unusual system all right, but trying to rewrite is isn't necessary now (and maybe ever).
| @@ -213,13 +213,19 @@ void AppShellConfiguration::startEditSettings() | |||
| void AppShellConfiguration::applySettings() | |||
| { | |||
| settings()->commitTransaction(); | |||
| m_settingsApplied.notify(); | |||
There was a problem hiding this comment.
Do we need to be notified if any settings have been applied?
Can we make it more granular, listening only to specific settings like?
muse::settings()->valueChanged(SETTING_I_CARE_ABOUT).onReceive...
There was a problem hiding this comment.
That solution you propose fires when a setting is changed in the dialog, on the fly. Here there's a new use case (new AFAICS): only react to settings changes when they get confirmed by the "Apply" button.
Note: this change should go away with the optimization follow-up PR: then spectrogram recalculation and repaint should become fast enough that changes can be reflected on the fly.
| visibleT0 = std::max(hiddenDurationLeft, .0); | ||
| const auto visibleT1 = std::max(std::min(tpost, clipLength - blank), 0.0); | ||
|
|
||
| // Make sure visibleT1 is greater than visibleT0 |
There was a problem hiding this comment.
I am not a fan of this type of comment. It is just translating code to English, which I could easily deduce by just reading the code.
Apart from that visibleT0 is a member variable without m_ prefix.
Once again, I understand this is legacy code, so I don't have strong opinions on whether we need to refactor all this.
There was a problem hiding this comment.
Yeah, I agree, this comment is superfluous. Removed.
About the absence of m_, yeah, I agree that it's confusing. I have a local commit that addresses this, will push it in due time.
|
@saintmatthieu this is a big step and very nice work. It removed a lot of code, which is a clear +1 for me and it is structurally well organized as far as I could tell. |
…nd affects spectrogram view in multi-view
…in spectrogram and multiview
…ck attachments... Global configuration uses the Au4 preferences system.
… in spectrogram module
…pectrogramConfiguration
…heck mark in track context model
75f46b2 to
c96c8fc
Compare
Resolves: #9769
Recommended:
QA:
Please note that spectral selection isn't part of this PR.