From a277cea8cd7bed88551aff563df29becc7f5d116 Mon Sep 17 00:00:00 2001 From: m0dB Date: Sun, 21 Apr 2024 18:05:10 +0200 Subject: [PATCH 1/7] added rgb,filtered and stacked waveforms using textures to transfer the waveform data to the shader (like to legacy GLSL waveforms) --- CMakeLists.txt | 4 + .../allshader/waveformrenderertextured.cpp | 515 ++++++++++++++++++ .../allshader/waveformrenderertextured.h | 66 +++ .../renderers/waveformwidgetrenderer.h | 7 + src/waveform/waveformwidgetfactory.cpp | 36 ++ .../allshader/filteredwaveformwidget.h | 3 + .../widgets/allshader/hsvwaveformwidget.h | 3 + .../widgets/allshader/lrrgbwaveformwidget.h | 3 + .../widgets/allshader/rgbwaveformwidget.h | 3 + .../widgets/allshader/simplewaveformwidget.h | 3 + .../waveformwidgettexturedfiltered.cpp | 36 ++ .../waveformwidgettexturedfiltered.h | 48 ++ .../allshader/waveformwidgettexturedrgb.cpp | 35 ++ .../allshader/waveformwidgettexturedrgb.h | 48 ++ .../waveformwidgettexturedstacked.cpp | 35 ++ .../allshader/waveformwidgettexturedstacked.h | 48 ++ src/waveform/widgets/emptywaveformwidget.h | 3 + src/waveform/widgets/glrgbwaveformwidget.h | 3 + src/waveform/widgets/glsimplewaveformwidget.h | 3 + src/waveform/widgets/glslwaveformwidget.h | 9 + src/waveform/widgets/glvsynctestwidget.h | 3 + src/waveform/widgets/glwaveformwidget.h | 3 + src/waveform/widgets/hsvwaveformwidget.h | 3 + src/waveform/widgets/qthsvwaveformwidget.h | 3 + src/waveform/widgets/qtrgbwaveformwidget.h | 3 + src/waveform/widgets/qtsimplewaveformwidget.h | 3 + src/waveform/widgets/qtvsynctestwidget.h | 3 + src/waveform/widgets/qtwaveformwidget.h | 3 + src/waveform/widgets/rgbwaveformwidget.h | 3 + src/waveform/widgets/softwarewaveformwidget.h | 3 + src/waveform/widgets/waveformwidgettype.h | 3 + 31 files changed, 944 insertions(+) create mode 100644 src/waveform/renderers/allshader/waveformrenderertextured.cpp create mode 100644 src/waveform/renderers/allshader/waveformrenderertextured.h create mode 100644 src/waveform/widgets/allshader/waveformwidgettexturedfiltered.cpp create mode 100644 src/waveform/widgets/allshader/waveformwidgettexturedfiltered.h create mode 100644 src/waveform/widgets/allshader/waveformwidgettexturedrgb.cpp create mode 100644 src/waveform/widgets/allshader/waveformwidgettexturedrgb.h create mode 100644 src/waveform/widgets/allshader/waveformwidgettexturedstacked.cpp create mode 100644 src/waveform/widgets/allshader/waveformwidgettexturedstacked.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 2061926f158..49f7e1e9065 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1523,6 +1523,7 @@ if(QOPENGL) src/waveform/renderers/allshader/waveformrendererlrrgb.cpp src/waveform/renderers/allshader/waveformrendererpreroll.cpp src/waveform/renderers/allshader/waveformrendererrgb.cpp + src/waveform/renderers/allshader/waveformrenderertextured.cpp src/waveform/renderers/allshader/waveformrenderersignalbase.cpp src/waveform/renderers/allshader/waveformrenderersimple.cpp src/waveform/renderers/allshader/waveformrendermark.cpp @@ -1533,6 +1534,9 @@ if(QOPENGL) src/waveform/widgets/allshader/rgbwaveformwidget.cpp src/waveform/widgets/allshader/simplewaveformwidget.cpp src/waveform/widgets/allshader/waveformwidget.cpp + src/waveform/widgets/allshader/waveformwidgettexturedfiltered.cpp + src/waveform/widgets/allshader/waveformwidgettexturedrgb.cpp + src/waveform/widgets/allshader/waveformwidgettexturedstacked.cpp src/widget/openglwindow.cpp src/widget/tooltipqopengl.cpp src/widget/wglwidgetqopengl.cpp diff --git a/src/waveform/renderers/allshader/waveformrenderertextured.cpp b/src/waveform/renderers/allshader/waveformrenderertextured.cpp new file mode 100644 index 00000000000..142ebe2584c --- /dev/null +++ b/src/waveform/renderers/allshader/waveformrenderertextured.cpp @@ -0,0 +1,515 @@ +#include "waveform/renderers/allshader/waveformrenderertextured.h" + +#include +#include + +#include "moc_waveformrenderertextured.cpp" +#include "track/track.h" +#include "waveform/renderers/waveformwidgetrenderer.h" +#include "waveform/waveform.h" + +namespace allshader { + +// static +QString WaveformRendererTextured::fragShaderForType(WaveformRendererTextured::Type t) { + using Type = WaveformRendererTextured::Type; + switch (t) { + case Type::Filtered: + return QLatin1String(":/shaders/filteredsignal.frag"); + case Type::RGB: + return QLatin1String(":/shaders/rgbsignal.frag"); + case Type::Stacked: + return QLatin1String(":/shaders/stackedsignal.frag"); + default: + break; + } + assert(false); + return QString(); +} + +WaveformRendererTextured::WaveformRendererTextured(WaveformWidgetRenderer* waveformWidget, + Type t) + : WaveformRendererSignalBase(waveformWidget), + m_unitQuadListId(-1), + m_textureId(0), + m_textureRenderedWaveformCompletion(0), + m_shadersValid(false), + m_type(t), + m_pFragShader(fragShaderForType(t)) { +} + +WaveformRendererTextured::~WaveformRendererTextured() { + if (m_textureId) { + glDeleteTextures(1, &m_textureId); + } + + if (m_frameShaderProgram) { + m_frameShaderProgram->removeAllShaders(); + } +} + +bool WaveformRendererTextured::loadShaders() { + qDebug() << "WaveformRendererTextured::loadShaders"; + m_shadersValid = false; + + if (m_frameShaderProgram->isLinked()) { + m_frameShaderProgram->release(); + } + + m_frameShaderProgram->removeAllShaders(); + + if (!m_frameShaderProgram->addShaderFromSourceFile( + QOpenGLShader::Vertex, + ":/shaders/passthrough.vert")) { + qDebug() << "WaveformRendererTextured::loadShaders - " + << m_frameShaderProgram->log(); + return false; + } + + if (!m_frameShaderProgram->addShaderFromSourceFile( + QOpenGLShader::Fragment, + m_pFragShader)) { + qDebug() << "WaveformRendererTextured::loadShaders - " + << m_frameShaderProgram->log(); + return false; + } + + if (!m_frameShaderProgram->link()) { + qDebug() << "WaveformRendererTextured::loadShaders - " + << m_frameShaderProgram->log(); + return false; + } + + if (!m_frameShaderProgram->bind()) { + qDebug() << "WaveformRendererTextured::loadShaders - shaders binding failed"; + return false; + } + + m_shadersValid = true; + return true; +} + +bool WaveformRendererTextured::loadTexture() { + int dataSize = 0; + const WaveformData* data = nullptr; + + ConstWaveformPointer pWaveform = m_waveformRenderer->getWaveform(); + if (pWaveform) { + dataSize = pWaveform->getDataSize(); + if (dataSize > 1) { + data = pWaveform->data(); + } + } + + glEnable(GL_TEXTURE_2D); + + if (m_textureId == 0) { + glGenTextures(1, &m_textureId); + + int error = glGetError(); + if (error) { + qDebug() << "WaveformRendererTextured::loadTexture - m_textureId" + << m_textureId << "error" << error; + } + } + + glBindTexture(GL_TEXTURE_2D, m_textureId); + + int error = glGetError(); + if (error) { + qDebug() << "WaveformRendererTextured::loadTexture - bind error" << error; + } + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + + if (pWaveform != nullptr && data != nullptr) { + // Waveform ensures that getTextureSize is a multiple of + // getTextureStride so there is no rounding here. + int textureWidth = pWaveform->getTextureStride(); + int textureHeight = pWaveform->getTextureSize() / pWaveform->getTextureStride(); + + glTexImage2D(GL_TEXTURE_2D, + 0, + GL_RGBA, + textureWidth, + textureHeight, + 0, + GL_RGBA, + GL_UNSIGNED_BYTE, + data); + int error = glGetError(); + if (error) { + qDebug() << "WaveformRendererTextured::loadTexture - glTexImage2D error" << error; + } + } else { + glDeleteTextures(1, &m_textureId); + m_textureId = 0; + } + + glDisable(GL_TEXTURE_2D); + + return true; +} + +void WaveformRendererTextured::createGeometry() { + if (m_unitQuadListId != -1) { + return; + } + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + m_unitQuadListId = glGenLists(1); + glNewList(m_unitQuadListId, GL_COMPILE); + { + glBegin(GL_QUADS); + { + glTexCoord2f(0.0, 0.0); + glVertex3f(-1.0f, -1.0f, 0.0f); + + glTexCoord2f(1.0, 0.0); + glVertex3f(1.0f, -1.0f, 0.0f); + + glTexCoord2f(1.0, 1.0); + glVertex3f(1.0f, 1.0f, 0.0f); + + glTexCoord2f(0.0, 1.0); + glVertex3f(-1.0f, 1.0f, 0.0f); + } + glEnd(); + } + glEndList(); +} + +void WaveformRendererTextured::createFrameBuffers() { + const float devicePixelRatio = m_waveformRenderer->getDevicePixelRatio(); + // We create a frame buffer that is 4x the size of the renderer itself to + // "oversample" the texture relative to the surface we're drawing on. + constexpr int oversamplingFactor = 4; + const auto bufferWidth = oversamplingFactor * + static_cast(m_waveformRenderer->getWidth() * devicePixelRatio); + const auto bufferHeight = oversamplingFactor * + static_cast( + m_waveformRenderer->getHeight() * devicePixelRatio); + + m_framebuffer = std::make_unique(bufferWidth, + bufferHeight); + + if (!m_framebuffer->isValid()) { + qWarning() << "WaveformRendererTextured::createFrameBuffer - frame buffer not valid"; + } +} + +void WaveformRendererTextured::initializeGL() { + WaveformRendererSignalBase::initializeGL(); + + m_textureRenderedWaveformCompletion = 0; + + if (!m_frameShaderProgram) { + m_frameShaderProgram = std::make_unique(); + } + + if (!loadShaders()) { + return; + } + createFrameBuffers(); + createGeometry(); + if (!loadTexture()) { + return; + } +} + +void WaveformRendererTextured::onSetup(const QDomNode& node) { + Q_UNUSED(node); +} + +void WaveformRendererTextured::onSetTrack() { + if (m_loadedTrack) { + disconnect(m_loadedTrack.get(), + &Track::waveformUpdated, + this, + &WaveformRendererTextured::slotWaveformUpdated); + } + + slotWaveformUpdated(); + + const TrackPointer pTrack = m_waveformRenderer->getTrackInfo(); + if (!pTrack) { + return; + } + + // When the track's waveform has been changed (or cleared), it is necessary + // to update (or delete) the texture containing the waveform which was + // uploaded to GPU. Otherwise, previous waveform will be shown. + connect(pTrack.get(), + &Track::waveformUpdated, + this, + &WaveformRendererTextured::slotWaveformUpdated); + + m_loadedTrack = pTrack; +} + +void WaveformRendererTextured::resizeGL(int, int) { + createFrameBuffers(); +} + +void WaveformRendererTextured::slotWaveformUpdated() { + m_textureRenderedWaveformCompletion = 0; + // initializeGL not called yet + if (!m_frameShaderProgram) { + return; + } + loadTexture(); +} + +void WaveformRendererTextured::paintGL() { + ConstWaveformPointer pWaveform = m_waveformRenderer->getWaveform(); + if (pWaveform.isNull()) { + return; + } + + const double audioVisualRatio = pWaveform->getAudioVisualRatio(); + if (audioVisualRatio <= 0) { + return; + } + + int dataSize = pWaveform->getDataSize(); + if (dataSize <= 1) { + return; + } + + const WaveformData* data = pWaveform->data(); + if (data == nullptr) { + return; + } + + const double trackSamples = m_waveformRenderer->getTrackSamples(); + if (trackSamples <= 0) { + return; + } + + // NOTE(vRince): completion can change during loadTexture + // do not remove currenCompletion temp variable ! + const int currentCompletion = pWaveform->getCompletion(); + if (m_textureRenderedWaveformCompletion < currentCompletion) { + loadTexture(); + m_textureRenderedWaveformCompletion = currentCompletion; + } + + // Per-band gain from the EQ knobs. + float lowGain(1.0), midGain(1.0), highGain(1.0), allGain(1.0); + getGains(&allGain, true, &lowGain, &midGain, &highGain); + + const auto firstVisualIndex = static_cast( + m_waveformRenderer->getFirstDisplayedPosition() * trackSamples / + audioVisualRatio / 2.0); + const auto lastVisualIndex = static_cast( + m_waveformRenderer->getLastDisplayedPosition() * trackSamples / audioVisualRatio / 2.0); + + // const int firstIndex = int(firstVisualIndex+0.5); + // firstVisualIndex = firstIndex - firstIndex%2; + + // const int lastIndex = int(lastVisualIndex+0.5); + // lastVisualIndex = lastIndex + lastIndex%2; + + // qDebug() << "GAIN" << allGain << lowGain << midGain << highGain; + + // paint into frame buffer + { + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + if (m_orientation == Qt::Vertical) { + glRotatef(90.0f, 0.0f, 0.0f, 1.0f); + glScalef(-1.0f, 1.0f, 1.0f); + } + glOrtho(firstVisualIndex, lastVisualIndex, -1.0, 1.0, -10.0, 10.0); + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + glTranslatef(.0f, .0f, .0f); + + m_frameShaderProgram->bind(); + + glViewport(0, 0, m_framebuffer->width(), m_framebuffer->height()); + + m_frameShaderProgram->setUniformValue("framebufferSize", + QVector2D(m_framebuffer->width(), m_framebuffer->height())); + m_frameShaderProgram->setUniformValue("waveformLength", dataSize); + m_frameShaderProgram->setUniformValue("textureSize", pWaveform->getTextureSize()); + m_frameShaderProgram->setUniformValue("textureStride", pWaveform->getTextureStride()); + + m_frameShaderProgram->setUniformValue("firstVisualIndex", firstVisualIndex); + m_frameShaderProgram->setUniformValue("lastVisualIndex", lastVisualIndex); + + m_frameShaderProgram->setUniformValue("allGain", allGain); + m_frameShaderProgram->setUniformValue("lowGain", lowGain); + m_frameShaderProgram->setUniformValue("midGain", midGain); + m_frameShaderProgram->setUniformValue("highGain", highGain); + + m_frameShaderProgram->setUniformValue("axesColor", + QVector4D(static_cast(m_axesColor_r), + static_cast(m_axesColor_g), + static_cast(m_axesColor_b), + static_cast(m_axesColor_a))); + + if (m_type == Type::Stacked) { + m_frameShaderProgram->setUniformValue("lowFilteredColor", + QVector4D(static_cast(m_rgbLowFilteredColor_r), + static_cast(m_rgbLowFilteredColor_g), + static_cast(m_rgbLowFilteredColor_b), + 1.0)); + m_frameShaderProgram->setUniformValue("midFilteredColor", + QVector4D(static_cast(m_rgbMidFilteredColor_r), + static_cast(m_rgbMidFilteredColor_g), + static_cast(m_rgbMidFilteredColor_b), + 1.0)); + m_frameShaderProgram->setUniformValue("highFilteredColor", + QVector4D(static_cast(m_rgbHighFilteredColor_r), + static_cast(m_rgbHighFilteredColor_g), + static_cast(m_rgbHighFilteredColor_b), + 1.0)); + } + if (m_type == Type::RGB || m_type == Type::Stacked) { + m_frameShaderProgram->setUniformValue("lowColor", + QVector4D(static_cast(m_rgbLowColor_r), + static_cast(m_rgbLowColor_g), + static_cast(m_rgbLowColor_b), + 1.0)); + m_frameShaderProgram->setUniformValue("midColor", + QVector4D(static_cast(m_rgbMidColor_r), + static_cast(m_rgbMidColor_g), + static_cast(m_rgbMidColor_b), + 1.0)); + m_frameShaderProgram->setUniformValue("highColor", + QVector4D(static_cast(m_rgbHighColor_r), + static_cast(m_rgbHighColor_g), + static_cast(m_rgbHighColor_b), + 1.0)); + } else { + m_frameShaderProgram->setUniformValue("lowColor", + QVector4D(static_cast(m_lowColor_r), + static_cast(m_lowColor_g), + static_cast(m_lowColor_b), + 1.0)); + m_frameShaderProgram->setUniformValue("midColor", + QVector4D(static_cast(m_midColor_r), + static_cast(m_midColor_g), + static_cast(m_midColor_b), + 1.0)); + m_frameShaderProgram->setUniformValue("highColor", + QVector4D(static_cast(m_highColor_r), + static_cast(m_highColor_g), + static_cast(m_highColor_b), + 1.0)); + } + + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, m_textureId); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + m_framebuffer->bind(); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glClear(GL_COLOR_BUFFER_BIT); + // glCallList(m_unitQuadListId); + + glBegin(GL_QUADS); + { + glTexCoord2f(0.0, 0.0); + glVertex3f(firstVisualIndex, -1.0f, 0.0f); + + glTexCoord2f(1.0, 0.0); + glVertex3f(lastVisualIndex, -1.0f, 0.0f); + + glTexCoord2f(1.0, 1.0); + glVertex3f(lastVisualIndex, 1.0f, 0.0f); + + glTexCoord2f(0.0, 1.0); + glVertex3f(firstVisualIndex, 1.0f, 0.0f); + } + glEnd(); + + m_framebuffer->release(); + + m_frameShaderProgram->release(); + + glPopMatrix(); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + } + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -10.0, 10.0); + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glTranslatef(0.0, 0.0, 0.0); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_TEXTURE_2D); + + // paint buffer into viewport + { + // OpenGL pixels are real screen pixels, not device independent + // pixels like QPainter provides. We scale the viewport by the + // devicePixelRatio to render the texture to the surface. + const float devicePixelRatio = m_waveformRenderer->getDevicePixelRatio(); + glViewport(0, + 0, + static_cast( + devicePixelRatio * m_waveformRenderer->getWidth()), + static_cast( + devicePixelRatio * m_waveformRenderer->getHeight())); + glBindTexture(GL_TEXTURE_2D, m_framebuffer->texture()); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + glBegin(GL_QUADS); + { + glTexCoord2f(0.0, 0.0); + glVertex3f(-1.0f, -1.0f, 0.0f); + + glTexCoord2f(1.0, 0.0); + glVertex3f(1.0f, -1.0f, 0.0f); + + glTexCoord2f(1.0, 1.0); + glVertex3f(1.0f, 1.0f, 0.0f); + + glTexCoord2f(0.0, 1.0); + glVertex3f(-1.0f, 1.0f, 0.0f); + } + glEnd(); + } + + glDisable(GL_TEXTURE_2D); + + // DEBUG + /* + glBegin(GL_LINE_LOOP); + { + glColor4f(0.5,1.0,0.5,0.75); + glVertex3f(-1.0f,-1.0f, 0.0f); + glVertex3f(1.0f, 1.0f, 0.0f); + glVertex3f(1.0f,-1.0f, 0.0f); + glVertex3f(-1.0f, 1.0f, 0.0f); + } + glEnd(); + */ + + glPopMatrix(); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); +} + +} // namespace allshader diff --git a/src/waveform/renderers/allshader/waveformrenderertextured.h b/src/waveform/renderers/allshader/waveformrenderertextured.h new file mode 100644 index 00000000000..b2bf9772697 --- /dev/null +++ b/src/waveform/renderers/allshader/waveformrenderertextured.h @@ -0,0 +1,66 @@ +#pragma once + +#include "shaders/rgbshader.h" +#include "track/track_decl.h" +#include "util/class.h" +#include "util/memory.h" +#include "waveform/renderers/allshader/rgbdata.h" +#include "waveform/renderers/allshader/vertexdata.h" +#include "waveform/renderers/allshader/waveformrenderersignalbase.h" + +class QOpenGLFramebufferObject; +class QOpenGLShaderProgram; + +namespace allshader { +class WaveformRendererTextured; +} + +// Based on GLSLWaveformRendererSignal (waveform/renderers/glslwaveformrenderersignal.h) +class allshader::WaveformRendererTextured : public QObject, + public allshader::WaveformRendererSignalBase { + Q_OBJECT + public: + enum class Type { + Filtered, + RGB, + Stacked, // was RGBFiltered, + }; + + explicit WaveformRendererTextured(WaveformWidgetRenderer* waveformWidget, Type t); + ~WaveformRendererTextured() override; + + // override ::WaveformRendererSignalBase + void onSetup(const QDomNode& node) override; + + void initializeGL() override; + void paintGL() override; + void resizeGL(int w, int h) override; + + void onSetTrack() override; + + public slots: + void slotWaveformUpdated(); + + private: + static QString fragShaderForType(Type t); + bool loadShaders(); + bool loadTexture(); + + void createGeometry(); + void createFrameBuffers(); + + GLint m_unitQuadListId; + GLuint m_textureId; + + TrackPointer m_loadedTrack; + int m_textureRenderedWaveformCompletion; + + // Frame buffer for two pass rendering. + std::unique_ptr m_framebuffer; + + // shaders + bool m_shadersValid; + Type m_type; + const QString m_pFragShader; + std::unique_ptr m_frameShaderProgram; +}; diff --git a/src/waveform/renderers/waveformwidgetrenderer.h b/src/waveform/renderers/waveformwidgetrenderer.h index 47cd21b67a6..a13f76cc0b9 100644 --- a/src/waveform/renderers/waveformwidgetrenderer.h +++ b/src/waveform/renderers/waveformwidgetrenderer.h @@ -170,6 +170,13 @@ class WaveformWidgetRenderer { return renderer; } + template + inline T_Renderer* addRenderer(T_Arg arg) { + T_Renderer* renderer = new T_Renderer(this, arg); + m_rendererStack.push_back(renderer); + return renderer; + } + void setTrack(TrackPointer track); void setMarkPositions(const QList& markPositions) { m_markPositions = markPositions; diff --git a/src/waveform/waveformwidgetfactory.cpp b/src/waveform/waveformwidgetfactory.cpp index a01452b8fdb..1ec48e30347 100644 --- a/src/waveform/waveformwidgetfactory.cpp +++ b/src/waveform/waveformwidgetfactory.cpp @@ -29,6 +29,9 @@ #include "waveform/widgets/allshader/lrrgbwaveformwidget.h" #include "waveform/widgets/allshader/rgbwaveformwidget.h" #include "waveform/widgets/allshader/simplewaveformwidget.h" +#include "waveform/widgets/allshader/waveformwidgettexturedfiltered.h" +#include "waveform/widgets/allshader/waveformwidgettexturedrgb.h" +#include "waveform/widgets/allshader/waveformwidgettexturedstacked.h" #else #include "waveform/widgets/qthsvwaveformwidget.h" #include "waveform/widgets/qtrgbwaveformwidget.h" @@ -1017,6 +1020,27 @@ void WaveformWidgetFactory::evaluateWidgets() { #else setWaveformVarsByType.operator()(); break; +#endif + case WaveformWidgetType::AllShaderTexturedFiltered: +#ifndef MIXXX_USE_QOPENGL + continue; +#else + setWaveformVarsByType.operator()(); + break; +#endif + case WaveformWidgetType::AllShaderTexturedRGB: +#ifndef MIXXX_USE_QOPENGL + continue; +#else + setWaveformVarsByType.operator()(); + break; +#endif + case WaveformWidgetType::AllShaderTexturedStacked: +#ifndef MIXXX_USE_QOPENGL + continue; +#else + setWaveformVarsByType.operator()(); + break; #endif default: DEBUG_ASSERT(!"Unexpected WaveformWidgetType"); @@ -1114,6 +1138,15 @@ WaveformWidgetAbstract* WaveformWidgetFactory::createWaveformWidget( case WaveformWidgetType::AllShaderHSVWaveform: widget = new allshader::HSVWaveformWidget(viewer->getGroup(), viewer); break; + case WaveformWidgetType::AllShaderTexturedFiltered: + widget = new allshader::WaveformWidgetTexturedFiltered(viewer->getGroup(), viewer); + break; + case WaveformWidgetType::AllShaderTexturedRGB: + widget = new allshader::WaveformWidgetTexturedRGB(viewer->getGroup(), viewer); + break; + case WaveformWidgetType::AllShaderTexturedStacked: + widget = new allshader::WaveformWidgetTexturedStacked(viewer->getGroup(), viewer); + break; #else case WaveformWidgetType::QtSimpleWaveform: widget = new QtSimpleWaveformWidget(viewer->getGroup(), viewer); @@ -1252,6 +1285,9 @@ QString WaveformWidgetFactory::buildWidgetDisplayName() const { extras.push_back(QStringLiteral("GL")); } } + if (WaveformT::useTextureForWaveform()) { + extras.push_back(QStringLiteral("Waveform data texture")); + } QString name = WaveformT::getWaveformWidgetName(); if (extras.isEmpty()) { return name; diff --git a/src/waveform/widgets/allshader/filteredwaveformwidget.h b/src/waveform/widgets/allshader/filteredwaveformwidget.h index bcc7103e548..adc55239beb 100644 --- a/src/waveform/widgets/allshader/filteredwaveformwidget.h +++ b/src/waveform/widgets/allshader/filteredwaveformwidget.h @@ -28,6 +28,9 @@ class allshader::FilteredWaveformWidget final : public allshader::WaveformWidget static constexpr bool useOpenGLShaders() { return true; } + static constexpr bool useTextureForWaveform() { + return false; + } static constexpr WaveformWidgetCategory category() { return WaveformWidgetCategory::AllShader; } diff --git a/src/waveform/widgets/allshader/hsvwaveformwidget.h b/src/waveform/widgets/allshader/hsvwaveformwidget.h index 827df588579..67d077a6aea 100644 --- a/src/waveform/widgets/allshader/hsvwaveformwidget.h +++ b/src/waveform/widgets/allshader/hsvwaveformwidget.h @@ -28,6 +28,9 @@ class allshader::HSVWaveformWidget final : public allshader::WaveformWidget { static constexpr bool useOpenGLShaders() { return true; } + static constexpr bool useTextureForWaveform() { + return false; + } static constexpr WaveformWidgetCategory category() { return WaveformWidgetCategory::AllShader; } diff --git a/src/waveform/widgets/allshader/lrrgbwaveformwidget.h b/src/waveform/widgets/allshader/lrrgbwaveformwidget.h index bca822c5632..76a300852e2 100644 --- a/src/waveform/widgets/allshader/lrrgbwaveformwidget.h +++ b/src/waveform/widgets/allshader/lrrgbwaveformwidget.h @@ -28,6 +28,9 @@ class allshader::LRRGBWaveformWidget final : public allshader::WaveformWidget { static constexpr bool useOpenGLShaders() { return true; } + static constexpr bool useTextureForWaveform() { + return false; + } static constexpr WaveformWidgetCategory category() { return WaveformWidgetCategory::AllShader; } diff --git a/src/waveform/widgets/allshader/rgbwaveformwidget.h b/src/waveform/widgets/allshader/rgbwaveformwidget.h index 58ab98e7ed5..93d6465bbc0 100644 --- a/src/waveform/widgets/allshader/rgbwaveformwidget.h +++ b/src/waveform/widgets/allshader/rgbwaveformwidget.h @@ -28,6 +28,9 @@ class allshader::RGBWaveformWidget final : public allshader::WaveformWidget { static constexpr bool useOpenGLShaders() { return true; } + static constexpr bool useTextureForWaveform() { + return false; + } static constexpr WaveformWidgetCategory category() { return WaveformWidgetCategory::AllShader; } diff --git a/src/waveform/widgets/allshader/simplewaveformwidget.h b/src/waveform/widgets/allshader/simplewaveformwidget.h index 89664103a64..5c66f5ba5f9 100644 --- a/src/waveform/widgets/allshader/simplewaveformwidget.h +++ b/src/waveform/widgets/allshader/simplewaveformwidget.h @@ -28,6 +28,9 @@ class allshader::SimpleWaveformWidget final : public allshader::WaveformWidget { static constexpr bool useOpenGLShaders() { return true; } + static constexpr bool useTextureForWaveform() { + return false; + } static constexpr WaveformWidgetCategory category() { return WaveformWidgetCategory::AllShader; } diff --git a/src/waveform/widgets/allshader/waveformwidgettexturedfiltered.cpp b/src/waveform/widgets/allshader/waveformwidgettexturedfiltered.cpp new file mode 100644 index 00000000000..ae986ce0cae --- /dev/null +++ b/src/waveform/widgets/allshader/waveformwidgettexturedfiltered.cpp @@ -0,0 +1,36 @@ +#include "waveform/widgets/allshader/waveformwidgettexturedfiltered.h" + +#include "waveform/renderers/allshader/waveformrenderbackground.h" +#include "waveform/renderers/allshader/waveformrenderbeat.h" +#include "waveform/renderers/allshader/waveformrendererendoftrack.h" +#include "waveform/renderers/allshader/waveformrendererpreroll.h" +#include "waveform/renderers/allshader/waveformrenderertextured.h" +#include "waveform/renderers/allshader/waveformrendermark.h" +#include "waveform/renderers/allshader/waveformrendermarkrange.h" +#include "waveform/widgets/allshader/moc_waveformwidgettexturedfiltered.cpp" + +namespace allshader { + +WaveformWidgetTexturedFiltered::WaveformWidgetTexturedFiltered( + const QString& group, QWidget* parent) + : WaveformWidget(group, parent) { + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(WaveformRendererTextured::Type::Filtered); + addRenderer(); + addRenderer(); + + m_initSuccess = init(); +} + +void WaveformWidgetTexturedFiltered::castToQWidget() { + m_widget = this; +} + +void WaveformWidgetTexturedFiltered::paintEvent(QPaintEvent* event) { + Q_UNUSED(event); +} + +} // namespace allshader diff --git a/src/waveform/widgets/allshader/waveformwidgettexturedfiltered.h b/src/waveform/widgets/allshader/waveformwidgettexturedfiltered.h new file mode 100644 index 00000000000..f56a6ef6555 --- /dev/null +++ b/src/waveform/widgets/allshader/waveformwidgettexturedfiltered.h @@ -0,0 +1,48 @@ +#pragma once + +#include "util/class.h" +#include "waveform/renderers/allshader/waveformrenderertextured.h" +#include "waveform/widgets/allshader/waveformwidget.h" + +class WaveformWidgetFactory; + +namespace allshader { +class WaveformWidgetTexturedFiltered; +} + +class allshader::WaveformWidgetTexturedFiltered final : public allshader::WaveformWidget { + Q_OBJECT + public: + WaveformWidgetType::Type getType() const override { + return WaveformWidgetType::AllShaderTexturedFiltered; + } + + static inline QString getWaveformWidgetName() { + return tr("Filtered"); + } + static constexpr bool useOpenGl() { + return true; + } + static constexpr bool useOpenGles() { + return true; + } + static constexpr bool useOpenGLShaders() { + return true; + } + static constexpr bool useTextureForWaveform() { + return true; + } + static constexpr WaveformWidgetCategory category() { + return WaveformWidgetCategory::AllShader; + } + + protected: + void castToQWidget() override; + void paintEvent(QPaintEvent* event) override; + + private: + WaveformWidgetTexturedFiltered(const QString& group, QWidget* parent); + friend class ::WaveformWidgetFactory; + + DISALLOW_COPY_AND_ASSIGN(WaveformWidgetTexturedFiltered); +}; diff --git a/src/waveform/widgets/allshader/waveformwidgettexturedrgb.cpp b/src/waveform/widgets/allshader/waveformwidgettexturedrgb.cpp new file mode 100644 index 00000000000..2508619bf65 --- /dev/null +++ b/src/waveform/widgets/allshader/waveformwidgettexturedrgb.cpp @@ -0,0 +1,35 @@ +#include "waveform/widgets/allshader/waveformwidgettexturedrgb.h" + +#include "waveform/renderers/allshader/waveformrenderbackground.h" +#include "waveform/renderers/allshader/waveformrenderbeat.h" +#include "waveform/renderers/allshader/waveformrendererendoftrack.h" +#include "waveform/renderers/allshader/waveformrendererpreroll.h" +#include "waveform/renderers/allshader/waveformrenderertextured.h" +#include "waveform/renderers/allshader/waveformrendermark.h" +#include "waveform/renderers/allshader/waveformrendermarkrange.h" +#include "waveform/widgets/allshader/moc_waveformwidgettexturedrgb.cpp" + +namespace allshader { + +WaveformWidgetTexturedRGB::WaveformWidgetTexturedRGB(const QString& group, QWidget* parent) + : WaveformWidget(group, parent) { + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(WaveformRendererTextured::Type::RGB); + addRenderer(); + addRenderer(); + + m_initSuccess = init(); +} + +void WaveformWidgetTexturedRGB::castToQWidget() { + m_widget = this; +} + +void WaveformWidgetTexturedRGB::paintEvent(QPaintEvent* event) { + Q_UNUSED(event); +} + +} // namespace allshader diff --git a/src/waveform/widgets/allshader/waveformwidgettexturedrgb.h b/src/waveform/widgets/allshader/waveformwidgettexturedrgb.h new file mode 100644 index 00000000000..ff1acdb39ff --- /dev/null +++ b/src/waveform/widgets/allshader/waveformwidgettexturedrgb.h @@ -0,0 +1,48 @@ +#pragma once + +#include "util/class.h" +#include "waveform/renderers/allshader/waveformrenderertextured.h" +#include "waveform/widgets/allshader/waveformwidget.h" + +class WaveformWidgetFactory; + +namespace allshader { +class WaveformWidgetTexturedRGB; +} + +class allshader::WaveformWidgetTexturedRGB final : public allshader::WaveformWidget { + Q_OBJECT + public: + WaveformWidgetType::Type getType() const override { + return WaveformWidgetType::AllShaderTexturedRGB; + } + + static inline QString getWaveformWidgetName() { + return tr("RGB"); + } + static constexpr bool useOpenGl() { + return true; + } + static constexpr bool useOpenGles() { + return true; + } + static constexpr bool useOpenGLShaders() { + return true; + } + static constexpr bool useTextureForWaveform() { + return true; + } + static constexpr WaveformWidgetCategory category() { + return WaveformWidgetCategory::AllShader; + } + + protected: + void castToQWidget() override; + void paintEvent(QPaintEvent* event) override; + + private: + WaveformWidgetTexturedRGB(const QString& group, QWidget* parent); + friend class ::WaveformWidgetFactory; + + DISALLOW_COPY_AND_ASSIGN(WaveformWidgetTexturedRGB); +}; diff --git a/src/waveform/widgets/allshader/waveformwidgettexturedstacked.cpp b/src/waveform/widgets/allshader/waveformwidgettexturedstacked.cpp new file mode 100644 index 00000000000..69591545917 --- /dev/null +++ b/src/waveform/widgets/allshader/waveformwidgettexturedstacked.cpp @@ -0,0 +1,35 @@ +#include "waveform/widgets/allshader/waveformwidgettexturedstacked.h" + +#include "waveform/renderers/allshader/waveformrenderbackground.h" +#include "waveform/renderers/allshader/waveformrenderbeat.h" +#include "waveform/renderers/allshader/waveformrendererendoftrack.h" +#include "waveform/renderers/allshader/waveformrendererpreroll.h" +#include "waveform/renderers/allshader/waveformrenderertextured.h" +#include "waveform/renderers/allshader/waveformrendermark.h" +#include "waveform/renderers/allshader/waveformrendermarkrange.h" +#include "waveform/widgets/allshader/moc_waveformwidgettexturedstacked.cpp" + +namespace allshader { + +WaveformWidgetTexturedStacked::WaveformWidgetTexturedStacked(const QString& group, QWidget* parent) + : WaveformWidget(group, parent) { + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(WaveformRendererTextured::Type::Stacked); + addRenderer(); + addRenderer(); + + m_initSuccess = init(); +} + +void WaveformWidgetTexturedStacked::castToQWidget() { + m_widget = this; +} + +void WaveformWidgetTexturedStacked::paintEvent(QPaintEvent* event) { + Q_UNUSED(event); +} + +} // namespace allshader diff --git a/src/waveform/widgets/allshader/waveformwidgettexturedstacked.h b/src/waveform/widgets/allshader/waveformwidgettexturedstacked.h new file mode 100644 index 00000000000..9c903744586 --- /dev/null +++ b/src/waveform/widgets/allshader/waveformwidgettexturedstacked.h @@ -0,0 +1,48 @@ +#pragma once + +#include "util/class.h" +#include "waveform/renderers/allshader/waveformrenderertextured.h" +#include "waveform/widgets/allshader/waveformwidget.h" + +class WaveformWidgetFactory; + +namespace allshader { +class WaveformWidgetTexturedStacked; +} + +class allshader::WaveformWidgetTexturedStacked final : public allshader::WaveformWidget { + Q_OBJECT + public: + WaveformWidgetType::Type getType() const override { + return WaveformWidgetType::AllShaderTexturedStacked; + } + + static inline QString getWaveformWidgetName() { + return tr("RGB Stacked"); + } + static constexpr bool useOpenGl() { + return true; + } + static constexpr bool useOpenGles() { + return true; + } + static constexpr bool useOpenGLShaders() { + return true; + } + static constexpr bool useTextureForWaveform() { + return true; + } + static constexpr WaveformWidgetCategory category() { + return WaveformWidgetCategory::AllShader; + } + + protected: + void castToQWidget() override; + void paintEvent(QPaintEvent* event) override; + + private: + WaveformWidgetTexturedStacked(const QString& group, QWidget* parent); + friend class ::WaveformWidgetFactory; + + DISALLOW_COPY_AND_ASSIGN(WaveformWidgetTexturedStacked); +}; diff --git a/src/waveform/widgets/emptywaveformwidget.h b/src/waveform/widgets/emptywaveformwidget.h index cc2ff386068..184464661b9 100644 --- a/src/waveform/widgets/emptywaveformwidget.h +++ b/src/waveform/widgets/emptywaveformwidget.h @@ -18,6 +18,9 @@ class EmptyWaveformWidget : public NonGLWaveformWidgetAbstract { static inline bool useOpenGl() { return false; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } + static inline bool useTextureForWaveform() { + return false; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::Default; } diff --git a/src/waveform/widgets/glrgbwaveformwidget.h b/src/waveform/widgets/glrgbwaveformwidget.h index 45940e3b189..0f2721bcb0c 100644 --- a/src/waveform/widgets/glrgbwaveformwidget.h +++ b/src/waveform/widgets/glrgbwaveformwidget.h @@ -14,6 +14,9 @@ class GLRGBWaveformWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } + static inline bool useTextureForWaveform() { + return false; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::Legacy; } diff --git a/src/waveform/widgets/glsimplewaveformwidget.h b/src/waveform/widgets/glsimplewaveformwidget.h index 0b5ab77200a..0ce4b91b453 100644 --- a/src/waveform/widgets/glsimplewaveformwidget.h +++ b/src/waveform/widgets/glsimplewaveformwidget.h @@ -14,6 +14,9 @@ class GLSimpleWaveformWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } + static inline bool useTextureForWaveform() { + return false; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::Legacy; } diff --git a/src/waveform/widgets/glslwaveformwidget.h b/src/waveform/widgets/glslwaveformwidget.h index 126c82e2221..5cb994005a4 100644 --- a/src/waveform/widgets/glslwaveformwidget.h +++ b/src/waveform/widgets/glslwaveformwidget.h @@ -40,6 +40,9 @@ class GLSLFilteredWaveformWidget : public GLSLWaveformWidget { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return true; } + static inline bool useTextureForWaveform() { + return true; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::Legacy; } @@ -57,6 +60,9 @@ class GLSLRGBWaveformWidget : public GLSLWaveformWidget { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return true; } + static inline bool useTextureForWaveform() { + return true; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::Legacy; } @@ -84,6 +90,9 @@ class GLSLRGBStackedWaveformWidget : public GLSLWaveformWidget { static inline bool useOpenGLShaders() { return true; } + static inline bool useTextureForWaveform() { + return true; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::Legacy; } diff --git a/src/waveform/widgets/glvsynctestwidget.h b/src/waveform/widgets/glvsynctestwidget.h index 7a6b322cdff..02c89bda488 100644 --- a/src/waveform/widgets/glvsynctestwidget.h +++ b/src/waveform/widgets/glvsynctestwidget.h @@ -14,6 +14,9 @@ class GLVSyncTestWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } + static inline bool useTextureForWaveform() { + return false; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::DeveloperOnly; } diff --git a/src/waveform/widgets/glwaveformwidget.h b/src/waveform/widgets/glwaveformwidget.h index f2548817f0d..77c01ff00c3 100644 --- a/src/waveform/widgets/glwaveformwidget.h +++ b/src/waveform/widgets/glwaveformwidget.h @@ -14,6 +14,9 @@ class GLWaveformWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } + static inline bool useTextureForWaveform() { + return false; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::Legacy; } diff --git a/src/waveform/widgets/hsvwaveformwidget.h b/src/waveform/widgets/hsvwaveformwidget.h index ade92a4b8d5..a9d210ac447 100644 --- a/src/waveform/widgets/hsvwaveformwidget.h +++ b/src/waveform/widgets/hsvwaveformwidget.h @@ -15,6 +15,9 @@ class HSVWaveformWidget : public NonGLWaveformWidgetAbstract { static inline bool useOpenGl() { return false; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } + static inline bool useTextureForWaveform() { + return false; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::Software; } diff --git a/src/waveform/widgets/qthsvwaveformwidget.h b/src/waveform/widgets/qthsvwaveformwidget.h index 181509b6d0e..d27218376b2 100644 --- a/src/waveform/widgets/qthsvwaveformwidget.h +++ b/src/waveform/widgets/qthsvwaveformwidget.h @@ -13,6 +13,9 @@ class QtHSVWaveformWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return true; } static inline bool useOpenGLShaders() { return false; } + static inline bool useTextureForWaveform() { + return false; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::Legacy; } diff --git a/src/waveform/widgets/qtrgbwaveformwidget.h b/src/waveform/widgets/qtrgbwaveformwidget.h index 28c963fa974..0f560a3f370 100644 --- a/src/waveform/widgets/qtrgbwaveformwidget.h +++ b/src/waveform/widgets/qtrgbwaveformwidget.h @@ -13,6 +13,9 @@ class QtRGBWaveformWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return true; } static inline bool useOpenGLShaders() { return false; } + static inline bool useTextureForWaveform() { + return false; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::Legacy; } diff --git a/src/waveform/widgets/qtsimplewaveformwidget.h b/src/waveform/widgets/qtsimplewaveformwidget.h index 2ae336c96be..fc912ae5f91 100644 --- a/src/waveform/widgets/qtsimplewaveformwidget.h +++ b/src/waveform/widgets/qtsimplewaveformwidget.h @@ -17,6 +17,9 @@ class QtSimpleWaveformWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return true; } static inline bool useOpenGLShaders() { return false; } + static inline bool useTextureForWaveform() { + return false; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::Legacy; } diff --git a/src/waveform/widgets/qtvsynctestwidget.h b/src/waveform/widgets/qtvsynctestwidget.h index ae46ab887c9..876cfae616a 100644 --- a/src/waveform/widgets/qtvsynctestwidget.h +++ b/src/waveform/widgets/qtvsynctestwidget.h @@ -14,6 +14,9 @@ class QtVSyncTestWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return true; } static inline bool useOpenGLShaders() { return false; } + static inline bool useTextureForWaveform() { + return false; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::DeveloperOnly; } diff --git a/src/waveform/widgets/qtwaveformwidget.h b/src/waveform/widgets/qtwaveformwidget.h index ee50f559f00..9dd1881b0d7 100644 --- a/src/waveform/widgets/qtwaveformwidget.h +++ b/src/waveform/widgets/qtwaveformwidget.h @@ -14,6 +14,9 @@ class QtWaveformWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return true; } static inline bool useOpenGLShaders() { return false; } + static inline bool useTextureForWaveform() { + return false; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::Legacy; } diff --git a/src/waveform/widgets/rgbwaveformwidget.h b/src/waveform/widgets/rgbwaveformwidget.h index e03170210fc..47e56fc9147 100644 --- a/src/waveform/widgets/rgbwaveformwidget.h +++ b/src/waveform/widgets/rgbwaveformwidget.h @@ -15,6 +15,9 @@ class RGBWaveformWidget : public NonGLWaveformWidgetAbstract { static inline bool useOpenGl() { return false; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } + static inline bool useTextureForWaveform() { + return false; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::Software; } diff --git a/src/waveform/widgets/softwarewaveformwidget.h b/src/waveform/widgets/softwarewaveformwidget.h index 02617400afe..6490d70b007 100644 --- a/src/waveform/widgets/softwarewaveformwidget.h +++ b/src/waveform/widgets/softwarewaveformwidget.h @@ -15,6 +15,9 @@ class SoftwareWaveformWidget : public NonGLWaveformWidgetAbstract { static inline bool useOpenGl() { return false; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } + static inline bool useTextureForWaveform() { + return false; + } static inline WaveformWidgetCategory category() { return WaveformWidgetCategory::Software; } diff --git a/src/waveform/widgets/waveformwidgettype.h b/src/waveform/widgets/waveformwidgettype.h index 9a3fcfcb416..32f81e23d60 100644 --- a/src/waveform/widgets/waveformwidgettype.h +++ b/src/waveform/widgets/waveformwidgettype.h @@ -27,6 +27,9 @@ class WaveformWidgetType { AllShaderFilteredWaveform, // 19 Filtered (all-shaders) AllShaderSimpleWaveform, // 20 Simple (all-shaders) AllShaderHSVWaveform, // 21 HSV (all-shaders) + AllShaderTexturedFiltered, // 22 Filtered (textured) (all-shaders) + AllShaderTexturedRGB, // 23 RGB (textured) (all-shaders) + AllShaderTexturedStacked, // 24 Stacked (textured) (all-shaders) Count_WaveformwidgetType // Also used as invalid value }; }; From 9a5c616c335d54c6982013b26c71cbad9b592ba4 Mon Sep 17 00:00:00 2001 From: m0dB Date: Sun, 21 Apr 2024 19:06:25 +0200 Subject: [PATCH 2/7] added upgrades to new allshadertextured types --- src/preferences/upgrade.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/preferences/upgrade.cpp b/src/preferences/upgrade.cpp index f9b33f81a7a..15c24989712 100644 --- a/src/preferences/upgrade.cpp +++ b/src/preferences/upgrade.cpp @@ -46,21 +46,27 @@ WaveformWidgetType::Type upgradeToAllShaders(WaveformWidgetType::Type waveformTy case WWT::AllShaderFilteredWaveform: case WWT::AllShaderSimpleWaveform: case WWT::AllShaderHSVWaveform: + case WWT::AllShaderTexturedFiltered: + case WWT::AllShaderTexturedRGB: + case WWT::AllShaderTexturedStacked: case WWT::Count_WaveformwidgetType: return waveformType; case WWT::QtSimpleWaveform: case WWT::GLSimpleWaveform: return WaveformWidgetType::AllShaderSimpleWaveform; case WWT::GLFilteredWaveform: - case WWT::GLSLFilteredWaveform: return WaveformWidgetType::AllShaderFilteredWaveform; + case WWT::GLSLFilteredWaveform: + return WaveformWidgetType::AllShaderTexturedFiltered; case WWT::QtWaveform: case WWT::RGBWaveform: case WWT::GLRGBWaveform: - case WWT::GLSLRGBWaveform: case WWT::QtRGBWaveform: - case WWT::GLSLRGBStackedWaveform: return WWT::AllShaderRGBWaveform; + case WWT::GLSLRGBWaveform: + return WWT::AllShaderTexturedRGB; + case WWT::GLSLRGBStackedWaveform: + return WWT::AllShaderTexturedStacked; case WWT::HSVWaveform: case WWT::QtHSVWaveform: return WWT::AllShaderHSVWaveform; From 8e031337de10a90b99ad1eb33114753e7c27c77b Mon Sep 17 00:00:00 2001 From: m0dB Date: Sun, 12 May 2024 01:06:37 +0200 Subject: [PATCH 3/7] allshader rgb stacked and filtered (added and renamed) --- CMakeLists.txt | 1 + .../allshader/waveformrendererfiltered.cpp | 35 +++++++++---- .../allshader/waveformrendererfiltered.h | 3 +- src/waveform/waveformwidgetfactory.cpp | 19 +++++++ .../allshader/filteredwaveformwidget.cpp | 2 +- .../allshader/rgbstackedwaveformwidget.cpp | 35 +++++++++++++ .../allshader/rgbstackedwaveformwidget.h | 47 +++++++++++++++++ src/waveform/widgets/waveformwidgettype.h | 51 ++++++++++--------- 8 files changed, 155 insertions(+), 38 deletions(-) create mode 100644 src/waveform/widgets/allshader/rgbstackedwaveformwidget.cpp create mode 100644 src/waveform/widgets/allshader/rgbstackedwaveformwidget.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 49f7e1e9065..9cbdf7ec663 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1532,6 +1532,7 @@ if(QOPENGL) src/waveform/widgets/allshader/hsvwaveformwidget.cpp src/waveform/widgets/allshader/lrrgbwaveformwidget.cpp src/waveform/widgets/allshader/rgbwaveformwidget.cpp + src/waveform/widgets/allshader/rgbstackedwaveformwidget.cpp src/waveform/widgets/allshader/simplewaveformwidget.cpp src/waveform/widgets/allshader/waveformwidget.cpp src/waveform/widgets/allshader/waveformwidgettexturedfiltered.cpp diff --git a/src/waveform/renderers/allshader/waveformrendererfiltered.cpp b/src/waveform/renderers/allshader/waveformrendererfiltered.cpp index b59bfdb1010..32fce65652a 100644 --- a/src/waveform/renderers/allshader/waveformrendererfiltered.cpp +++ b/src/waveform/renderers/allshader/waveformrendererfiltered.cpp @@ -9,8 +9,9 @@ namespace allshader { WaveformRendererFiltered::WaveformRendererFiltered( - WaveformWidgetRenderer* waveformWidget) - : WaveformRendererSignalBase(waveformWidget) { + WaveformWidgetRenderer* waveformWidget, bool bRgbStacked) + : WaveformRendererSignalBase(waveformWidget), + m_bRgbStacked(bRgbStacked) { } void WaveformRendererFiltered::onSetup(const QDomNode& node) { @@ -147,15 +148,27 @@ void WaveformRendererFiltered::paintGL() { m_shader.setUniformValue(matrixLocation, matrix); QColor colors[4]; - colors[0].setRgbF(static_cast(m_rgbLowColor_r), - static_cast(m_rgbLowColor_g), - static_cast(m_rgbLowColor_b)); - colors[1].setRgbF(static_cast(m_rgbMidColor_r), - static_cast(m_rgbMidColor_g), - static_cast(m_rgbMidColor_b)); - colors[2].setRgbF(static_cast(m_rgbHighColor_r), - static_cast(m_rgbHighColor_g), - static_cast(m_rgbHighColor_b)); + if (m_bRgbStacked) { + colors[0].setRgbF(static_cast(m_rgbLowColor_r), + static_cast(m_rgbLowColor_g), + static_cast(m_rgbLowColor_b)); + colors[1].setRgbF(static_cast(m_rgbMidColor_r), + static_cast(m_rgbMidColor_g), + static_cast(m_rgbMidColor_b)); + colors[2].setRgbF(static_cast(m_rgbHighColor_r), + static_cast(m_rgbHighColor_g), + static_cast(m_rgbHighColor_b)); + } else { + colors[0].setRgbF(static_cast(m_lowColor_r), + static_cast(m_lowColor_g), + static_cast(m_lowColor_b)); + colors[1].setRgbF(static_cast(m_midColor_r), + static_cast(m_midColor_g), + static_cast(m_midColor_b)); + colors[2].setRgbF(static_cast(m_highColor_r), + static_cast(m_highColor_g), + static_cast(m_highColor_b)); + } colors[3].setRgbF(static_cast(m_axesColor_r), static_cast(m_axesColor_g), static_cast(m_axesColor_b), diff --git a/src/waveform/renderers/allshader/waveformrendererfiltered.h b/src/waveform/renderers/allshader/waveformrendererfiltered.h index 076b4f9af3f..158ff880c01 100644 --- a/src/waveform/renderers/allshader/waveformrendererfiltered.h +++ b/src/waveform/renderers/allshader/waveformrendererfiltered.h @@ -11,7 +11,7 @@ class WaveformRendererFiltered; class allshader::WaveformRendererFiltered final : public allshader::WaveformRendererSignalBase { public: - explicit WaveformRendererFiltered(WaveformWidgetRenderer* waveformWidget); + explicit WaveformRendererFiltered(WaveformWidgetRenderer* waveformWidget, bool rgbStacked); // override ::WaveformRendererSignalBase void onSetup(const QDomNode& node) override; @@ -20,6 +20,7 @@ class allshader::WaveformRendererFiltered final : public allshader::WaveformRend void paintGL() override; private: + const bool m_bRgbStacked; mixxx::UnicolorShader m_shader; VertexData m_vertices[4]; diff --git a/src/waveform/waveformwidgetfactory.cpp b/src/waveform/waveformwidgetfactory.cpp index 1ec48e30347..3027bb755aa 100644 --- a/src/waveform/waveformwidgetfactory.cpp +++ b/src/waveform/waveformwidgetfactory.cpp @@ -27,6 +27,7 @@ #include "waveform/widgets/allshader/filteredwaveformwidget.h" #include "waveform/widgets/allshader/hsvwaveformwidget.h" #include "waveform/widgets/allshader/lrrgbwaveformwidget.h" +#include "waveform/widgets/allshader/rgbstackedwaveformwidget.h" #include "waveform/widgets/allshader/rgbwaveformwidget.h" #include "waveform/widgets/allshader/simplewaveformwidget.h" #include "waveform/widgets/allshader/waveformwidgettexturedfiltered.h" @@ -576,6 +577,14 @@ bool WaveformWidgetFactory::widgetTypeSupportsUntilMark() const { return true; case WaveformWidgetType::AllShaderHSVWaveform: return true; + case WaveformWidgetType::AllShaderRGBStackedWaveform: + return true; + case WaveformWidgetType::AllShaderTexturedFiltered: + return true; + case WaveformWidgetType::AllShaderTexturedRGB: + return true; + case WaveformWidgetType::AllShaderTexturedStacked: + return true; default: break; } @@ -1006,6 +1015,13 @@ void WaveformWidgetFactory::evaluateWidgets() { #else setWaveformVarsByType.operator()(); break; +#endif + case WaveformWidgetType::AllShaderRGBStackedWaveform: +#ifndef MIXXX_USE_QOPENGL + continue; +#else + setWaveformVarsByType.operator()(); + break; #endif case WaveformWidgetType::AllShaderSimpleWaveform: #ifndef MIXXX_USE_QOPENGL @@ -1132,6 +1148,9 @@ WaveformWidgetAbstract* WaveformWidgetFactory::createWaveformWidget( case WaveformWidgetType::AllShaderFilteredWaveform: widget = new allshader::FilteredWaveformWidget(viewer->getGroup(), viewer); break; + case WaveformWidgetType::AllShaderRGBStackedWaveform: + widget = new allshader::RGBStackedWaveformWidget(viewer->getGroup(), viewer); + break; case WaveformWidgetType::AllShaderSimpleWaveform: widget = new allshader::SimpleWaveformWidget(viewer->getGroup(), viewer); break; diff --git a/src/waveform/widgets/allshader/filteredwaveformwidget.cpp b/src/waveform/widgets/allshader/filteredwaveformwidget.cpp index d5ef9e888ed..e6f9dbbfde5 100644 --- a/src/waveform/widgets/allshader/filteredwaveformwidget.cpp +++ b/src/waveform/widgets/allshader/filteredwaveformwidget.cpp @@ -17,7 +17,7 @@ FilteredWaveformWidget::FilteredWaveformWidget(const QString& group, QWidget* pa addRenderer(); addRenderer(); addRenderer(); - addRenderer(); + addRenderer(false); addRenderer(); addRenderer(); diff --git a/src/waveform/widgets/allshader/rgbstackedwaveformwidget.cpp b/src/waveform/widgets/allshader/rgbstackedwaveformwidget.cpp new file mode 100644 index 00000000000..4f359cd27b8 --- /dev/null +++ b/src/waveform/widgets/allshader/rgbstackedwaveformwidget.cpp @@ -0,0 +1,35 @@ +#include "waveform/widgets/allshader/rgbstackedwaveformwidget.h" + +#include "waveform/renderers/allshader/waveformrenderbackground.h" +#include "waveform/renderers/allshader/waveformrenderbeat.h" +#include "waveform/renderers/allshader/waveformrendererendoftrack.h" +#include "waveform/renderers/allshader/waveformrendererfiltered.h" +#include "waveform/renderers/allshader/waveformrendererpreroll.h" +#include "waveform/renderers/allshader/waveformrendermark.h" +#include "waveform/renderers/allshader/waveformrendermarkrange.h" +#include "waveform/widgets/allshader/moc_rgbstackedwaveformwidget.cpp" + +namespace allshader { + +RGBStackedWaveformWidget::RGBStackedWaveformWidget(const QString& group, QWidget* parent) + : WaveformWidget(group, parent) { + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(true); // true for RGB Stacked + addRenderer(); + addRenderer(); + + m_initSuccess = init(); +} + +void RGBStackedWaveformWidget::castToQWidget() { + m_widget = this; +} + +void RGBStackedWaveformWidget::paintEvent(QPaintEvent* event) { + Q_UNUSED(event); +} + +} // namespace allshader diff --git a/src/waveform/widgets/allshader/rgbstackedwaveformwidget.h b/src/waveform/widgets/allshader/rgbstackedwaveformwidget.h new file mode 100644 index 00000000000..031a5ef960e --- /dev/null +++ b/src/waveform/widgets/allshader/rgbstackedwaveformwidget.h @@ -0,0 +1,47 @@ +#pragma once + +#include "util/class.h" +#include "waveform/widgets/allshader/waveformwidget.h" + +class WaveformWidgetFactory; + +namespace allshader { +class RGBStackedWaveformWidget; +} + +class allshader::RGBStackedWaveformWidget final : public allshader::WaveformWidget { + Q_OBJECT + public: + WaveformWidgetType::Type getType() const override { + return WaveformWidgetType::AllShaderRGBStackedWaveform; + } + + static inline QString getWaveformWidgetName() { + return tr("RGB Stacked"); + } + static constexpr bool useOpenGl() { + return true; + } + static constexpr bool useOpenGles() { + return true; + } + static constexpr bool useOpenGLShaders() { + return true; + } + static constexpr bool useTextureForWaveform() { + return false; + } + static constexpr WaveformWidgetCategory category() { + return WaveformWidgetCategory::AllShader; + } + + protected: + void castToQWidget() override; + void paintEvent(QPaintEvent* event) override; + + private: + RGBStackedWaveformWidget(const QString& group, QWidget* parent); + friend class ::WaveformWidgetFactory; + + DISALLOW_COPY_AND_ASSIGN(RGBStackedWaveformWidget); +}; diff --git a/src/waveform/widgets/waveformwidgettype.h b/src/waveform/widgets/waveformwidgettype.h index 32f81e23d60..9c14429b01b 100644 --- a/src/waveform/widgets/waveformwidgettype.h +++ b/src/waveform/widgets/waveformwidgettype.h @@ -6,30 +6,31 @@ class WaveformWidgetType { // The order must not be changed because the waveforms are referenced // from the sorted preferences by a number. EmptyWaveform = 0, - SoftwareSimpleWaveform, // 1 TODO - SoftwareWaveform, // 2 Filtered - QtSimpleWaveform, // 3 Simple Qt - QtWaveform, // 4 Filtered Qt - GLSimpleWaveform, // 5 Simple GL - GLFilteredWaveform, // 6 Filtered GL - GLSLFilteredWaveform, // 7 Filtered GLSL - HSVWaveform, // 8 HSV - GLVSyncTest, // 9 VSync GL - RGBWaveform, // 10 RGB - GLRGBWaveform, // 11 RGB GL - GLSLRGBWaveform, // 12 RGB GLSL - QtVSyncTest, // 13 VSync Qt - QtHSVWaveform, // 14 HSV Qt - QtRGBWaveform, // 15 RGB Qt - GLSLRGBStackedWaveform, // 16 RGB Stacked - AllShaderRGBWaveform, // 17 RGB (all-shaders) - AllShaderLRRGBWaveform, // 18 L/R RGB (all-shaders) - AllShaderFilteredWaveform, // 19 Filtered (all-shaders) - AllShaderSimpleWaveform, // 20 Simple (all-shaders) - AllShaderHSVWaveform, // 21 HSV (all-shaders) - AllShaderTexturedFiltered, // 22 Filtered (textured) (all-shaders) - AllShaderTexturedRGB, // 23 RGB (textured) (all-shaders) - AllShaderTexturedStacked, // 24 Stacked (textured) (all-shaders) - Count_WaveformwidgetType // Also used as invalid value + SoftwareSimpleWaveform, // 1 TODO + SoftwareWaveform, // 2 Filtered + QtSimpleWaveform, // 3 Simple Qt + QtWaveform, // 4 Filtered Qt + GLSimpleWaveform, // 5 Simple GL + GLFilteredWaveform, // 6 Filtered GL + GLSLFilteredWaveform, // 7 Filtered GLSL + HSVWaveform, // 8 HSV + GLVSyncTest, // 9 VSync GL + RGBWaveform, // 10 RGB + GLRGBWaveform, // 11 RGB GL + GLSLRGBWaveform, // 12 RGB GLSL + QtVSyncTest, // 13 VSync Qt + QtHSVWaveform, // 14 HSV Qt + QtRGBWaveform, // 15 RGB Qt + GLSLRGBStackedWaveform, // 16 RGB Stacked + AllShaderRGBWaveform, // 17 RGB (all-shaders) + AllShaderLRRGBWaveform, // 18 L/R RGB (all-shaders) + AllShaderFilteredWaveform, // 19 Filtered (all-shaders) + AllShaderSimpleWaveform, // 20 Simple (all-shaders) + AllShaderHSVWaveform, // 21 HSV (all-shaders) + AllShaderTexturedFiltered, // 22 Filtered (textured) (all-shaders) + AllShaderTexturedRGB, // 23 RGB (textured) (all-shaders) + AllShaderTexturedStacked, // 24 Stacked (textured) (all-shaders) + AllShaderRGBStackedWaveform, // 26 Stacked (all-shaders) + Count_WaveformwidgetType // Also used as invalid value }; }; From 7ffa947e78f347ffd10857a0d4881d92a443bda4 Mon Sep 17 00:00:00 2001 From: m0dB Date: Sun, 12 May 2024 01:26:31 +0200 Subject: [PATCH 4/7] fix compilation (adding missing enum to switch) --- src/preferences/upgrade.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/preferences/upgrade.cpp b/src/preferences/upgrade.cpp index 15c24989712..9815ccdfcd9 100644 --- a/src/preferences/upgrade.cpp +++ b/src/preferences/upgrade.cpp @@ -44,6 +44,7 @@ WaveformWidgetType::Type upgradeToAllShaders(WaveformWidgetType::Type waveformTy case WWT::AllShaderRGBWaveform: case WWT::AllShaderLRRGBWaveform: case WWT::AllShaderFilteredWaveform: + case WWT::AllShaderRGBStackedWaveform: case WWT::AllShaderSimpleWaveform: case WWT::AllShaderHSVWaveform: case WWT::AllShaderTexturedFiltered: From e6a7d27c3523006327a02501d4b481a3e40eb2ea Mon Sep 17 00:00:00 2001 From: m0dB Date: Sun, 12 May 2024 01:55:41 +0200 Subject: [PATCH 5/7] moved deprecated waveform widgets and renderers to folder deprecrated and dont add to the preferences list --- CMakeLists.txt | 24 +++++++------- .../glslwaveformrenderersignal.cpp | 2 +- .../glslwaveformrenderersignal.h | 2 +- .../{ => deprecated}/glvsynctestrenderer.cpp | 2 +- .../{ => deprecated}/glvsynctestrenderer.h | 2 +- .../glwaveformrenderbackground.cpp | 2 +- .../glwaveformrenderbackground.h | 2 +- .../{ => deprecated}/glwaveformrenderer.h | 0 .../glwaveformrendererfilteredsignal.cpp | 4 +-- .../glwaveformrendererfilteredsignal.h | 2 +- .../glwaveformrendererrgb.cpp | 4 +-- .../{ => deprecated}/glwaveformrendererrgb.h | 0 .../glwaveformrenderersignal.h | 2 +- .../glwaveformrenderersimplesignal.cpp | 4 +-- .../glwaveformrenderersimplesignal.h | 0 src/waveform/waveformwidgetfactory.cpp | 32 +++++++++++++++---- src/waveform/waveformwidgetfactory.h | 1 - .../{ => deprecated}/glrgbwaveformwidget.cpp | 4 +-- .../{ => deprecated}/glrgbwaveformwidget.h | 2 +- .../glsimplewaveformwidget.cpp | 4 +-- .../{ => deprecated}/glsimplewaveformwidget.h | 2 +- .../{ => deprecated}/glslwaveformwidget.cpp | 4 +-- .../{ => deprecated}/glslwaveformwidget.h | 3 +- .../{ => deprecated}/glvsynctestwidget.cpp | 6 ++-- .../{ => deprecated}/glvsynctestwidget.h | 2 +- .../{ => deprecated}/glwaveformwidget.cpp | 6 ++-- .../{ => deprecated}/glwaveformwidget.h | 2 +- .../glwaveformwidgetabstract.cpp | 2 +- .../glwaveformwidgetabstract.h | 2 +- 29 files changed, 71 insertions(+), 53 deletions(-) rename src/waveform/renderers/{ => deprecated}/glslwaveformrenderersignal.cpp (99%) rename src/waveform/renderers/{ => deprecated}/glslwaveformrenderersignal.h (97%) rename src/waveform/renderers/{ => deprecated}/glvsynctestrenderer.cpp (98%) rename src/waveform/renderers/{ => deprecated}/glvsynctestrenderer.h (87%) rename src/waveform/renderers/{ => deprecated}/glwaveformrenderbackground.cpp (90%) rename src/waveform/renderers/{ => deprecated}/glwaveformrenderbackground.h (91%) rename src/waveform/renderers/{ => deprecated}/glwaveformrenderer.h (100%) rename src/waveform/renderers/{ => deprecated}/glwaveformrendererfilteredsignal.cpp (99%) rename src/waveform/renderers/{ => deprecated}/glwaveformrendererfilteredsignal.h (87%) rename src/waveform/renderers/{ => deprecated}/glwaveformrendererrgb.cpp (98%) rename src/waveform/renderers/{ => deprecated}/glwaveformrendererrgb.h (100%) rename src/waveform/renderers/{ => deprecated}/glwaveformrenderersignal.h (92%) rename src/waveform/renderers/{ => deprecated}/glwaveformrenderersimplesignal.cpp (97%) rename src/waveform/renderers/{ => deprecated}/glwaveformrenderersimplesignal.h (100%) rename src/waveform/widgets/{ => deprecated}/glrgbwaveformwidget.cpp (92%) rename src/waveform/widgets/{ => deprecated}/glrgbwaveformwidget.h (93%) rename src/waveform/widgets/{ => deprecated}/glsimplewaveformwidget.cpp (92%) rename src/waveform/widgets/{ => deprecated}/glsimplewaveformwidget.h (93%) rename src/waveform/widgets/{ => deprecated}/glslwaveformwidget.cpp (95%) rename src/waveform/widgets/{ => deprecated}/glslwaveformwidget.h (97%) rename src/waveform/widgets/{ => deprecated}/glvsynctestwidget.cpp (88%) rename src/waveform/widgets/{ => deprecated}/glvsynctestwidget.h (93%) rename src/waveform/widgets/{ => deprecated}/glwaveformwidget.cpp (88%) rename src/waveform/widgets/{ => deprecated}/glwaveformwidget.h (93%) rename src/waveform/widgets/{ => deprecated}/glwaveformwidgetabstract.cpp (84%) rename src/waveform/widgets/{ => deprecated}/glwaveformwidgetabstract.h (96%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9cbdf7ec663..a69a6d8731a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1206,12 +1206,12 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/util/workerthreadscheduler.cpp src/util/xml.cpp src/waveform/guitick.cpp - src/waveform/renderers/glslwaveformrenderersignal.cpp - src/waveform/renderers/glvsynctestrenderer.cpp - src/waveform/renderers/glwaveformrenderbackground.cpp - src/waveform/renderers/glwaveformrendererfilteredsignal.cpp - src/waveform/renderers/glwaveformrendererrgb.cpp - src/waveform/renderers/glwaveformrenderersimplesignal.cpp + src/waveform/renderers/deprecated/glslwaveformrenderersignal.cpp + src/waveform/renderers/deprecated/glvsynctestrenderer.cpp + src/waveform/renderers/deprecated/glwaveformrenderbackground.cpp + src/waveform/renderers/deprecated/glwaveformrendererfilteredsignal.cpp + src/waveform/renderers/deprecated/glwaveformrendererrgb.cpp + src/waveform/renderers/deprecated/glwaveformrenderersimplesignal.cpp src/waveform/renderers/waveformmark.cpp src/waveform/renderers/waveformmarkrange.cpp src/waveform/renderers/waveformmarkset.cpp @@ -1238,12 +1238,12 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/waveform/waveformmarklabel.cpp src/waveform/waveformwidgetfactory.cpp src/waveform/widgets/emptywaveformwidget.cpp - src/waveform/widgets/glrgbwaveformwidget.cpp - src/waveform/widgets/glsimplewaveformwidget.cpp - src/waveform/widgets/glslwaveformwidget.cpp - src/waveform/widgets/glvsynctestwidget.cpp - src/waveform/widgets/glwaveformwidget.cpp - src/waveform/widgets/glwaveformwidgetabstract.cpp + src/waveform/widgets/deprecated/glrgbwaveformwidget.cpp + src/waveform/widgets/deprecated/glsimplewaveformwidget.cpp + src/waveform/widgets/deprecated/glslwaveformwidget.cpp + src/waveform/widgets/deprecated/glvsynctestwidget.cpp + src/waveform/widgets/deprecated/glwaveformwidget.cpp + src/waveform/widgets/deprecated/glwaveformwidgetabstract.cpp src/waveform/widgets/hsvwaveformwidget.cpp src/waveform/widgets/rgbwaveformwidget.cpp src/waveform/widgets/softwarewaveformwidget.cpp diff --git a/src/waveform/renderers/glslwaveformrenderersignal.cpp b/src/waveform/renderers/deprecated/glslwaveformrenderersignal.cpp similarity index 99% rename from src/waveform/renderers/glslwaveformrenderersignal.cpp rename to src/waveform/renderers/deprecated/glslwaveformrenderersignal.cpp index 0855268ef7e..041fce775e5 100644 --- a/src/waveform/renderers/glslwaveformrenderersignal.cpp +++ b/src/waveform/renderers/deprecated/glslwaveformrenderersignal.cpp @@ -1,4 +1,4 @@ -#include "waveform/renderers/glslwaveformrenderersignal.h" +#include "waveform/renderers/deprecated/glslwaveformrenderersignal.h" #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) #ifdef MIXXX_USE_QOPENGL diff --git a/src/waveform/renderers/glslwaveformrenderersignal.h b/src/waveform/renderers/deprecated/glslwaveformrenderersignal.h similarity index 97% rename from src/waveform/renderers/glslwaveformrenderersignal.h rename to src/waveform/renderers/deprecated/glslwaveformrenderersignal.h index e4f84dc7432..0f1ff24c4d2 100644 --- a/src/waveform/renderers/glslwaveformrenderersignal.h +++ b/src/waveform/renderers/deprecated/glslwaveformrenderersignal.h @@ -1,6 +1,6 @@ #pragma once -#include "waveform/renderers/glwaveformrenderersignal.h" +#include "waveform/renderers/deprecated/glwaveformrenderersignal.h" #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) #include "track/track_decl.h" diff --git a/src/waveform/renderers/glvsynctestrenderer.cpp b/src/waveform/renderers/deprecated/glvsynctestrenderer.cpp similarity index 98% rename from src/waveform/renderers/glvsynctestrenderer.cpp rename to src/waveform/renderers/deprecated/glvsynctestrenderer.cpp index a1d1cb7da27..3f873fb7a16 100644 --- a/src/waveform/renderers/glvsynctestrenderer.cpp +++ b/src/waveform/renderers/deprecated/glvsynctestrenderer.cpp @@ -1,4 +1,4 @@ -#include "waveform/renderers/glvsynctestrenderer.h" +#include "waveform/renderers/deprecated/glvsynctestrenderer.h" #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) #include "util/performancetimer.h" diff --git a/src/waveform/renderers/glvsynctestrenderer.h b/src/waveform/renderers/deprecated/glvsynctestrenderer.h similarity index 87% rename from src/waveform/renderers/glvsynctestrenderer.h rename to src/waveform/renderers/deprecated/glvsynctestrenderer.h index ca5e264db72..ce3ec59858e 100644 --- a/src/waveform/renderers/glvsynctestrenderer.h +++ b/src/waveform/renderers/deprecated/glvsynctestrenderer.h @@ -1,6 +1,6 @@ #pragma once -#include "waveform/renderers/glwaveformrenderersignal.h" +#include "waveform/renderers/deprecated/glwaveformrenderersignal.h" #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) class GLVSyncTestRenderer : public GLWaveformRendererSignal { diff --git a/src/waveform/renderers/glwaveformrenderbackground.cpp b/src/waveform/renderers/deprecated/glwaveformrenderbackground.cpp similarity index 90% rename from src/waveform/renderers/glwaveformrenderbackground.cpp rename to src/waveform/renderers/deprecated/glwaveformrenderbackground.cpp index 0be777514de..88d63c68355 100644 --- a/src/waveform/renderers/glwaveformrenderbackground.cpp +++ b/src/waveform/renderers/deprecated/glwaveformrenderbackground.cpp @@ -1,4 +1,4 @@ -#include "waveform/renderers/glwaveformrenderbackground.h" +#include "waveform/renderers/deprecated/glwaveformrenderbackground.h" GLWaveformRenderBackground::GLWaveformRenderBackground( WaveformWidgetRenderer* waveformWidgetRenderer) diff --git a/src/waveform/renderers/glwaveformrenderbackground.h b/src/waveform/renderers/deprecated/glwaveformrenderbackground.h similarity index 91% rename from src/waveform/renderers/glwaveformrenderbackground.h rename to src/waveform/renderers/deprecated/glwaveformrenderbackground.h index ae58d82b7e2..299ec963fa2 100644 --- a/src/waveform/renderers/glwaveformrenderbackground.h +++ b/src/waveform/renderers/deprecated/glwaveformrenderbackground.h @@ -2,7 +2,7 @@ #include "waveform/renderers/waveformrenderbackground.h" #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) -#include "waveform/renderers/glwaveformrenderer.h" +#include "waveform/renderers/deprecated/glwaveformrenderer.h" #endif class GLWaveformRenderBackground : public WaveformRenderBackground diff --git a/src/waveform/renderers/glwaveformrenderer.h b/src/waveform/renderers/deprecated/glwaveformrenderer.h similarity index 100% rename from src/waveform/renderers/glwaveformrenderer.h rename to src/waveform/renderers/deprecated/glwaveformrenderer.h diff --git a/src/waveform/renderers/glwaveformrendererfilteredsignal.cpp b/src/waveform/renderers/deprecated/glwaveformrendererfilteredsignal.cpp similarity index 99% rename from src/waveform/renderers/glwaveformrendererfilteredsignal.cpp rename to src/waveform/renderers/deprecated/glwaveformrendererfilteredsignal.cpp index 56d7060c3a2..221b1514abd 100644 --- a/src/waveform/renderers/glwaveformrendererfilteredsignal.cpp +++ b/src/waveform/renderers/deprecated/glwaveformrendererfilteredsignal.cpp @@ -3,9 +3,9 @@ #include -#include "waveform/waveform.h" -#include "waveformwidgetrenderer.h" #include "util/math.h" +#include "waveform/renderers/waveformwidgetrenderer.h" +#include "waveform/waveform.h" GLWaveformRendererFilteredSignal::GLWaveformRendererFilteredSignal( WaveformWidgetRenderer* waveformWidgetRenderer) diff --git a/src/waveform/renderers/glwaveformrendererfilteredsignal.h b/src/waveform/renderers/deprecated/glwaveformrendererfilteredsignal.h similarity index 87% rename from src/waveform/renderers/glwaveformrendererfilteredsignal.h rename to src/waveform/renderers/deprecated/glwaveformrendererfilteredsignal.h index ac27667e9ea..25ca7689bbe 100644 --- a/src/waveform/renderers/glwaveformrendererfilteredsignal.h +++ b/src/waveform/renderers/deprecated/glwaveformrendererfilteredsignal.h @@ -1,6 +1,6 @@ #pragma once -#include "waveform/renderers/glwaveformrenderersignal.h" +#include "waveform/renderers/deprecated/glwaveformrenderersignal.h" #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) class QDomNode; diff --git a/src/waveform/renderers/glwaveformrendererrgb.cpp b/src/waveform/renderers/deprecated/glwaveformrendererrgb.cpp similarity index 98% rename from src/waveform/renderers/glwaveformrendererrgb.cpp rename to src/waveform/renderers/deprecated/glwaveformrendererrgb.cpp index 337468e0383..631027d4b68 100644 --- a/src/waveform/renderers/glwaveformrendererrgb.cpp +++ b/src/waveform/renderers/deprecated/glwaveformrendererrgb.cpp @@ -1,9 +1,9 @@ -#include "waveform/renderers/glwaveformrendererrgb.h" +#include "waveform/renderers/deprecated/glwaveformrendererrgb.h" #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) #include "util/math.h" +#include "waveform/renderers/waveformwidgetrenderer.h" #include "waveform/waveform.h" -#include "waveformwidgetrenderer.h" namespace { const float kHeightScaleFactor = 255.0f / sqrtf(255 * 255 * 3); diff --git a/src/waveform/renderers/glwaveformrendererrgb.h b/src/waveform/renderers/deprecated/glwaveformrendererrgb.h similarity index 100% rename from src/waveform/renderers/glwaveformrendererrgb.h rename to src/waveform/renderers/deprecated/glwaveformrendererrgb.h diff --git a/src/waveform/renderers/glwaveformrenderersignal.h b/src/waveform/renderers/deprecated/glwaveformrenderersignal.h similarity index 92% rename from src/waveform/renderers/glwaveformrenderersignal.h rename to src/waveform/renderers/deprecated/glwaveformrenderersignal.h index ac808d777cd..76532a12014 100644 --- a/src/waveform/renderers/glwaveformrenderersignal.h +++ b/src/waveform/renderers/deprecated/glwaveformrenderersignal.h @@ -1,6 +1,6 @@ #pragma once -#include "waveform/renderers/glwaveformrenderer.h" +#include "waveform/renderers/deprecated/glwaveformrenderer.h" #include "waveform/renderers/waveformrenderersignalbase.h" #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) diff --git a/src/waveform/renderers/glwaveformrenderersimplesignal.cpp b/src/waveform/renderers/deprecated/glwaveformrenderersimplesignal.cpp similarity index 97% rename from src/waveform/renderers/glwaveformrenderersimplesignal.cpp rename to src/waveform/renderers/deprecated/glwaveformrenderersimplesignal.cpp index d12920d53d1..4f05c25d058 100644 --- a/src/waveform/renderers/glwaveformrenderersimplesignal.cpp +++ b/src/waveform/renderers/deprecated/glwaveformrenderersimplesignal.cpp @@ -1,9 +1,9 @@ -#include "waveform/renderers/glwaveformrenderersimplesignal.h" +#include "waveform/renderers/deprecated/glwaveformrenderersimplesignal.h" #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) #include "util/math.h" +#include "waveform/renderers/waveformwidgetrenderer.h" #include "waveform/waveform.h" -#include "waveformwidgetrenderer.h" GLWaveformRendererSimpleSignal::GLWaveformRendererSimpleSignal( WaveformWidgetRenderer* waveformWidgetRenderer) diff --git a/src/waveform/renderers/glwaveformrenderersimplesignal.h b/src/waveform/renderers/deprecated/glwaveformrenderersimplesignal.h similarity index 100% rename from src/waveform/renderers/glwaveformrenderersimplesignal.h rename to src/waveform/renderers/deprecated/glwaveformrenderersimplesignal.h diff --git a/src/waveform/waveformwidgetfactory.cpp b/src/waveform/waveformwidgetfactory.cpp index 3027bb755aa..1dfde15822e 100644 --- a/src/waveform/waveformwidgetfactory.cpp +++ b/src/waveform/waveformwidgetfactory.cpp @@ -40,12 +40,12 @@ #include "waveform/widgets/qtvsynctestwidget.h" #include "waveform/widgets/qtwaveformwidget.h" #endif +#include "waveform/widgets/deprecated/glrgbwaveformwidget.h" +#include "waveform/widgets/deprecated/glsimplewaveformwidget.h" +#include "waveform/widgets/deprecated/glslwaveformwidget.h" +#include "waveform/widgets/deprecated/glvsynctestwidget.h" +#include "waveform/widgets/deprecated/glwaveformwidget.h" #include "waveform/widgets/emptywaveformwidget.h" -#include "waveform/widgets/glrgbwaveformwidget.h" -#include "waveform/widgets/glsimplewaveformwidget.h" -#include "waveform/widgets/glslwaveformwidget.h" -#include "waveform/widgets/glvsynctestwidget.h" -#include "waveform/widgets/glwaveformwidget.h" #include "waveform/widgets/hsvwaveformwidget.h" #include "waveform/widgets/rgbwaveformwidget.h" #include "waveform/widgets/softwarewaveformwidget.h" @@ -55,6 +55,26 @@ #include "widget/wwaveformviewer.h" namespace { +bool isDeprecated(WaveformWidgetType::Type t) { + switch (t) { + case WaveformWidgetType::GLRGBWaveform: + return true; + case WaveformWidgetType::GLSimpleWaveform: + return true; + case WaveformWidgetType::GLSLFilteredWaveform: + return true; + case WaveformWidgetType::GLSLRGBWaveform: + return true; + case WaveformWidgetType::GLSLRGBStackedWaveform: + return true; + case WaveformWidgetType::GLVSyncTest: + return true; + case WaveformWidgetType::GLFilteredWaveform: + return true; + default: + return false; + } +} // Returns true if the given waveform should be rendered. bool shouldRenderWaveform(WaveformWidgetAbstract* pWaveformWidget) { if (pWaveformWidget == nullptr || @@ -1063,7 +1083,7 @@ void WaveformWidgetFactory::evaluateWidgets() { continue; } - bool active = true; + bool active = !isDeprecated(static_cast(type)); if (isOpenGlAvailable()) { if (useOpenGles && !useOpenGl) { active = false; diff --git a/src/waveform/waveformwidgetfactory.h b/src/waveform/waveformwidgetfactory.h index 1c00cff50b6..aa2c1cccac8 100644 --- a/src/waveform/waveformwidgetfactory.h +++ b/src/waveform/waveformwidgetfactory.h @@ -98,7 +98,6 @@ class WaveformWidgetFactory : public QObject, public Singleton #include "moc_glvsynctestwidget.cpp" #include "util/performancetimer.h" -#include "waveform/renderers/glvsynctestrenderer.h" -#include "waveform/renderers/glwaveformrenderbackground.h" +#include "waveform/renderers/deprecated/glvsynctestrenderer.h" +#include "waveform/renderers/deprecated/glwaveformrenderbackground.h" GLVSyncTestWidget::GLVSyncTestWidget(const QString& group, QWidget* parent) : GLWaveformWidgetAbstract(group, parent) { diff --git a/src/waveform/widgets/glvsynctestwidget.h b/src/waveform/widgets/deprecated/glvsynctestwidget.h similarity index 93% rename from src/waveform/widgets/glvsynctestwidget.h rename to src/waveform/widgets/deprecated/glvsynctestwidget.h index 02c89bda488..3c9a8021cc0 100644 --- a/src/waveform/widgets/glvsynctestwidget.h +++ b/src/waveform/widgets/deprecated/glvsynctestwidget.h @@ -1,6 +1,6 @@ #pragma once -#include "waveform/widgets/glwaveformwidgetabstract.h" +#include "waveform/widgets/deprecated/glwaveformwidgetabstract.h" class GLVSyncTestWidget : public GLWaveformWidgetAbstract { Q_OBJECT diff --git a/src/waveform/widgets/glwaveformwidget.cpp b/src/waveform/widgets/deprecated/glwaveformwidget.cpp similarity index 88% rename from src/waveform/widgets/glwaveformwidget.cpp rename to src/waveform/widgets/deprecated/glwaveformwidget.cpp index e1eb08d3b0b..808ed48deaa 100644 --- a/src/waveform/widgets/glwaveformwidget.cpp +++ b/src/waveform/widgets/deprecated/glwaveformwidget.cpp @@ -1,11 +1,11 @@ -#include "waveform/widgets/glwaveformwidget.h" +#include "waveform/widgets/deprecated/glwaveformwidget.h" #include #include "moc_glwaveformwidget.cpp" #include "util/performancetimer.h" -#include "waveform/renderers/glwaveformrenderbackground.h" -#include "waveform/renderers/glwaveformrendererfilteredsignal.h" +#include "waveform/renderers/deprecated/glwaveformrenderbackground.h" +#include "waveform/renderers/deprecated/glwaveformrendererfilteredsignal.h" #include "waveform/renderers/waveformrenderbeat.h" #include "waveform/renderers/waveformrendererendoftrack.h" #include "waveform/renderers/waveformrendererpreroll.h" diff --git a/src/waveform/widgets/glwaveformwidget.h b/src/waveform/widgets/deprecated/glwaveformwidget.h similarity index 93% rename from src/waveform/widgets/glwaveformwidget.h rename to src/waveform/widgets/deprecated/glwaveformwidget.h index 77c01ff00c3..f82875e2a44 100644 --- a/src/waveform/widgets/glwaveformwidget.h +++ b/src/waveform/widgets/deprecated/glwaveformwidget.h @@ -1,6 +1,6 @@ #pragma once -#include "waveform/widgets/glwaveformwidgetabstract.h" +#include "waveform/widgets/deprecated/glwaveformwidgetabstract.h" class GLWaveformWidget : public GLWaveformWidgetAbstract { Q_OBJECT diff --git a/src/waveform/widgets/glwaveformwidgetabstract.cpp b/src/waveform/widgets/deprecated/glwaveformwidgetabstract.cpp similarity index 84% rename from src/waveform/widgets/glwaveformwidgetabstract.cpp rename to src/waveform/widgets/deprecated/glwaveformwidgetabstract.cpp index 62cbdb22194..2594349d4aa 100644 --- a/src/waveform/widgets/glwaveformwidgetabstract.cpp +++ b/src/waveform/widgets/deprecated/glwaveformwidgetabstract.cpp @@ -1,4 +1,4 @@ -#include "waveform/widgets/glwaveformwidgetabstract.h" +#include "waveform/widgets/deprecated/glwaveformwidgetabstract.h" #include #include diff --git a/src/waveform/widgets/glwaveformwidgetabstract.h b/src/waveform/widgets/deprecated/glwaveformwidgetabstract.h similarity index 96% rename from src/waveform/widgets/glwaveformwidgetabstract.h rename to src/waveform/widgets/deprecated/glwaveformwidgetabstract.h index 7d080918c13..337fa2c46f6 100644 --- a/src/waveform/widgets/glwaveformwidgetabstract.h +++ b/src/waveform/widgets/deprecated/glwaveformwidgetabstract.h @@ -1,6 +1,6 @@ #pragma once -#include "waveform/renderers/glwaveformrenderer.h" +#include "waveform/renderers/deprecated/glwaveformrenderer.h" #include "waveform/renderers/waveformrendererabstract.h" #include "waveform/widgets/waveformwidgetabstract.h" #include "widget/wglwidget.h" From 26920beee3f9c0c5cdc749a6e0da16e368eaea6b Mon Sep 17 00:00:00 2001 From: m0dB Date: Sun, 12 May 2024 01:57:10 +0200 Subject: [PATCH 6/7] renamed "Waveform data texture" to "high detail" --- src/waveform/waveformwidgetfactory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/waveform/waveformwidgetfactory.cpp b/src/waveform/waveformwidgetfactory.cpp index 1dfde15822e..4fc216b0589 100644 --- a/src/waveform/waveformwidgetfactory.cpp +++ b/src/waveform/waveformwidgetfactory.cpp @@ -1325,7 +1325,7 @@ QString WaveformWidgetFactory::buildWidgetDisplayName() const { } } if (WaveformT::useTextureForWaveform()) { - extras.push_back(QStringLiteral("Waveform data texture")); + extras.push_back(QStringLiteral("high detail")); } QString name = WaveformT::getWaveformWidgetName(); if (extras.isEmpty()) { From 40a3f843d2f5c2db472bd75fea17785274122aad Mon Sep 17 00:00:00 2001 From: m0dB Date: Mon, 20 May 2024 19:08:00 +0200 Subject: [PATCH 7/7] removed needless method --- src/waveform/renderers/waveformwidgetrenderer.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/waveform/renderers/waveformwidgetrenderer.h b/src/waveform/renderers/waveformwidgetrenderer.h index a13f76cc0b9..47cd21b67a6 100644 --- a/src/waveform/renderers/waveformwidgetrenderer.h +++ b/src/waveform/renderers/waveformwidgetrenderer.h @@ -170,13 +170,6 @@ class WaveformWidgetRenderer { return renderer; } - template - inline T_Renderer* addRenderer(T_Arg arg) { - T_Renderer* renderer = new T_Renderer(this, arg); - m_rendererStack.push_back(renderer); - return renderer; - } - void setTrack(TrackPointer track); void setMarkPositions(const QList& markPositions) { m_markPositions = markPositions;