]> git.sesse.net Git - nageru/blobdiff - glwidget.cpp
Add the beginnings of a very simple VU meter, based on libebur128.
[nageru] / glwidget.cpp
index 3482a13391609c049869650d7aadb32481cb94ec..2118ffe1c6dff368cc9b30604cead5b8af8bf7d0 100644 (file)
@@ -3,6 +3,7 @@
 #include <qtextstream.h>  // Needs to come before egl.h.
 #include <qcursor.h>  // Needs to come before egl.h.
 #include <qcoreevent.h>  // Needs to come before egl.h.
+#include <qevent.h>  // Needs to come before egl.h.
 #include <epoxy/gl.h>
 #include <epoxy/egl.h>
 #include <QSurfaceFormat>
@@ -17,6 +18,7 @@
 #include "context.h"
 #include "mixer.h"
 #include "ref_counted_gl_sync.h"
+#include "vumeter.h"
 
 class MainWindow;
 class QSurface;
@@ -46,6 +48,9 @@ void GLWidget::initializeGL()
        static std::once_flag flag;
        std::call_once(flag, [this]{
                global_mixer = new Mixer(QGLFormat::toSurfaceFormat(format()));
+               global_mixer->set_audio_level_callback([this](float level){
+                       global_vu_meter->set_level(level);
+               });
                global_mixer->start();
        });
        global_mixer->set_frame_ready_callback(output, [this]{