diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e7a3db6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,31 @@ + +language: cpp +os: linux +sudo: false +dist: trusty +compiler: + - gcc + - clang + +cache: + directories: + - ~/.ccache + - qt5 + +install: + - mkdir -p qt5 + - if [ ! -d qt5/.git ] ; then rm qt5 -Rf ; git clone --branch=5.10 git://code.qt.io/qt/qt5.git ; fi + - pushd qt5 + - if [ ! -d qtbase/.git ] ; then perl init-repository --module-subset=qtbase,qtimageformats,qtmultimedia,qttools ; fi + - if [ ! -f config.summary ] ; then ./configure -prefix `pwd`/build -opensource -confirm-license -nomake examples -nomake tests ; fi + - if [ ! -d build ] ; then make -j2 > /dev/null && make install ; fi + - popd + - ccache -s + +script: + - mkdir -p build + - pushd build + - ../qt5/build/bin/qmake CONFIG+=ccache .. -config release + - make -j2 + - make install + - popd diff --git a/osciwidget.cpp b/osciwidget.cpp index 6a049eb..9193440 100644 --- a/osciwidget.cpp +++ b/osciwidget.cpp @@ -47,6 +47,8 @@ void OsciWidget::renderSamples(const SamplePair *begin, const SamplePair *end) { m_callbacksCounter++; + m_samplesCounter += std::distance(begin, end); + m_buffer.insert(m_buffer.end(), begin, end); } @@ -57,9 +59,10 @@ void OsciWidget::paintEvent(QPaintEvent *event) m_frameCounter++; if (m_statsTimer.hasExpired(1000)) { - emit statusUpdate(QString("%0FPS (%1 audio callbacks)").arg(m_frameCounter).arg(m_callbacksCounter)); + emit statusUpdate(QString("%0FPS (%1 callbacks, %2 samples, %3 avg per callback)").arg(m_frameCounter).arg(m_callbacksCounter).arg(m_samplesCounter).arg(m_callbacksCounter>0?m_samplesCounter/m_callbacksCounter:0)); m_frameCounter = 0; m_callbacksCounter = 0; + m_samplesCounter = 0; m_statsTimer.restart(); } @@ -73,7 +76,10 @@ void OsciWidget::updateFrameBuffer() if(m_buffer.empty()) return; if (m_pixmap.size() != size()) + { m_pixmap = QPixmap(size()); + m_pixmap.fill(Qt::black); + } QPainter painter(&m_pixmap); diff --git a/osciwidget.h b/osciwidget.h index 9403099..7b32068 100644 --- a/osciwidget.h +++ b/osciwidget.h @@ -50,7 +50,7 @@ private: std::vector m_buffer; - int m_frameCounter{0}, m_callbacksCounter{0}; + int m_frameCounter{0}, m_callbacksCounter{0}, m_samplesCounter{0}; QElapsedTimer m_statsTimer; int m_redrawTimerId;