Skip to content
Snippets Groups Projects
Commit e51e03e4 authored by SeeLook's avatar SeeLook
Browse files

Stop pitch detection when app is going background, restore when backs, Tsound...

Stop pitch detection when app is going background, restore when backs, Tsound - redirect isStopped of the sniffer.
parent 1acd5b07
No related branches found
No related tags found
No related merge requests found
1.???
- added notifications about too hi/low input volume
- improved look of sound views, better fit to high DPI screens
ANDROID
- reduced paint operations, application works even 2-4 times faster
- volume settings and pitch preview can be invoked with volume keys
- stop pitch detection when app is going background, restore when backs
BUGS FIXES
- other small fixes
......
......@@ -275,6 +275,11 @@ bool Tsound::isSnifferPaused() {
}
bool Tsound::isSniferStopped() {
return sniffer ? sniffer->isStoped() : true;
}
void Tsound::restoreAfterAnswer() {
m_pitchView->setBgColor(Qt::transparent);
m_pitchView->setDisabled(true);
......
......@@ -84,6 +84,7 @@ public:
void pauseSinffing();
void unPauseSniffing();
bool isSnifferPaused();
bool isSniferStopped();
/** Prepares sound to exam.
* Given notes in params are level range notes and are put to sniffer ambitus. */
......
......@@ -82,10 +82,13 @@ void noteToKey(Tnote& n, TkeySignature k) {
QNetworkAccessManager nam;
}
TtouchMessage *m_touchMessage;
static TtouchMessage *m_touchMessage;
static bool m_isAppActive = true; /**< Whether Nootka is active (displayed) or suspended (and/or screen is off) */
static bool m_wasPitchEnabled = false; /**< Stores state of pitch detection when Nootka becomes inactive screen is locked (off) */
#endif
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
m_examResults(0),
......@@ -196,6 +199,24 @@ MainWindow::MainWindow(QWidget *parent) :
connect(m_pitchView, &TpitchView::lowPCMvolume, this, &MainWindow::pcmStatusMessage);
connect(m_pitchView, &TpitchView::hiPCMvolume, this, &MainWindow::pcmStatusMessage);
#if defined (Q_OS_ANDROID)
connect(qApp, &QGuiApplication::applicationStateChanged, [=](Qt::ApplicationState state){
if (state == Qt::ApplicationActive) { // Nootka backs to live
if (!m_isAppActive) { // restore pitch detection state
if (m_wasPitchEnabled)
m_sound->go();
m_isAppActive = true;
}
} else { // Nootka goes to background
if (m_isAppActive) { // when it was active, store pitch detection state
m_wasPitchEnabled = !(m_sound->isSniferStopped() || m_sound->isSnifferPaused());
m_isAppActive = false;
m_sound->wait();
}
}
});
#endif
qApp->installEventFilter(this);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment