diff --git a/changes b/changes
index fdef2c5aec8023b1d5d9f5a65fa7317fbed1170f..08d2f22dec5f9ae72043c2ece4d1f33027c2648e 100644
--- a/changes
+++ b/changes
@@ -1,8 +1,12 @@
1.1.7 rc2
+ - improvements/fixes related to low latency and real-time audio
+ - updated Qt libraries to the latest version in Windows installer
BUGS FIXES
- changed all static font sizes to system related sizes
- proper clef rendering in question tips
- proper re-sampling when rate is bigger than 48000
+ - avoiding multiple calls of status messages for better performance
+ - fixed Debian package dependencies, Ubuntu 14.04 is supported now
1.1.6 rc1
- new, advanced settings for pitch detection
diff --git a/src/libs/core/tprecisetimer.h b/src/libs/core/tprecisetimer.h
new file mode 100644
index 0000000000000000000000000000000000000000..948dae36dea39853ca0db840dce9f4a507d79e97
--- /dev/null
+++ b/src/libs/core/tprecisetimer.h
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * Copyright (C) 2015 by Tomasz Bojczuk *
+ * tomaszbojczuk@gmail.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. *
+ ***************************************************************************/
+
+#ifndef TPRECISETIMER_H
+#define TPRECISETIMER_H
+
+#include <QTimer>
+
+
+/**
+ * This is QTimer with type set to @p Qt::PreciseTimer
+ */
+class TpreciseTimer : public QTimer {
+
+public:
+ explicit TpreciseTimer(QObject* parent = 0) : QTimer(parent) {
+ setTimerType(Qt::PreciseTimer);
+ }
+};
+
+#endif // TPRECISETIMER_H
diff --git a/src/libs/sound/trtaudioout.cpp b/src/libs/sound/trtaudioout.cpp
index d231f2fdb589f0b5c660cca9e4e576cd65613e7d..c08dd9f80764c60841fa54748efe57c4ee0baba2 100755
--- a/src/libs/sound/trtaudioout.cpp
+++ b/src/libs/sound/trtaudioout.cpp
@@ -169,7 +169,7 @@ void TaudioOUT::setAudioOutParams() {
void TaudioOUT::streamOpenedSlot() {
- m_maxCBloops = (outRate() * 2) / bufferFrames() - outRate() / 441;
+ m_maxCBloops = (outRate() * 1.6) / bufferFrames();
}
diff --git a/src/libs/sound/tsound.cpp b/src/libs/sound/tsound.cpp
index 079ef8ecfca44e7e60f0df5407b59ba899ef0b03..1d8630b42441fba21d28ac56d46198e7f95ae84f 100755
--- a/src/libs/sound/tsound.cpp
+++ b/src/libs/sound/tsound.cpp
@@ -23,8 +23,8 @@
#include <tinitcorelib.h>
#include <taudioparams.h>
#include <music/tmelody.h>
+#include <tprecisetimer.h>
#include <QPushButton>
-#include <QTimer>
#include <QDebug>
@@ -82,7 +82,8 @@ void Tsound::playMelody(Tmelody* mel) {
}
m_melodyNoteIndex = 0;
m_playedMelody = mel;
- QTimer::singleShot(10, this, SLOT(playMelodySlot()));
+// TpreciseTimer::singleShot(10, this, SLOT(playMelodySlot()));
+ playMelodySlot();
}
@@ -352,7 +353,7 @@ void Tsound::playingFinishedSlot() {
void Tsound::playMelodySlot() {
if (m_melodyNoteIndex > -1 && m_melodyNoteIndex < m_playedMelody->length()) {
play(m_playedMelody->note(m_melodyNoteIndex)->p());
- QTimer::singleShot(60000 / m_playedMelody->tempo(), this, SLOT(playMelodySlot()));
+ TpreciseTimer::singleShot(60000 / m_playedMelody->tempo(), this, SLOT(playMelodySlot()));
m_melodyNoteIndex++;
} else {
m_melodyNoteIndex = -1;
diff --git a/src/score/tmainscore.cpp b/src/score/tmainscore.cpp
index 6a9bf52cc44960b24fdf434cf4c06cccf14f30b4..c2ee2d2c7ea923dde490de8555cea90ed76245cc 100644
--- a/src/score/tmainscore.cpp
+++ b/src/score/tmainscore.cpp
@@ -269,8 +269,8 @@ void TmainScore::playScore() {
return;
m_scoreIsPlayed = true;
m_playTimer = new QTimer(this);
+ m_playTimer->setTimerType(Qt::PreciseTimer);
connect(m_playTimer, SIGNAL(timeout()), this, SLOT(playSlot()));
- m_playTimer->start(60000 / Tcore::gl()->S->tempo);
m_playedIndex = currentIndex() - 1;
playSlot();
}
@@ -776,6 +776,8 @@ void TmainScore::playSlot() {
// by emitting that signal note is played and shown on the guitar
emit noteWasChanged(m_playedIndex % staff()->maxNoteCount(),
*currentStaff()->getNote(m_playedIndex % staff()->maxNoteCount()));
+ if (!m_playTimer->isActive()) // timer is started here to skip out stream initialization delay
+ m_playTimer->start(60000 / Tcore::gl()->S->tempo);
} else
emit playbackFinished();
}