diff options
Diffstat (limited to 'tderadio3/src/frequencyseekhelper.cpp')
-rw-r--r-- | tderadio3/src/frequencyseekhelper.cpp | 142 |
1 files changed, 0 insertions, 142 deletions
diff --git a/tderadio3/src/frequencyseekhelper.cpp b/tderadio3/src/frequencyseekhelper.cpp deleted file mode 100644 index 1c24329..0000000 --- a/tderadio3/src/frequencyseekhelper.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/*************************************************************************** - frequencyseekhelper.cpp - description - ------------------- - begin : Fre Mai 9 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "include/frequencyseekhelper.h" -#include <tqtimer.h> - -FrequencySeekHelper::FrequencySeekHelper(ISeekRadio &parent) - : SeekHelper(parent) -{ - m_timer = new TQTimer(this); - TQObject::connect (m_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(step())); -} - - -FrequencySeekHelper::~FrequencySeekHelper() -{ - delete m_timer; -} - - -bool FrequencySeekHelper::connectI (Interface *i) -{ - bool a = SeekHelper::connectI(i); - bool b = IFrequencyRadioClient::connectI(i); - return a || b; -} - - -bool FrequencySeekHelper::disconnectI(Interface *i) -{ - bool a = SeekHelper::disconnectI(i); - bool b = IFrequencyRadioClient::disconnectI(i); - return a || b; -} - - -void FrequencySeekHelper::start(const SoundStreamID &id, direction_t dir) -{ - SeekHelper::start(id, dir); - m_bestFrequency = 0; -} - - -void FrequencySeekHelper::abort() -{ - m_timer->stop(); - m_bestFrequency = 0; -} - - -bool FrequencySeekHelper::nextSeekStep() -{ - float f = queryFrequency(); - f += (m_direction == up ? 1 : -1) * queryScanStep(); - - bool bounds = false; - if (f > queryMaxFrequency()) { - f = queryMaxFrequency(); - bounds = true; - } - if (f < queryMinFrequency()) { - f = queryMinFrequency(); - bounds = true; - } - - if (sendFrequency(f) > 0) { - if (!bounds) { - m_timer->start (50, true); - return true; - } else { - return false; - } - } else { - return false; - } -} - - -bool FrequencySeekHelper::bestFound() const -{ - return m_bestFrequency > 0; -} - - -void FrequencySeekHelper::rememberBest() -{ - m_bestFrequency = m_currentFrequency; -} - - -void FrequencySeekHelper::getData() -{ - m_oldSignal = m_currentSignal; - m_oldFrequency = m_currentFrequency; - - querySignalQuality(m_SoundStreamID, m_currentSignal); - queryHasGoodQuality(m_SoundStreamID, m_goodSignal); - m_currentFrequency = queryFrequency(); -} - - -bool FrequencySeekHelper::isBetter() const -{ - return m_currentSignal > m_oldSignal; -} - - -bool FrequencySeekHelper::isWorse() const -{ - return m_currentSignal < m_oldSignal; -} - - -bool FrequencySeekHelper::isGood() const -{ - return m_goodSignal; -} - - -void FrequencySeekHelper::applyBest() -{ - sendFrequency( (m_bestFrequency + m_currentFrequency) / 2); -} - - - - -#include "frequencyseekhelper.moc" |