bool PathFinderMovementGenerator::calculate(float destX, float destY, float destZ, bool forceDest) { if (!SkyFire::IsValidMapCoord(destX, destY, destZ) || !SkyFire::IsValidMapCoord(m_sourceUnit->GetPositionX(), m_sourceUnit->GetPositionY(), m_sourceUnit->GetPositionZ())) return false; Vector3 oldDest = getEndPosition(); Vector3 dest(destX, destY, destZ); setEndPosition(dest); float x, y, z; m_sourceUnit->GetPosition(x, y, z); Vector3 start(x, y, z); setStartPosition(start); m_forceDestination = forceDest; sLog->outDebug(LOG_FILTER_MAPS, "++ PathFinderMovementGenerator::calculate() for %u \n", m_sourceUnit->GetGUIDLow()); // make sure navMesh works - we can run on map w/o mmap // check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?) if (!m_navMesh || !m_navMeshQuery || m_sourceUnit->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING) || !HaveTile(start) || !HaveTile(dest)) { BuildShortcut(); m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); return true; } updateFilter(); // check if destination moved - if not we can optimize something here // we are following old, precalculated path? float dist = m_sourceUnit->GetObjectSize(); if (inRange(oldDest, dest, dist, dist) && m_pathPoints.size() > 2) { // our target is not moving - we just coming closer // we are moving on precalculated path - enjoy the ride sLog->outStaticDebug("++ PathFinderMovementGenerator::calculate:: precalculated path\n"); m_pathPoints.erase(m_pathPoints.begin()); return false; } else { // target moved, so we need to update the poly path m_navMeshLock->acquire_read(); BuildPolyPath(start, dest); m_navMeshLock->release(); return true; } }
ContactsInner::ContactsInner() : _contacts(&App::main()->contactsList()), _sel(0), _filteredSel(-1), _mouseSel(false) { _filter = qsl("a"); updateFilter(); for (DialogRow *r = _contacts->list.begin; r != _contacts->list.end; r = r->next) { r->attached = 0; } connect(App::main(), SIGNAL(dialogRowReplaced(DialogRow *, DialogRow *)), this, SLOT(onDialogRowReplaced(DialogRow *, DialogRow *))); connect(App::main(), SIGNAL(peerUpdated(PeerData*)), this, SLOT(peerUpdated(PeerData *))); connect(App::main(), SIGNAL(peerNameChanged(PeerData *, const PeerData::Names &, const PeerData::NameFirstChars &)), this, SLOT(peerUpdated(PeerData *))); connect(App::main(), SIGNAL(peerPhotoChanged(PeerData *)), this, SLOT(peerUpdated(PeerData *))); }
/***************************************************** ** ** AtlasLogic --- setFilterConditions ** ******************************************************/ void AtlasLogic::setFilterConditions( wxString f, wxString c, const int& m ) { filter = AllTrim( f ); filter.Replace( wxT( "*" ), wxT( "%" )); //filter.Replace( wxT( "'" ), wxT( "\"" )); filter.Replace( wxT( "?" ), wxT( "_" )); country = c; mode = m; assert( sharedSection ); sharedSection->fetchOffset = 0; updateFilter(); }
bool PathInfo::Update(const float destX, const float destY, const float destZ, bool useStraightPath, bool forceDest) { PathNode newDest(destX, destY, destZ); PathNode oldDest = getEndPosition(); setEndPosition(newDest); float x, y, z; m_sourceUnit->GetPosition(x, y, z); PathNode newStart(x, y, z); PathNode oldStart = getStartPosition(); setStartPosition(newStart); m_useStraightPath = useStraightPath; m_forceDestination = forceDest; DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathInfo::Update() for %u \n", m_sourceUnit->GetGUID()); // make sure navMesh works - we can run on map w/o mmap if (!m_navMesh || !m_navMeshQuery || !HaveTiles(newDest) || m_sourceUnit->hasUnitState(UNIT_STAT_IGNORE_PATHFINDING)) { BuildShortcut(); m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); return true; } updateFilter(); // check if destination moved - if not we can optimize something here // we are following old, precalculated path? float dist = m_sourceUnit->GetObjectBoundingRadius(); if (inRange(oldDest, newDest, dist, dist) && m_pathPoints.size() > 2) { // our target is not moving - we just coming closer // we are moving on precalculated path - enjoy the ride DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathInfo::Update:: precalculated path\n"); m_pathPoints.crop(1, 0); setNextPosition(m_pathPoints[1]); return false; } else { // target moved, so we need to update the poly path BuildPolyPath(newStart, newDest); return true; } }
SearchFilter::SearchFilter(QWidget *parent, const char *name) : QWidget(parent) { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QHBoxLayout *box = new QHBoxLayout(this); mRegExp = new QComboBox(this); box->addWidget(mRegExp); mRegExp->setLineEdit(new MyLineEdit(mRegExp)); mRegExp->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); mRegExp->setEditable(true); connect(mRegExp->lineEdit(), SIGNAL(enterPressed()), SLOT(updateFilter())); box->addWidget(new QLabel(tr("Size:"))); mSize = new QComboBox(this); box->addWidget(mSize); mSize->setLineEdit(new MyLineEdit(mSize)); mSize->setEditable(true); connect(mSize->lineEdit(), SIGNAL(enterPressed()), SLOT(updateFilter())); box->addWidget(new QLabel(tr("Bitrate:"))); mBitrate = new QComboBox(this); box->addWidget(mBitrate); mBitrate->setLineEdit(new MyLineEdit(mBitrate)); mBitrate->setEditable(true); connect(mBitrate->lineEdit(), SIGNAL(enterPressed()), SLOT(updateFilter())); mFreeSlot = new QCheckBox(tr("Free slot"), this); box->addWidget(mFreeSlot); connect(mFreeSlot, SIGNAL(toggled(bool)), SLOT(updateFilter())); mInvertMatch = new QCheckBox(tr("Invert match"), this); box->addWidget(mInvertMatch); connect(mInvertMatch, SIGNAL(toggled(bool)), SLOT(updateFilter())); updateFilter(); }
RecordsFilterModel::RecordsFilterModel(TagFilter* filter, QObject* parent) : ListFilterModel(parent), filter_(filter) { connect(filter_, SIGNAL(modeChanged(TagFilter::Mode)), SLOT(updateFilter())); connect(filter_, SIGNAL(tagAdded(QString,TagFilter::Action)), SLOT(updateFilter())); connect(filter_, SIGNAL(tagChanged(QString,TagFilter::Action)), SLOT(updateFilter())); connect(filter_, SIGNAL(tagRemoved(QString)), SLOT(updateFilter())); connect(filter_, SIGNAL(filterEmpty()), SLOT(updateFilter())); }
void HistoryCompleter::init() { setPopup(new HistoryCompletionView()); // we want to complete against our own faked role setCompletionRole(HistoryCompletionModel::HistoryCompletionRole); // and since we fake our completion role, we can take // advantage of the sorted-model optimizations in QCompleter setCaseSensitivity(Qt::CaseSensitive); setModelSorting(QCompleter::CaseSensitivelySortedModel); m_filterTimer.setSingleShot(true); connect(&m_filterTimer, SIGNAL(timeout()), this, SLOT(updateFilter())); }
void DiskBrowser::setNameFilters(const QString &filters) { disconnect(filter, SIGNAL(currentIndexChanged(int)), this, SLOT(updateFilter())); filter->clear(); string filterData = filters.toUtf8().constData(); lstring filterPart; filterPart.split(";;", filterData); for(unsigned i = 0; i < filterPart.size(); i++) { filter->addItem(utf8() << filterPart[i]); } connect(filter, SIGNAL(currentIndexChanged(int)), this, SLOT(updateFilter())); updateFilter(); }
bool PathFinder::calculate(float destX, float destY, float destZ, bool forceDest) { Vector3 oldDest = getEndPosition(); Vector3 dest(destX, destY, destZ); setEndPosition(dest); float x, y, z; m_sourceUnit->GetPosition(x, y, z); Vector3 start(x, y, z); setStartPosition(start); m_forceDestination = forceDest; DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathFinder::calculate() for %u \n", m_sourceUnit->GetGUIDLow()); // make sure navMesh works - we can run on map w/o mmap // check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?) if (!m_navMesh || !m_navMeshQuery || m_sourceUnit->hasUnitState(UNIT_STAT_IGNORE_PATHFINDING) || !HaveTile(start) || !HaveTile(dest)) { BuildShortcut(); m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); return true; } updateFilter(); // check if destination moved - if not we can optimize something here // we are following old, precalculated path? float dist = m_sourceUnit->GetObjectBoundingRadius(); if (inRange(oldDest, dest, dist, dist) && m_pathPoints.size() > 2) { // our target is not moving - we just coming closer // we are moving on precalculated path - enjoy the ride DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathFinder::calculate:: precalculated path\n"); m_pathPoints.erase(m_pathPoints.begin()); return false; } else { // target moved, so we need to update the poly path ReadGuard Guard(MMAP::MMapFactory::createOrGetMMapManager()->GetLock(m_sourceUnit->GetMapId())); BuildPolyPath(start, dest); return true; } }
bool CVADiodeLadderFilter::prepareForPlay(float fs) { // this flushes all storage registers in filters including feedback register reset(); m_nSampleRate = fs; m_LPF1.m_dSampleRate = m_nSampleRate; m_LPF2.m_dSampleRate = m_nSampleRate; m_LPF3.m_dSampleRate = m_nSampleRate; m_LPF4.m_dSampleRate = m_nSampleRate; // set the initial coeffs updateFilter(); return true; }
TreeWidget::TreeWidget(const ProgramLoader& programLoader, QWidget *parent) : QWidget(parent) { setAcceptDrops(true); view = new TreeView(*this); model = new TreeModel("Tree", programLoader, view, this); view->setModel(model); delegate = new HTMLDelegate(this); view->setModel(model); view->setItemDelegate(delegate); setColumnsWidths(); filterWidget = new FilterWidget(this); statusBar = new QStatusBar(this); //Layout QGridLayout *layout = new QGridLayout; layout->addWidget(view, 0, 0, 1, 1); layout->addWidget(filterWidget, 1, 0, 1, 1); layout->addWidget(statusBar, 2, 0, 1, 1); layout->setContentsMargins(0,0,0,0); setLayout(layout); connect(view, SIGNAL(selected(QModelIndex)), model, SLOT(updateCurrent(QModelIndex))); connect(view, SIGNAL(expanded(QModelIndex)), model, SLOT(requestExpansion(QModelIndex))); connect(view, SIGNAL(selected(QModelIndex)), this, SLOT(updatePath(QModelIndex))); connect(view, SIGNAL(selected(QModelIndex)), this, SLOT(updatePosition(QModelIndex))); connect(model, SIGNAL(parsingStarted(QModelIndex)), this, SLOT(onParsingStarted(QModelIndex))); connect(model, SIGNAL(parsingFinished(QModelIndex)), this, SLOT(onParsingFinished(QModelIndex))); connect(model, SIGNAL(exploringStarted(QModelIndex, qint64)), this, SLOT(onExploringStarted(QModelIndex, qint64))); connect(model, SIGNAL(exploringFinished(QModelIndex, qint64)), this, SLOT(onExploringFinished(QModelIndex, qint64))); connect(model, SIGNAL(filterChanged(QString)), filterWidget, SLOT(changeText(QString))); connect(filterWidget, SIGNAL(textChanged(QString)), model, SLOT(updateFilter(QString))); connect(model, SIGNAL(invalidFilter()), filterWidget, SLOT(invalidateText())); // in the constructor view->setContextMenuPolicy(Qt::CustomContextMenu); connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayMenu(QPoint))); }
CountrySelectInner::CountrySelectInner() : TWidget() , _rowHeight(st::countryRowHeight) , _sel(0) , _mouseSel(false) { setAttribute(Qt::WA_OpaquePaintEvent); CountriesByISO2::const_iterator l = _countriesByISO2.constFind(lastValidISO); bool seenLastValid = false; int already = countriesAll.size(); countriesByLetter.clear(); const CountryInfo *lastValid = (l == _countriesByISO2.cend()) ? 0 : (*l); for (int i = 0; i < countriesCount; ++i) { const CountryInfo *ins = lastValid ? (i ? (countries + i - (seenLastValid ? 0 : 1)) : lastValid) : (countries + i); if (lastValid && i && ins == lastValid) { seenLastValid = true; ++ins; } if (already > i) { countriesAll[i] = ins; } else { countriesAll.push_back(ins); } QStringList namesList = QString::fromUtf8(ins->name).toLower().split(QRegularExpression("[\\s\\-]"), QString::SkipEmptyParts); CountryNames &names(countriesNames[i]); int l = namesList.size(); names.resize(0); names.reserve(l); for (int j = 0, l = namesList.size(); j < l; ++j) { QString name = namesList[j].trimmed(); if (!name.length()) continue; QChar ch = name[0]; CountriesIds &v(countriesByLetter[ch]); if (v.isEmpty() || v.back() != i) { v.push_back(i); } names.push_back(name); } } _filter = qsl("a"); updateFilter(); }
void RedisConnectionsManager::AddConnection(ConnectionBridge * c) { //add connection to internal container connections.push_back(c); //add connection to view container RedisServerItem * item = new RedisServerItem(c); QObject::connect(item, SIGNAL(databasesLoaded()), this, SLOT(updateFilter())); MainWin * errorViewForm = (MainWin *) parent(); QObject::connect(item, SIGNAL(error(QString)), errorViewForm, SLOT(OnError(QString))); QObject::connect(item, SIGNAL(unlockUI()), errorViewForm, SLOT(OnUIUnlock())); QObject::connect(item, SIGNAL(statusMessage(QString)), errorViewForm, SLOT(OnStatusMessage(QString))); appendRow(item); //mark settings as unsaved connectionSettingsChanged = true; }
void ResamplingNode::updateSettings() { sourceBufferSampleRate = settings.sampleRate; settings.sampleRate = targetSampleRate; if (getNumInputs() > 0) tempBuffer->setSize(getNumInputs(), TEMP_BUFFER_WIDTH); ratio = sourceBufferSampleRate / targetSampleRate; for (int i = 0; i < channels.size(); i++) { channels[i]->sampleRate = targetSampleRate; } updateFilter(); }
void RequestsTableWidget::setStateSelected(int state, QDate date, int docId) { QModelIndexList rows = m_view->selectionModel()->selectedRows(); if (rows.isEmpty()) { return; } QListIterator<QModelIndex> iter(rows); while(iter.hasNext()) { QModelIndex index = iter.next(); Request req(index.sibling(index.row(), RequestsModel::IdCol).data().toInt()); if (!req.setState(state, date, docId)) { QMessageBox::critical(this, tr("State"), req.lastError()); } } updateFilter(); }
void EthernetChannel::listen(const FaceCreatedCallback& onFaceCreated, const FaceCreationFailedCallback& onFaceCreationFailed) { if (isListening()) { NFD_LOG_CHAN_WARN("Already listening"); return; } m_isListening = true; try { m_pcap.activate(DLT_EN10MB); m_socket.assign(m_pcap.getFd()); } catch (const PcapHelper::Error& e) { NDN_THROW_NESTED(Error(e.what())); } updateFilter(); asyncRead(onFaceCreated, onFaceCreationFailed); NFD_LOG_CHAN_DEBUG("Started listening"); }
void Raster::upload(gl::Context& context, uint32_t unit) { if (!images.empty() && !texture) { texture = context.createTexture(); context.activeTexture = unit; context.texture[unit] = *texture; updateFilter(); #ifndef GL_ES_VERSION_2_0 MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, images.size())); #endif MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); GLint level = 0; for (auto& img : images) { MBGL_CHECK_ERROR(glTexImage2D( GL_TEXTURE_2D, level++, GL_RGBA, static_cast<GLsizei>(img.width), static_cast<GLsizei>(img.height), 0, GL_RGBA, GL_UNSIGNED_BYTE, img.data.get())); } size = { { images.front().width, images.front().height } }; images.clear(); images.shrink_to_fit(); } }
TapParameterDialog::TapParameterDialog(QWidget &parent, CaptureFile &cf, int help_topic) : WiresharkDialog(parent, cf), ui(new Ui::TapParameterDialog), help_topic_(help_topic) { ui->setupUi(this); // XXX Use recent settings instead resize(parent.width() * 2 / 3, parent.height() * 3 / 4); // Only show a hint label if a subclass provides a hint. ui->hintLabel->hide(); ctx_menu_.addAction(ui->actionCopyToClipboard); ctx_menu_.addAction(ui->actionSaveAs); QPushButton *button; button = ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); connect(button, SIGNAL(clicked()), this, SLOT(on_actionCopyToClipboard_triggered())); button = ui->buttonBox->addButton(tr("Save as" UTF8_HORIZONTAL_ELLIPSIS), QDialogButtonBox::ActionRole); connect(button, SIGNAL(clicked()), this, SLOT(on_actionSaveAs_triggered())); connect(ui->displayFilterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(updateWidgets())); ProgressFrame::addToButtonBox(ui->buttonBox, &parent); if (help_topic_ < 1) { ui->buttonBox->button(QDialogButtonBox::Help)->hide(); } if (!ui->displayFilterLineEdit->text().isEmpty()) { QString filter = ui->displayFilterLineEdit->text(); emit updateFilter(filter, true); } show_timer_ = new QTimer(this); setRetapOnShow(true); }
bool PathInfo::Update(float destX, float destY, float destZ, bool forceDest) { float x, y, z; m_sourceUnit->GetPosition(x, y, z); if (!Oregon::IsValidMapCoord(destX, destY, destZ) || !Oregon::IsValidMapCoord(x, y, z)) { sLog.outMMap("PathInfo::Update() called with invalid map coords, destX: %f destY: %f destZ: %f x: %f y: %f z: %f for creature %u", destX, destY, destZ, x, y, z, m_sourceUnit->GetGUIDLow()); m_type = PATHFIND_NOPATH; return false; } Vector3 oldDest = getEndPosition(); Vector3 newDest(destX, destY, destZ); setEndPosition(newDest); Vector3 newStart(x, y, z); setStartPosition(newStart); m_forceDestination = forceDest; sLog.outMMap("PathInfo::Update() for %u \n", m_sourceUnit->GetGUIDLow()); // make sure navMesh works - we can run on map w/o mmap // check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?) if (!m_navMesh || !m_navMeshQuery || m_sourceUnit->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING) || !HaveTile(newStart) || !HaveTile(newDest)) { BuildShortcut(); m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); return true; } updateFilter(); BuildPolyPath(newStart, newDest); return true; }
void ChromaKeyFXNode::setSpillThreshold(float spillThreshold) { m_SpillThreshold = spillThreshold; updateFilter(); }
void ChromaKeyFXNode::setErosion(int erosion) { m_Erosion = erosion; updateFilter(); }
void ChromaKeyFXNode::setSoftness(float softness) { m_Softness = softness; updateFilter(); }
void AudioResamplingNode::process(AudioSampleBuffer& buffer, MidiBuffer& midiMessages, int& nSamples) { int nSamps = nSamples; int valuesNeeded; if (destBufferIsTempBuffer) { ratio = float(nSamps) / float(buffer.getNumSamples()); valuesNeeded = buffer.getNumSamples(); } else { ratio = sourceBufferSampleRate / destBufferSampleRate; valuesNeeded = (int) buffer.getNumSamples() / ratio; //std::cout << std::endl; //std::cout << "Ratio: " << ratio << std::endl; //std::cout << "Values needed: " << valuesNeeded << std::endl; } if (lastRatio != ratio) { updateFilter(); lastRatio = ratio; } if (ratio > 1.0001) { // pre-apply filter before downsampling filter->process(nSamps, buffer.getArrayOfChannels()); } // initialize variables tempBuffer->clear(); int sourceBufferPos = 0; int sourceBufferSize = buffer.getNumSamples(); float subSampleOffset = 0.0; int nextPos = (sourceBufferPos + 1) % sourceBufferSize; int tempBufferPos; //int totalSamples = 0; // code modified from "juce_ResamplingAudioSource.cpp": for (tempBufferPos = 0; tempBufferPos < valuesNeeded; tempBufferPos++) { float gain = 1.0; float alpha = (float) subSampleOffset; float invAlpha = 1.0f - alpha; for (int channel = 0; channel < buffer.getNumChannels(); ++channel) { tempBuffer->addFrom(channel, // destChannel tempBufferPos, // destSampleOffset buffer, // source channel, // sourceChannel sourceBufferPos,// sourceSampleOffset 1, // number of samples invAlpha*gain); // gain to apply to source tempBuffer->addFrom(channel, // destChannel tempBufferPos, // destSampleOffset buffer, // source channel, // sourceChannel nextPos, // sourceSampleOffset 1, // number of samples alpha*gain); // gain to apply to source } subSampleOffset += ratio; while (subSampleOffset >= 1.0) { if (++sourceBufferPos >= sourceBufferSize) sourceBufferPos = 0; nextPos = (sourceBufferPos + 1) % sourceBufferSize; subSampleOffset -= 1.0; } } // std::cout << sourceBufferPos << " " << tempBufferPos << std::endl; if (ratio < 0.9999) { filter->process(tempBufferPos, tempBuffer->getArrayOfChannels()); // apply the filter after upsampling ///////filter->process (totalSamples, buffer.getArrayOfChannels()); } else if (ratio <= 1.0001) { // no resampling is being applied, no need to filter, BUT... // keep the filter stoked with samples to avoid discontinuities } if (destBufferIsTempBuffer) { // copy the temp buffer into the original buffer buffer = AudioSampleBuffer(tempBuffer->getArrayOfChannels(), 2, tempBufferPos);//buffer.getNumSamples()); } else { //std::cout << "Copying into dest buffer..." << std::endl; // copy the temp buffer into the destination buffer int pos = 0; while (*tempBuffer->getSampleData(0,pos) != 0) pos++; int spaceAvailable = destBufferWidth - destBufferPos; int blockSize1 = (spaceAvailable > pos) ? pos : spaceAvailable; int blockSize2 = (spaceAvailable > pos) ? 0 : (pos - spaceAvailable); for (int channel = 0; channel < destBuffer->getNumChannels(); channel++) { // copy first block destBuffer->copyFrom(channel, //destChannel destBufferPos, //destStartSample *tempBuffer, //source channel, //sourceChannel 0, //sourceStartSample blockSize1 //numSamples ); // copy second block destBuffer->copyFrom(channel, //destChannel 0, //destStartSample *tempBuffer, //source channel, //sourceChannel blockSize1, //sourceStartSample blockSize2 //numSamples ); } //destBufferPos = (spaceAvailable > tempBufferPos) ? destBufferPos destBufferPos += pos; destBufferPos %= destBufferWidth; //std::cout << "Temp buffer position: " << tempBufferPos << std::endl; //std::cout << "Resampling node value:" << *destBuffer->getSampleData(0,0) << std::endl; } }
void ChromaKeyFXNode::setColor(const Color& color) { m_Color = color; updateFilter(); }
void ChromaKeyFXNode::setLTolerance(float tolerance) { m_LTolerance = tolerance; updateFilter(); }
//*************************************************************************** void Kwave::FilterPlugin::run(QStringList params) { Kwave::UndoTransactionGuard *undo_guard = 0; m_pause = false; if (!interpreteParameters(params)) m_params = params; sample_index_t first, last; QList<unsigned int> tracks; selection(&tracks, &first, &last, true); // switch to interactive mode in pre-listen mode Kwave::StreamObject::setInteractive(m_listen); // create all objects Kwave::MultiTrackReader source( (m_listen) ? Kwave::FullSnapshot : Kwave::SinglePassForward, signalManager(), tracks, first, last); Kwave::SampleSource *filter = createFilter(tracks.count()); Q_ASSERT(filter); if (m_listen) { // pre-listen mode Q_ASSERT(m_sink); } else { // normal mode, with undo undo_guard = new(std::nothrow) Kwave::UndoTransactionGuard(*this, actionName()); Q_ASSERT(undo_guard); if (!undo_guard) { if (filter) delete filter; Kwave::StreamObject::setInteractive(false); return; } m_sink = new(std::nothrow) MultiTrackWriter(signalManager(), tracks, Kwave::Overwrite, first, last); Q_ASSERT(m_sink); } if (!filter || !m_sink || m_sink->done()) { if (filter) delete filter; if (undo_guard) delete undo_guard; if (m_sink) delete m_sink; m_sink = 0; Kwave::StreamObject::setInteractive(false); return; } // set up the progress dialog when in processing (not pre-listen) mode if (!m_listen) { connect(&source, SIGNAL(progress(qreal)), this, SLOT(updateProgress(qreal)), Qt::BlockingQueuedConnection); } // force initial update of the filter settings updateFilter(filter, true); // connect them Kwave::connect(source, SIGNAL(output(Kwave::SampleArray)), *filter, SLOT(input(Kwave::SampleArray))); Kwave::connect(*filter, SIGNAL(output(Kwave::SampleArray)), *m_sink, SLOT(input(Kwave::SampleArray))); // transport the samples while (!shouldStop() && (!source.done() || m_listen)) { // process one step source.goOn(); filter->goOn(); // watch out for changed parameters when in // pre-listen mode if (m_listen && paramsChanged()) { updateFilter(filter); } if (m_listen && source.done()) { // start the next loop source.reset(); continue; } // this lets the process wait if the user pressed cancel // and the confirm_cancel dialog is active while (m_pause && !shouldStop()) sleep(1); } // cleanup if (filter) delete filter; if (m_sink) delete m_sink; m_sink = 0; if (undo_guard) delete undo_guard; m_pause = false; m_listen = false; Kwave::StreamObject::setInteractive(false); }
void GameList::slotReconfigure() { updateFilter(); TableView::slotReconfigure(); }
void Voice::process(int frames, float* p) { float modlfo_to_fc = 0.0; float modenv_to_fc = 0.0; float _fres = _zerberus->ct2hz(fres + modlfo_val * modlfo_to_fc + modenv_val * modenv_to_fc); int sr = _zerberus->sampleRate(); if (_fres > 0.45f * sr) _fres = 0.45f * sr; else if (_fres < 5.f) _fres = 5.f; if ((fabs(_fres - last_fres) > 0.01f)) { updateFilter(_fres); last_fres = _fres; } if (audioChan == 1) { while (frames--) { updateLoop(); int idx = phase.index(); if (idx >= eidx) { off(); break; } const float* coeffs = interpCoeff[phase.fract()]; float f; f = (coeffs[0] * getData(idx-1) + coeffs[1] * getData(idx+0) + coeffs[2] * getData(idx+1) + coeffs[3] * getData(idx+2)) * gain - a1 * hist1l - a2 * hist2l; float v = b02 * (f + hist2l) + b1 * hist1l; hist2l = hist1l; hist1l = f; if (filter_coeff_incr_count) { --filter_coeff_incr_count; a1 += a1_incr; a2 += a2_incr; b02 += b02_incr; b1 += b1_incr; } updateEnvelopes(); if (_state == VoiceState::OFF) break; v *= envelopes[currentEnvelope].val; *p++ += v * _channel->panLeftGain(); *p++ += v * _channel->panRightGain(); phase += phaseIncr; _samplesSinceStart++; } } else { // // handle interleaved stereo samples // while (frames--) { updateLoop(); int idx = phase.index() * 2; if (idx >= eidx) { off(); // printf("end of sample\n"); break; } const float* coeffs = interpCoeff[phase.fract()]; float f1, f2; f1 = (coeffs[0] * getData(idx-2) + coeffs[1] * getData(idx) + coeffs[2] * getData(idx+2) + coeffs[3] * getData(idx+4)) * gain * _channel->panLeftGain(); f2 = (coeffs[0] * getData(idx-1) + coeffs[1] * getData(idx+1) + coeffs[2] * getData(idx+3) + coeffs[3] * getData(idx+5)) * gain * _channel->panRightGain(); updateEnvelopes(); if (_state == VoiceState::OFF) break; f1 *= envelopes[currentEnvelope].val; f2 *= envelopes[currentEnvelope].val; f1 += -a1 * hist1l - a2 * hist2l; float vl = b02 * (f1 + hist2l) + b1 * hist1l; hist2l = hist1l; hist1l = f1; f2 += -a1 * hist1r - a2 * hist2r; float vr = b02 * (f2 + hist2r) + b1 * hist1r; hist2r = hist1r; hist1r = f2; if (filter_coeff_incr_count) { --filter_coeff_incr_count; a1 += a1_incr; a2 += a2_incr; b02 += b02_incr; b1 += b1_incr; } *p++ += vl; *p++ += vr; phase += phaseIncr; _samplesSinceStart++; } } }
// Constructor. LteMacStatisticsDialog::LteMacStatisticsDialog(QWidget &parent, CaptureFile &cf, const char *filter) : TapParameterDialog(parent, cf, HELP_STATS_LTE_MAC_TRAFFIC_DIALOG), commonStatsCurrent_(false) { setWindowSubtitle(tr("LTE Mac Statistics")); loadGeometry(parent.width() * 1, parent.height() * 3 / 4, "LTEMacStatisticsDialog"); clearCommonStats(); // Create common_stats_grid to appear just above the filter area. int statstree_layout_idx = verticalLayout()->indexOf(filterLayout()->widget()); QGridLayout *common_stats_grid = new QGridLayout(); // Insert into the vertical layout verticalLayout()->insertLayout(statstree_layout_idx, common_stats_grid); int one_em = fontMetrics().height(); common_stats_grid->setColumnMinimumWidth(2, one_em * 2); common_stats_grid->setColumnStretch(2, 1); common_stats_grid->setColumnMinimumWidth(5, one_em * 2); common_stats_grid->setColumnStretch(5, 1); // Create statistics label. commonStatsLabel_ = new QLabel(this); commonStatsLabel_->setObjectName("statisticsLabel"); commonStatsLabel_->setTextFormat(Qt::RichText); commonStatsLabel_->setTextInteractionFlags(Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse); common_stats_grid->addWidget(commonStatsLabel_); // Create a grid for filtering-related widgetsto also appear in layout. int filter_controls_layout_idx = verticalLayout()->indexOf(filterLayout()->widget()); QGridLayout *filter_controls_grid = new QGridLayout(); // Insert into the vertical layout verticalLayout()->insertLayout(filter_controls_layout_idx, filter_controls_grid); filter_controls_grid->setColumnMinimumWidth(2, one_em * 2); filter_controls_grid->setColumnStretch(2, 1); filter_controls_grid->setColumnMinimumWidth(5, one_em * 2); filter_controls_grid->setColumnStretch(5, 1); // Add individual controls into the grid showSRFilterCheckBox_ = new QCheckBox(tr("Include SR frames in filter")); filter_controls_grid->addWidget(showSRFilterCheckBox_); showRACHFilterCheckBox_ = new QCheckBox(tr("Include RACH frames in filter")); filter_controls_grid->addWidget(showRACHFilterCheckBox_); // Will set whole-UE headings originally. updateHeaderLabels(); statsTreeWidget()->setItemDelegateForColumn(col_ul_padding_percent_, new PercentBarDelegate()); statsTreeWidget()->setItemDelegateForColumn(col_dl_padding_percent_, new PercentBarDelegate()); statsTreeWidget()->sortByColumn(col_rnti_, Qt::AscendingOrder); // Set up column widths. // resizeColumnToContents doesn't work well here, so set sizes manually. for (int col = 0; col < statsTreeWidget()->columnCount() - 1; col++) { switch (col) { case col_rnti_: statsTreeWidget()->setColumnWidth(col, one_em * 8); break; case col_ul_frames_: statsTreeWidget()->setColumnWidth(col, one_em * 5); break; case col_ul_bytes_: statsTreeWidget()->setColumnWidth(col, one_em * 5); break; case col_ul_mb_s_: statsTreeWidget()->setColumnWidth(col, one_em * 4); break; case col_ul_padding_percent_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; case col_ul_retx_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; case col_dl_frames_: statsTreeWidget()->setColumnWidth(col, one_em * 5); break; case col_dl_bytes_: statsTreeWidget()->setColumnWidth(col, one_em * 5); break; case col_dl_mb_s_: statsTreeWidget()->setColumnWidth(col, one_em * 4); break; case col_dl_padding_percent_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; case col_dl_crc_failed_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; case col_dl_retx_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; default: // The rest are numeric statsTreeWidget()->setColumnWidth(col, one_em * 4); statsTreeWidget()->headerItem()->setTextAlignment(col, Qt::AlignRight); break; } } addFilterActions(); if (filter) { setDisplayFilter(filter); } // Set handler for when the tree item changes to set the appropriate labels. connect(statsTreeWidget(), SIGNAL(itemSelectionChanged()), this, SLOT(updateHeaderLabels())); // Set handler for when display filter string is changed. connect(this, SIGNAL(updateFilter(QString)), this, SLOT(filterUpdated(QString))); }
void setCaseSensitive( bool caseSensitive ) { mCaseSensitivity = caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive; updateFilter(); }