diff --git a/src/qml/qmlplayerproxy.cpp b/src/qml/qmlplayerproxy.cpp index 7bd5846c9d73..54fc191280f3 100644 --- a/src/qml/qmlplayerproxy.cpp +++ b/src/qml/qmlplayerproxy.cpp @@ -216,8 +216,25 @@ void QmlPlayerProxy::slotWaveformChanged() { } const int textureWidth = pWaveform->getTextureStride(); const int textureHeight = pWaveform->getTextureSize() / pWaveform->getTextureStride(); - const uchar* data = reinterpret_cast(pWaveform->data()); - m_waveformTexture = QImage(data, textureWidth, textureHeight, QImage::Format_RGBA8888); + + const WaveformData* data = pWaveform->data(); + // Make a copy of the waveform data, stripping the stems portion. Note that the datasize is + // different from the texture size -- we want the full texture size so the upload works. See + // m_data in waveform/waveform.h. + if (m_waveformData.size() == 0 || + static_cast(m_waveformData.size()) != + pWaveform->getTextureSize()) { + m_waveformData.resize(pWaveform->getTextureSize()); + } + for (int i = 0; i < pWaveform->getDataSize(); i++) { + m_waveformData[i] = data[i].filtered; + } + + m_waveformTexture = + QImage(reinterpret_cast(m_waveformData.data()), + textureWidth, + textureHeight, + QImage::Format_RGBA8888); DEBUG_ASSERT(!m_waveformTexture.isNull()); emit waveformTextureChanged(); } diff --git a/src/qml/qmlplayerproxy.h b/src/qml/qmlplayerproxy.h index b796a909d9ea..8d97eba0f366 100644 --- a/src/qml/qmlplayerproxy.h +++ b/src/qml/qmlplayerproxy.h @@ -12,6 +12,7 @@ #include "qml/qmlstemsmodel.h" #include "track/cueinfo.h" #include "track/track.h" +#include "waveform/waveform.h" namespace mixxx { namespace qml { @@ -151,6 +152,7 @@ class QmlPlayerProxy : public QObject { void waveformTextureStrideChanged(); private: + std::vector m_waveformData; QImage m_waveformTexture; QPointer m_pTrackPlayer; TrackPointer m_pCurrentTrack;