bool Texture::loadTextureFromPixels32( GLuint* pixels, GLuint width, GLuint height ) { //Check if there is already a texture, and if so, free it. freeTexture(); //Preemptively set width and height. mSize.set(width, height); //Generate texture ID. glGenTextures( 1, &mTextureID ); //Bind texture ID. glBindTexture( GL_TEXTURE_2D, mTextureID ); //Generate texture from array given, assuming 32-bit (RGBA). glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels ); setFilters(); facilitateWrap(); //Unbind texture. glBindTexture( GL_TEXTURE_2D, NULL ); //Check for error. GLenum error = glGetError(); if( error != GL_NO_ERROR ) { printf( "Error loading texture from %p pixels! %s\n", pixels, gluErrorString( error ) ); return false; } return true; }
ImageExportDialog::ImageExportDialog(QWidget* parent, const char*name): QFileDialog(parent, name) { setCaption( tr( "QtiPlot - Choose a filename to save under" ) ); QStringList list=QImage::outputFormatList (); list<<"EPS"; list<<"SVG"; list.sort(); QString filter, selectedFilter,aux; for (int i=0;i<(int)list.count();i++) { aux="*."+(list[i]).lower()+";;"; filter+=aux; } setFilters( filter ); setMode( QFileDialog::AnyFile ); boxOptions = new QCheckBox(this, "boxOptions" ); boxOptions->setText( tr("Show export &options") ); #ifdef Q_OS_WIN // Windows systems boxOptions->setChecked( true ); #else boxOptions->setChecked( false ); #endif addWidgets( 0, boxOptions, 0 ); connect(this, SIGNAL(filterSelected ( const QString & )), this, SLOT(showOptionsBox ( const QString & ))); }
//Note: //Code adapted from NeheTutorials. bool Texture::loadTextureFromBMP( const char *path ) // Creates Texture From A Bitmap File { //Check if there is already a texture, and if so, free it. freeTexture(); HBITMAP hBMP; // Handle Of The Bitmap BITMAP BMP; // Bitmap Structure glGenTextures(1, &mTextureID); // Create The Texture hBMP=(HBITMAP)LoadImage(GetModuleHandle(NULL), path, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE ); if (!hBMP) // Does The Bitmap Exist? return false; // If Not Return False GetObject(hBMP, sizeof(BMP), &BMP); // Get The Object // hBMP: Handle To Graphics Object // sizeof(BMP): Size Of Buffer For Object Information // &BMP: Buffer For Object Information glPixelStorei(GL_UNPACK_ALIGNMENT, 4); // Pixel Storage Mode (Word Alignment / 4 Bytes) // Typical Texture Generation Using Data From The Bitmap glBindTexture(GL_TEXTURE_2D, mTextureID); // Bind To The Texture ID setFilters(); facilitateWrap(); glTexImage2D(GL_TEXTURE_2D, 0, 3, BMP.bmWidth, BMP.bmHeight, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, BMP.bmBits); DeleteObject(hBMP); // Delete The Object return true; // Loading Was Successful }
void QPreviewFileDialog::initDlg() { ImageIOSupporter iisup; QStringList filters; QString qs; if(mPreviewMode) { QWidget* widget = new QWidget(this); QVBoxLayout* qvbl = new QVBoxLayout(widget); mpPreviewCheckBox = new QCheckBox(tr("Show preview"),widget); connect(mpPreviewCheckBox,SIGNAL(toggled(bool)), this,SLOT(slotShowPreview(bool))); mpPixWidget = new QLabel(widget); mpPixWidget->setMinimumWidth(200); qvbl->setMargin(5); qvbl->addWidget(mpPreviewCheckBox); qvbl->addWidget(mpPixWidget); qvbl->setStretchFactor (mpPixWidget,1); mpPixWidget->setPalette(QColor(lightGray)); addLeftWidget(widget); resize(550,300); } mImageFormat =xmlConfig->stringValue("VIEWER_IMAGE_TYPE","ALL_FILES"); filters = iisup.getOrderedOutFilterList(mImageFormat); setDir(xmlConfig->stringValue("SINGLEFILE_SAVE_PATH")); setFilters(filters); setMode(QFileDialog::AnyFile); setSizeGripEnabled(false); setViewMode((QFileDialog::ViewMode)xmlConfig->intValue("SINGLEFILE_VIEW_MODE")); }
void ExtScript::readConfiguration() { AbstractExtItem::readConfiguration(); for (int i = directories().count() - 1; i >= 0; i--) { if (!QDir(directories().at(i)) .entryList(QDir::Files) .contains(fileName())) continue; QSettings settings( QString("%1/%2").arg(directories().at(i)).arg(fileName()), QSettings::IniFormat); settings.beginGroup(QString("Desktop Entry")); setExecutable(settings.value(QString("Exec"), m_executable).toString()); setPrefix(settings.value(QString("X-AW-Prefix"), m_prefix).toString()); setStrRedirect( settings.value(QString("X-AW-Redirect"), strRedirect()).toString()); // api == 3 setFilters(settings.value(QString("X-AW-Filters"), m_filters) .toString() .split(QChar(','), QString::SkipEmptyParts)); settings.endGroup(); } // update for current API if ((apiVersion() > 0) && (apiVersion() < AWESAPI)) { qCWarning(LOG_LIB) << "Bump API version from" << apiVersion() << "to" << AWESAPI; setApiVersion(AWESAPI); writeConfiguration(); } }
void EngineFilterBlock::process(const CSAMPLE* pIn, CSAMPLE* pOutput, const int iBufferSize) { float fLow=0.f, fMid=0.f, fHigh=0.f; if (filterKillLow->get()==0.) fLow = filterpotLow->get(); //*0.7; if (filterKillMid->get()==0.) fMid = filterpotMid->get(); //*1.1; if (filterKillHigh->get()==0.) fHigh = filterpotHigh->get(); //*1.2; #ifndef __LOFI__ setFilters(); #endif low->process(pIn, m_pTemp1, iBufferSize); band->process(pIn, m_pTemp2, iBufferSize); high->process(pIn, m_pTemp3, iBufferSize); if (fLow != old_low || fMid != old_mid || fHigh != old_high) { SampleUtil::copy3WithRampingGain(pOutput, m_pTemp1, old_low, fLow, m_pTemp2, old_mid, fMid, m_pTemp3, old_high, fHigh, iBufferSize); } else { SampleUtil::copy3WithGain(pOutput, m_pTemp1, fLow, m_pTemp2, fMid, m_pTemp3, fHigh, iBufferSize); } old_low = fLow; old_mid = fMid; old_high = fHigh; }
void rspfSFIMFusion::initialize() { rspfFusionCombiner::initialize(); if(!theIntensityConnection) { theLowPassFilter->disconnectAllInputs(); theHighPassFilter->disconnectAllInputs(); } else { theLowPassFilter->connectMyInputTo(0, PTR_CAST(rspfConnectableObject, theIntensityConnection->getObject())); theHighPassFilter->connectMyInputTo(0, PTR_CAST(rspfConnectableObject, theIntensityConnection->getObject())); adjustableParametersChanged(); setFilters(); theLowPassFilter->initialize(); theHighPassFilter->initialize(); if(theAutoAdjustScales) { if(theInputConnection && theIntensityConnection) { rspfTypeNameVisitor visitor("rspfImageRenderer", true); theInputConnection->accept(visitor); rspfRefPtr<rspfConnectableObject> inputColor = visitor.getObjectAs<rspfConnectableObject>(); visitor.reset(); theIntensityConnection->accept(visitor); rspfRefPtr<rspfConnectableObject> inputPan = visitor.getObjectAs<rspfConnectableObject>(); if(inputColor.valid()&&inputPan.valid()) { rspfImageSource* inputColorSource = dynamic_cast<rspfImageSource*> (inputColor->getInput()); rspfImageSource* inputPanSource = dynamic_cast<rspfImageSource*> (inputPan->getInput()); if(inputColorSource&&inputPanSource) { rspfRefPtr<rspfImageGeometry> colorGeom = inputColorSource->getImageGeometry(); rspfRefPtr<rspfImageGeometry> intensityGeom = inputPanSource->getImageGeometry(); if(colorGeom.valid()&&intensityGeom.valid()) { rspfDpt gsdIntensity = intensityGeom->getMetersPerPixel(); rspfDpt gsdColor = colorGeom->getMetersPerPixel(); if(!gsdColor.hasNans()&&!gsdIntensity.hasNans()) { double scaleChange = gsdColor.length()/gsdIntensity.length(); if(scaleChange < 1.0) scaleChange = 1.0; setParameterOffset(LOW_PASS_WIDTH_OFFSET, scaleChange); } } } } } } } }
EngineFilterBlock::EngineFilterBlock(const char* group) { ilowFreq = 0; ihighFreq = 0; blofi = false; m_eqNeverTouched = true; m_pSampleRate = new ControlObjectSlave("[Master]", "samplerate"); m_iOldSampleRate = 0; //Setup Filter Controls if (s_loEqFreq == NULL) { s_loEqFreq = new ControlPotmeter(ConfigKey("[Mixer Profile]", "LoEQFrequency"), 0., 22040); s_hiEqFreq = new ControlPotmeter(ConfigKey("[Mixer Profile]", "HiEQFrequency"), 0., 22040); s_lofiEq = new ControlPushButton(ConfigKey("[Mixer Profile]", "LoFiEQs")); s_EnableEq = new ControlPushButton(ConfigKey("[Mixer Profile]", "EnableEQs")); } high = band = low = NULL; //Load Defaults setFilters(true); /* lowrbj = new EngineFilterRBJ(); lowrbj->calc_filter_coeffs(6, 100., 44100., 0.3, 0., true); midrbj = new EngineFilterRBJ(); midrbj->calc_filter_coeffs(6, 1000., 44100., 0.3, 0., true); highrbj = new EngineFilterRBJ(); highrbj->calc_filter_coeffs(8, 10000., 48000., 0.3, 0., true); lowrbj = new EngineFilterRBJ(); lowrbj->calc_filter_coeffs(0, 100., 48000., 0.3., 0., false); highrbj = new EngineFilterRBJ(); highrbj->calc_filter_coeffs(1, 10000., 48000., 0.3., 0., false); */ filterpotLow = new ControlLogpotmeter(ConfigKey(group, "filterLow"), 4.); filterKillLow = new ControlPushButton(ConfigKey(group, "filterLowKill")); filterKillLow->setButtonMode(ControlPushButton::POWERWINDOW); filterpotMid = new ControlLogpotmeter(ConfigKey(group, "filterMid"), 4.); filterKillMid = new ControlPushButton(ConfigKey(group, "filterMidKill")); filterKillMid->setButtonMode(ControlPushButton::POWERWINDOW); filterpotHigh = new ControlLogpotmeter(ConfigKey(group, "filterHigh"), 4.); filterKillHigh = new ControlPushButton(ConfigKey(group, "filterHighKill")); filterKillHigh->setButtonMode(ControlPushButton::POWERWINDOW); m_pLowBuf = new CSAMPLE[MAX_BUFFER_LEN]; m_pBandBuf = new CSAMPLE[MAX_BUFFER_LEN]; m_pHighBuf = new CSAMPLE[MAX_BUFFER_LEN]; old_low = old_mid = old_high = 1.0; }
/*! Read current path and filters from UI dock object and save it in the settings */ void FileBrowser::saveSettings() { if ( mDock ) { setPath( mDock->currentPath() ); setFilePath( mDock->currentFilePath() ); setFilters( mDock->filters() ); setBookmarks( mDock->bookmarks() ); } }
virtual int setValue (rts2core::Value *old_value, rts2core::Value *new_value) { if (old_value == filterNames) { if (setFilters ((char *) (new_value->getValue ()))) return -2; updateMetaInformations (old_value); return 0; } return Filterd::setValue (old_value, new_value); }
rspfSFIMFusion::rspfSFIMFusion() :theLowPassKernelWidth(1.5), theHighPassKernelWidth(3) { theAutoAdjustScales = true; theLowPassFilter = new rspfImageGaussianFilter; theHighPassFilter = new rspfConvolutionSource; setFilters(); initAdjustableParameters(); }
void TextureMapperLayer::syncAnimations() { m_animations.apply(this); if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitTransform)) setTransform(m_state.transform); if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity)) setOpacity(m_state.opacity); #if ENABLE(CSS_FILTERS) if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitFilter)) setFilters(m_state.filters); #endif }
QString QG_FileDialog::getSaveFile(RS2::FormatType* type){ setAcceptMode ( QFileDialog::AcceptSave ); // read default settings: RS_SETTINGS->beginGroup("/Paths"); QString defDir = RS_SETTINGS->readEntry("/Save", RS_SYSTEM->getHomeDir()); /* QString defFilter = RS_SETTINGS->readEntry("/SaveFilter", "Drawing Exchange DXF 2000 (*.dxf)");*/ RS_SETTINGS->endGroup(); RS_DEBUG->print("defDir: %s", defDir.toLatin1().data()); QString fn = ""; QStringList filters; #ifdef USE_DXFRW filters << fDxf2000 << fDxfrw2000 << fDxfR12 << fLff << fCxf << fJww; #else filters << fDxf2000 << fDxfR12 << fLff << fCxf << fJww; #endif setWindowTitle(tr("Save Drawing As")); setFileMode(QFileDialog::AnyFile); setDirectory(defDir); setFilters(filters); #if QT_VERSION >= 0x040400 selectNameFilter(fDxf2000); #endif ftype= RS2::FormatDXF; RS_DEBUG->print("defFilter: %s", fDxf2000.toLatin1().data()); if (exec()==QDialog::Accepted) { QStringList fl = selectedFiles(); if (!fl.isEmpty()) fn = fl[0]; fn = QDir::convertSeparators( QFileInfo(fn).absoluteFilePath() ); getType(selectedFilter()); if (type!=NULL) *type = ftype; // append default extension: if (QFileInfo(fn).fileName().indexOf('.')==-1) { fn += getExtension(ftype); } // store new default settings: RS_SETTINGS->beginGroup("/Paths"); RS_SETTINGS->writeEntry("/Save", QFileInfo(fn).absolutePath()); //RS_SETTINGS->writeEntry("/SaveFilter", fileDlg->selectedFilter()); RS_SETTINGS->endGroup(); } return fn; }
TransientIndex::TransientIndex(int history_size, int spectrum_size, int sample_rate, int in_filters, int in_mels) : Feature(history_size) { initialized = false; mfccOld = NULL; mfccNew = NULL; dctMatrix = NULL; filterTemp = NULL; filterBank = NULL; setSpectrumSize(spectrum_size); setSampleRate(sample_rate); setFilters(in_filters); setMels(in_mels); }
void ChameleonComponent::simpleCreate(string algorithm, string ID, int inputLength, int outputLength, map<string, int> configInt){ if (!filtersSet) setFilters(); chameleon::StartLearningPtr StartLearningThis = new chameleon::StartLearning(); StartLearningThis->algorithm = algorithm; StartLearningThis->ID = ID; StartLearningThis->inputLength = inputLength; StartLearningThis->outputLength = outputLength; StartLearningThis->configInt = configInt; addToWorkingMemory(newDataID(), StartLearningThis); };
filechooserDialog::filechooserDialog ( Gtk::Window& parent, const Glib::ustring& title, Gtk::FileChooserAction action, Glib::ustring currentFolder, bool multipleSelection, unsigned int mimeType ) : Gtk::FileChooserDialog (parent, title, action) { // append filechooser buttons and linked events add_button ( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL ); add_button ( Gtk::Stock::OK, Gtk::RESPONSE_OK ); // set the path to folder of the application as current folder set_current_folder(currentFolder); // Allow the selection of several files set_select_multiple(multipleSelection); // ask confirmation before overwrite an existing file if (action == Gtk::FILE_CHOOSER_ACTION_SAVE) set_do_overwrite_confirmation(true); // mime type file filter setFilters(mimeType); // run the filechooser and grab the result response = run(); // alert dialog if (action != Gtk::FILE_CHOOSER_ACTION_SAVE) { if (response == Gtk::RESPONSE_OK and !genericFeatures::fileExists(get_filename())) { genericAlertWindow * AC = new genericAlertWindow ( *this, "File error" , "The file you are trying to open does not exist" ); delete AC; } } }
/*! Toggles the state of \a filter within filters() for widget(). This function will ensure that one of \l Translations and \l Rotations is always enabled. \sa filters(), setFilters(), filtersChanged() */ void QMouse3DEventProvider::toggleFilter (QMouse3DEventProvider::Filter filter) { Q_D(QMouse3DEventProvider); QMouse3DEventProvider::Filters newFilters = d->filters ^ filter; if ((newFilters & (QMouse3DEventProvider::Translations | QMouse3DEventProvider::Rotations)) == 0) { // Cannot turn off both Translations and Rotations, so turn // on the other one that wasn't toggled. if (filter == QMouse3DEventProvider::Translations) newFilters |= QMouse3DEventProvider::Rotations; else if (filter == QMouse3DEventProvider::Rotations) newFilters |= QMouse3DEventProvider::Translations; } setFilters(newFilters); }
void sstvRx::init() { setFilters(); // setup sstvRx Filters resetParams(true); #ifndef QT_NO_DEBUG scopeViewerData->setAlternativeScaleMultiplier(SUBSAMPLINGFACTOR/rxClock); scopeViewerData->setCurveName("RX VOL",SCDATA1); scopeViewerData->setCurveName("TEST",SCDATA2); scopeViewerData->setCurveName("STATE",SCDATA3); scopeViewerData->setCurveName("DEMOD",SCDATA4); scopeViewerData->setAxisTitles("Samples","int","State"); scopeViewerSyncNarrow->setAlternativeScaleMultiplier(SUBSAMPLINGFACTOR/rxClock); scopeViewerSyncWide->setAlternativeScaleMultiplier(SUBSAMPLINGFACTOR/rxClock); #endif }
void ImportASCIIDialog::selectFilter(const QString & filter) { QStringList filters; filters << tr("All files") + " (*)"; filters << tr("Text files") + " (*.TXT *.txt)"; filters << tr("Data files") + " (*.DAT *.dat)"; filters << tr("Comma Separated Values") + " (*.CSV *.csv)"; if (!filters.contains(filter)) filters << filter; setFilters(filters); setEditableFilter(); QFileDialog::selectFilter(filter); }
void Locator::extensionsInitialized() { m_filters = ExtensionSystem::PluginManager::getObjects<ILocatorFilter>(); Utils::sort(m_filters, [](const ILocatorFilter *first, const ILocatorFilter *second) -> bool { if (first->priority() != second->priority()) return first->priority() < second->priority(); return first->id().alphabeticallyBefore(second->id()); }); setFilters(m_filters); Command *openCommand = ActionManager::command(Constants::OPEN); Command *locateCommand = ActionManager::command(Constants::LOCATE); connect(openCommand, &Command::keySequenceChanged, this, &Locator::updateEditorManagerPlaceholderText); connect(locateCommand, &Command::keySequenceChanged, this, &Locator::updateEditorManagerPlaceholderText); updateEditorManagerPlaceholderText(); }
JNIEXPORT jobject JNICALL Java_sglr_SGLRInvoker_parse(JNIEnv* env, jobject method){ char *resultData; int resultLength; jclass clazz = (*env)->GetObjectClass(env, method); /* Get source data. */ jmethodID getInputString = (*env)->GetMethodID(env, clazz, "getInputString", "()Ljava/nio/ByteBuffer;"); jobject inputStringBuffer = (*env)->CallNonvirtualObjectMethod(env, method, clazz, getInputString); const unsigned char *inputString = (unsigned char*) ((*env)->GetDirectBufferAddress(env, inputStringBuffer)); /* Get the input string length. */ jmethodID getInputStringLength = (*env)->GetMethodID(env, clazz, "getInputStringLength", "()I"); unsigned int inputStringLength = (unsigned int) (*env)->CallNonvirtualObjectMethod(env, method, clazz, getInputStringLength); /* Get the input path. */ jmethodID getInputPath = (*env)->GetMethodID(env, clazz, "getInputPath", "()Ljava/lang/String;"); jstring inputPathString = (*env)->CallNonvirtualObjectMethod(env, method, clazz, getInputPath); const char *inputPath = (*env)->GetStringUTFChars(env, inputPathString, NULL); /* Get parse table. */ jmethodID getParseTableName = (*env)->GetMethodID(env, clazz, "getParseTableName", "()Ljava/lang/String;"); jstring parseTableNameString = (*env)->CallNonvirtualObjectMethod(env, method, clazz, getParseTableName); const char *parseTableName = (*env)->GetStringUTFChars(env, parseTableNameString, NULL); /* Get filter flags */ jmethodID getFilterFlags = (*env)->GetMethodID(env, clazz, "getFilterFlags", "()I"); unsigned int filterFlags = (unsigned int) (*env)->CallNonvirtualObjectMethod(env, method, clazz, getFilterFlags); setFilters(filterFlags); /* Call parser. */ result = parse(inputString, inputStringLength, inputPath, parseTableName); /* No need to protect the result, since no GC will occur until the next invocation of the parser (in which case we want the old result to be collectable). */ /* Release stuff. */ (*env)->ReleaseStringUTFChars(env, parseTableNameString, parseTableName); (*env)->ReleaseStringUTFChars(env, inputPathString, inputPath); resultData = A2Pserialize(result, parseTreeSpec, &resultLength); return (*env)->NewDirectByteBuffer(env, resultData, resultLength); }
ImportFilesDialog::ImportFilesDialog(bool importTypeEnabled, QWidget* parent, const char*name): QFileDialog(parent, name) { setCaption(tr("QtiPlot - Import Multiple ASCII Files")); QString filter=tr("All files") + " *;;" + tr("Text") + " (*.TXT *.txt);;" + tr("Data")+" (*DAT *.dat);;" + tr("Comma Separated Values") + " (*.CSV *.csv);;"; setFilters( filter ); setMode( QFileDialog::ExistingFiles ); if (importTypeEnabled) { QLabel* label = new QLabel( tr("Import each file as") + ": ", this ); importType = new QComboBox( this ); importType->insertItem(tr("New Table")); importType->insertItem(tr("New Columns")); importType->insertItem(tr("New Rows")); addWidgets( label, importType, 0 ); } }
UIAddExistingFiles::UIAddExistingFiles( QMakeProject* project, QWidget* parent, const QString& caption, const QString& dir, const QString& filter ) : QFileDialog( parent, caption, dir ), projectParent( project ) { setAttribute( Qt::WA_DeleteOnClose ); gb = new QGroupBox; gb->setTitle( tr( "In project..." ) ); hbl = new QHBoxLayout( gb ); cbProjects = new QComboBox; cbPlatforms = new QComboBox; hbl->addWidget( cbProjects ); hbl->addWidget( cbPlatforms ); qobject_cast<QGridLayout*>( layout() )->addWidget( gb, 4, 0, 1, 6 ); setFileMode( QFileDialog::ExistingFiles ); while ( projectParent->parent() ) projectParent = qobject_cast<QMakeProject*>( projectParent->parent() ); cbProjects->addItems( QMakeProject::getProjectNames( projectParent, "subdirs" ) ); cbProjects->setCurrentIndex( cbProjects->findText( project->name() ) ); if ( cbProjects->currentIndex() == -1 ) cbProjects->setCurrentIndex( 0 ); cbPlatforms->addItems( QStringList() << "(all)" << "win32" << "unix" << "mac" ); setFilters( filter.split( ";;" ) ); }
BiquadFullKillEQEffectGroupState::BiquadFullKillEQEffectGroupState() : m_pLowBuf(MAX_BUFFER_LEN), m_pBandBuf(MAX_BUFFER_LEN), m_pHighBuf(MAX_BUFFER_LEN), m_tempBuf(MAX_BUFFER_LEN), m_oldLowBoost(0), m_oldMidBoost(0), m_oldHighBoost(0), m_oldLowKill(0), m_oldMidKill(0), m_oldHighKill(0), m_oldLow(1.0), m_oldMid(1.0), m_oldHigh(1.0), m_loFreqCorner(0), m_highFreqCorner(0), m_rampHoldOff(kRampDone), m_groupDelay(0), m_oldSampleRate(kStartupSamplerate) { // Initialize the filters with default parameters m_lowBoost = std::make_unique<EngineFilterBiquad1Peaking>( kStartupSamplerate, kStartupLoFreq, kQBoost); m_midBoost = std::make_unique<EngineFilterBiquad1Peaking>( kStartupSamplerate, kStartupMidFreq, kQBoost); m_highBoost = std::make_unique<EngineFilterBiquad1Peaking>( kStartupSamplerate, kStartupHiFreq, kQBoost); m_lowKill = std::make_unique<EngineFilterBiquad1LowShelving>( kStartupSamplerate, kStartupLoFreq * 2, kQLowKillShelve); m_midKill = std::make_unique<EngineFilterBiquad1Peaking>( kStartupSamplerate, kStartupMidFreq, kQKill); m_highKill = std::make_unique<EngineFilterBiquad1HighShelving>( kStartupSamplerate, kStartupHiFreq / 2, kQHighKillShelve); m_lvMixIso = std::make_unique<LVMixEQEffectGroupState<EngineFilterBessel4Low>>(); setFilters(kStartupSamplerate, kStartupLoFreq, kStartupHiFreq); }
void Texture::loadCheckerboard() { freeTexture(); glGenTextures(1, &mTextureID); glBindTexture(GL_TEXTURE_2D, mTextureID); float pixels[] = { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f }; glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_FLOAT, pixels); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); //glGenerateMipmap(GL_TEXTURE_2D); setFilters(); facilitateWrap(); }
ImportASCIIDialog::ImportASCIIDialog(bool import_mode_enabled, QWidget * parent, bool extended, Qt::WFlags flags ) : ExtensibleFileDialog(parent, extended, flags ) { setWindowTitle(tr("Import ASCII File(s)")); QStringList filters; filters << tr("All files") + " (*)"; filters << tr("Text files") + " (*.TXT *.txt)"; filters << tr("Data files") + " (*.DAT *.dat)"; filters << tr("Comma Separated Values") + " (*.CSV *.csv)"; setFilters( filters ); setFileMode( QFileDialog::ExistingFiles ); initAdvancedOptions(); d_import_mode->setEnabled(import_mode_enabled); setExtensionWidget(d_advanced_options); // get rembered option values ApplicationWindow *app = (ApplicationWindow *)parent; d_strip_spaces->setChecked(app->strip_spaces); d_simplify_spaces->setChecked(app->simplify_spaces); d_ignored_lines->setValue(app->ignoredLines); d_rename_columns->setChecked(app->renameColumns); setColumnSeparator(app->columnSeparator); if (app->d_ASCII_import_locale.name() == QLocale::c().name()) boxDecimalSeparator->setCurrentIndex(1); else if (app->d_ASCII_import_locale.name() == QLocale(QLocale::German).name()) boxDecimalSeparator->setCurrentIndex(2); else if (app->d_ASCII_import_locale.name() == QLocale(QLocale::French).name()) boxDecimalSeparator->setCurrentIndex(3); boxDecimalSeparator->setEnabled(app->d_convert_to_numeric); d_convert_to_numeric->setChecked(app->d_convert_to_numeric); connect(d_import_mode, SIGNAL(currentIndexChanged(int)), this, SLOT(updateImportMode(int))); }
void ResourcesModel::resetFilters() { setFilters(QVariantMap()); }
void EngineFilterBlock::process(CSAMPLE* pInOut, const int iBufferSize) { ScopedTimer t("EngineFilterBlock::process"); // Check if EQ processing is disabled. if (!s_EnableEq->get()) { return; } float fLow = 0.f, fMid = 0.f, fHigh = 0.f; if (filterKillLow->get() == 0.) { fLow = filterpotLow->get(); } if (filterKillMid->get() == 0.) { fMid = filterpotMid->get(); } if (filterKillHigh->get() == 0.) { fHigh = filterpotHigh->get(); } // tweak gains for RGBW float fDry = qMin(qMin(fLow, fMid), fHigh); fLow -= fDry; fMid -= fDry; fHigh -= fDry; setFilters(); // Process the new EQ'd signals. // They use up to 16 frames history so in case we are just starting, // 16 frames are junk, this is handled by ramp_delay int ramp_delay = 0; if (fLow || old_low) { low->process(pInOut, m_pLowBuf, iBufferSize); if(old_low == 0) { ramp_delay = 30; } } if (fMid || old_mid) { band->process(pInOut, m_pBandBuf, iBufferSize); if(old_mid== 0) { ramp_delay = 30; } } if (fHigh || old_high) { high->process(pInOut, m_pHighBuf, iBufferSize); if(old_high == 0) { ramp_delay = 30; } } if (ramp_delay) { // first use old gains SampleUtil::copy4WithGain(pInOut, pInOut, old_dry, m_pLowBuf, old_low, m_pBandBuf, old_mid, m_pHighBuf, old_high, ramp_delay); // Now ramp the remaining frames SampleUtil::copy4WithRampingGain(&pInOut[ramp_delay], &pInOut[ramp_delay], old_dry, fDry, &m_pLowBuf[ramp_delay], old_low, fLow, &m_pBandBuf[ramp_delay], old_mid, fMid, &m_pHighBuf[ramp_delay], old_high, fHigh, iBufferSize - ramp_delay); } else if (fLow != old_low || fMid != old_mid || fHigh != old_high || fDry != old_dry) { SampleUtil::copy4WithRampingGain(pInOut, pInOut, old_dry, fDry, m_pLowBuf, old_low, fLow, m_pBandBuf, old_mid, fMid, m_pHighBuf, old_high, fHigh, iBufferSize); } else { SampleUtil::copy4WithGain(pInOut, pInOut, fDry, m_pLowBuf, fLow, m_pBandBuf, fMid, m_pHighBuf, fHigh, iBufferSize); } old_low = fLow; old_mid = fMid; old_high = fHigh; old_dry = fDry; }
QString QG_FileDialog::getSaveFile(RS2::FormatType* type){ setAcceptMode ( QFileDialog::AcceptSave ); // read default settings: RS_SETTINGS->beginGroup("/Paths"); QString defDir = RS_SETTINGS->readEntry("/Save", RS_SYSTEM->getHomeDir()); /* QString defFilter = RS_SETTINGS->readEntry("/SaveFilter", "Drawing Exchange DXF 2000 (*.dxf)");*/ RS_SETTINGS->endGroup(); if(!defDir.endsWith("/") && !defDir.endsWith("\\")) defDir += QDir::separator(); RS_DEBUG->print("defDir: %s", defDir.toLatin1().data()); // setup filters QStringList filters; filters << fDxfrw2007 << fDxfrw2004 << fDxfrw2000 << fDxfrw14 << fDxfrw12 << fLff << fCxf << fJww; ftype = RS2::FormatDXFRW; RS_DEBUG->print("defFilter: %s", fDxfrw2007.toLatin1().data()); // when defFilter is added the below should use the default extension. // generate an untitled name QString fn = "Untitled"; if(QFile::exists( defDir + fn + getExtension( ftype ) )) { int fileCount = 1; while(QFile::exists( defDir + fn + QString("%1").arg(fileCount) + getExtension(ftype)) ) ++fileCount; fn += QString("%1").arg(fileCount); } // initialize dialog properties setWindowTitle(tr("Save %1 As").arg(name)); setFileMode(QFileDialog::AnyFile); setDirectory(defDir); setFilters(filters); selectNameFilter(fDxfrw2007); selectFile(fn); auto&& ext=getExtension(ftype); if(ext.size()==4){ if(ext[0]=='.') ext.remove(0,1); } if(ext.size()==3) setDefaultSuffix (ext); // only return non empty string when we have a complete, user approved, file name. if (exec()!=QDialog::Accepted) return QString(""); QStringList fl = selectedFiles(); if (fl.isEmpty()) return QString(""); QFileInfo fi = QFileInfo( fl[0] ); fn = QDir::toNativeSeparators( fi.absoluteFilePath() ); getType(selectedFilter()); if (type!=NULL) *type = ftype; // append default extension: if (fi.fileName().endsWith(".dxf",Qt::CaseInsensitive)==-1) fn += getExtension(ftype); // store new default settings: RS_SETTINGS->beginGroup("/Paths"); RS_SETTINGS->writeEntry("/Save", fi.absolutePath()); //RS_SETTINGS->writeEntry("/SaveFilter", fileDlg->selectedFilter()); RS_SETTINGS->endGroup(); return fn; }
//Note: //Code adapted from http://stackoverflow.com/revisions/11297197/3, which in turn was revised from http://en.wikibooks.org/wiki/OpenGL_Programming/Intermediate/Textures#A_simple_libpng_example. //Had to also fix it when it was trying to read RGB instead of RGBA. bool Texture::loadTextureFromPNG(const char *path) { //Clear the errors glGetError(); //Check if there is already a texture, and if so, free it. freeTexture(); png_byte header[8]; FILE *fp; fopen_s(&fp, path, "rb"); if (fp == 0) { perror(path); return 0; } // read the header fread(header, 1, 8, fp); if (png_sig_cmp(header, 0, 8)) { fprintf(stderr, "error: %s is not a PNG.\n", path); fclose(fp); return 0; } png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!png_ptr) { fprintf(stderr, "error: png_create_read_struct returned 0.\n"); fclose(fp); return 0; } // create png info struct png_infop info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { fprintf(stderr, "error: png_create_info_struct returned 0.\n"); png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL); fclose(fp); return 0; } // create png info struct png_infop end_info = png_create_info_struct(png_ptr); if (!end_info) { fprintf(stderr, "error: png_create_info_struct returned 0.\n"); png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL); fclose(fp); return 0; } // the code in this if statement gets called if libpng encounters an error if (setjmp(png_jmpbuf(png_ptr))) { fprintf(stderr, "error from libpng\n"); png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); fclose(fp); return 0; } // init png reading png_init_io(png_ptr, fp); // let libpng know you already read the first 8 bytes png_set_sig_bytes(png_ptr, 8); // read all the info up to the image data png_read_info(png_ptr, info_ptr); // variables to pass to get info int bit_depth, color_type; png_uint_32 temp_width, temp_height; // get info about png png_get_IHDR(png_ptr, info_ptr, &temp_width, &temp_height, &bit_depth, &color_type, NULL, NULL, NULL); mSize.setWidth(temp_width); mSize.setHeight(temp_height); // Update the png info struct. png_read_update_info(png_ptr, info_ptr); // Row size in bytes. int rowbytes = png_get_rowbytes(png_ptr, info_ptr); // glTexImage2d requires rows to be 4-byte aligned rowbytes += 3 - ((rowbytes-1) % 4); // Allocate the image_data as a big block, to be given to opengl png_byte * image_data; image_data = (png_byte*)malloc(rowbytes * temp_height * sizeof(png_byte)+15); if (image_data == NULL) { fprintf(stderr, "error: could not allocate memory for PNG image data\n"); png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); fclose(fp); return 0; } // row_pointers is for pointing to image_data for reading the png with libpng png_bytep * row_pointers = (png_bytep*)malloc(temp_height * sizeof(png_bytep)); if (row_pointers == NULL) { fprintf(stderr, "error: could not allocate memory for PNG row pointers\n"); png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); free(image_data); fclose(fp); return 0; } // set the individual row_pointers to point at the correct offsets of image_data unsigned i; for (i = 0; i < temp_height; i++) { row_pointers[temp_height - 1 - i] = image_data + i * rowbytes; } // read the png into image_data through row_pointers png_read_image(png_ptr, row_pointers); // Generate the OpenGL texture object GLuint texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); GLuint out = GL_RGBA; if(color_type == PNG_COLOR_TYPE_RGB) out = GL_RGB; glTexImage2D(GL_TEXTURE_2D, 0, out, temp_width, temp_height, 0, out, GL_UNSIGNED_BYTE, image_data); //Peter: This was in the original code, but I figured, hey, why not use a GL_LINEAR filter for some pizzazz? //glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); //glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); setFilters(); facilitateWrap(); //glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // clean up png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); free(image_data); free(row_pointers); fclose(fp); mTextureID = texture; //Unbind texture. glBindTexture( GL_TEXTURE_2D, NULL ); //Check for error. GLenum error = glGetError(); if( error != GL_NO_ERROR ) { printf( "Error loading texture from filename: %s, %s\n", path, gluErrorString( error ) ); return false; } return true; }