Allow visualizing both stereo channels of sample clips - #8497
Conversation
samples stereo channels
Itreza2
left a comment
There was a problem hiding this comment.
Notes for reviewers
| Thumbnail zoomOut(float factor) const; | ||
|
|
||
| Peak* data() { return m_peaks.data(); } | ||
| Peak& operator[](size_t index) { return m_peaks[index]; } |
There was a problem hiding this comment.
These operators no longer makes a lot of sense since the class is now holding 3 different arrays. Because they were unused anyway I've chosen to remove them.
| , m_left_peaks(std::move(left_peaks)) | ||
| , m_samplesPerPeak(samplesPerPeak) | ||
| { | ||
| assert(m_right_peaks.size() == m_left_peaks.size() && "Stereo peaks arrays lengths don't match"); |
There was a problem hiding this comment.
This kind of precondition is bad, but Thumbnail is private in SampleThumbnail so it is unlikely this would cause any issue in the future.
| if (useOriginalBuffer && drawOriginalBuffer) | ||
| { | ||
| const auto value = m_buffer->data()->data()[i]; | ||
| const auto value = ( |
There was a problem hiding this comment.
I'm unsure about this block and what its previous version was aiming for.
The conditions for it to be executed are very uncommon tho.
|
I feel like we should have a separate option for viewing both channels at the same time, but default to the mono view (which maybe we can also add a option to set their own default), so I am thinking something like a "Show stereo view" and "Show mono view" in the context menu for sample clips to swap between the two views. There also is other stuff I might be able to review. |
one of the goals listed in #1471
This PR allow to visualize stereo channels of sample clips.
Enregistrement.d.ecran_20260803_151824.mp4
As can be seen in the clip above, the default policy is to show the stereo channels when the track's height is two times the default. This can be changed in the setup dialog thank to a new combo box.
Implementation:
The nested class
ThumbnailofSampleThumbnailhas been slightly reworked to also store the peaks of the right and left ear channels. The rendering is then quite straightforward.Possible cons:
This should not have any impact performance-wise, but cached thumbnails would occupy 3x the memory they are currently taking, which is I think very negligible but is worth mentioning.