void LightingPresets::InitializePresets() { wxASSERT_MSG(presets.size() == 0, _T("presets have already been initialized")); presets[ID_PRESETS_OFF] = Preset(_T("Off"), ID_PRESETS_OFF, wxEmptyString); presets[ID_PRESET_BASELINE] = Preset(_T("BaselineRecommended"), ID_PRESET_BASELINE, DEFAULT_MOD_RECOMMENDED_LIGHTING_FLAGSET); presets[ID_PRESET_DABRAIN] = Preset(_T("DaBrain"), ID_PRESET_DABRAIN, _T("-ambient_factor 10 -no_emissive_light -spec_exp 7.0 -spec_point 8.6 -spec_static 12.8 -spec_tube 5.0")); presets[ID_PRESET_HERRA_TOHTORI] = Preset(_T("HerraTohtori"), ID_PRESET_HERRA_TOHTORI, _T("-ambient_factor 35 -no_emissive_light -spec_exp 15 -spec_point 1.2 -spec_static 1.5 -spec_tube 1.5 -ogl_spec 20")); presets[ID_PRESET_CKID] = Preset(_T("CKid"), ID_PRESET_CKID, _T("-ambient_factor 35 -no_emissive_light -spec_exp 16.7 -spec_point 0.6 -spec_static 0.9 -spec_tube 1")); presets[ID_PRESET_COLECAMPBELL666] = Preset(_T("ColeCampbell666"), ID_PRESET_COLECAMPBELL666, _T("-ambient_factor 0 -no_emissive_light -spec_exp 11 -spec_point .6 -spec_static .8 -spec_tube .4 -ogl_spec 80")); presets[ID_PRESET_CASTOR] = Preset(_T("Castor"), ID_PRESET_CASTOR, _T("-ambient_factor 75 -spec_exp 7.0 -spec_point 8.6 -spec_static 3.0 -spec_tube 5.0")); presets[ID_PRESET_SPIDEY] = Preset(_T("Spidey"), ID_PRESET_SPIDEY, _T("-ambient_factor 5 -spec_exp 15 -spec_point 1.2 -spec_static 1.7 -spec_tube 1.5 -ogl_spec 50")); presets[ID_PRESET_WOOLIE_WOOL] = Preset(_T("WoolieWool"), ID_PRESET_WOOLIE_WOOL, _T("-ambient_factor 105 -no_emissive_light -spec_exp 9 -spec_point 0.3 -spec_static 0.8 -spec_tube 0.7 -ogl_spec 120")); }
void MainWindowImpl::SaveSettings(void) { //Find our settings file char * pHome; string settings_filenameandpath; pHome = getenv ("HOME"); if (pHome!=NULL) { settings_filenameandpath = string(pHome); } settings_filenameandpath+="/.finny.settings"; ofstream outfile(settings_filenameandpath.c_str()); if(!outfile.is_open()) { return; } //Save presets int n_rows = m_Presets.rowCount(); for(int i = 0; i < n_rows; i++) { QStandardItem* item = m_Presets.item(i); QVariant vfreq = item->data(Qt::UserRole+1); QVariant vam = item->data(Qt::UserRole+2); float freq = (float)vfreq.toDouble(); bool am = vam.toBool(); QString desc = item->text(); string std_desc(desc.toAscii()); Preset::Write(outfile,am,freq,std_desc); } //And write the rest of our settings if( m_Settings.UpdateStartFreqOnClose && m_pRadioshark ) { Radioshark::Band band = m_pRadioshark->GetBand(); if( band == Radioshark::AM) { m_Settings.StartFreq = Preset(Preset::AM,m_pRadioshark->GetAMFreq()); }else{ m_Settings.StartFreq = Preset(Preset::FM,m_pRadioshark->GetFMFreq()); } } if( m_Settings.UpdateStartVolumeOnClose) { float volume = (float) m_AudioInterface.GetVolume(); m_Settings.StartVolume = volume; } FinnySettings::WriteSettings(m_Settings,outfile); outfile.close(); }
/** * @see Preset * @see Apply * @see Load */ Preset Save() { return Preset( #ifndef NDEBUG _program, _stage, #endif _get_indices()); }
MetricThresholdAttributes::Preset MetricThresholdAttributes::GetPreset() const { return Preset(preset); }
void MetricThresholdAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("MetricThresholdAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("preset")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 21) SetPreset(Preset(ival)); } else if(node->GetNodeType() == STRING_NODE) { Preset value; if(Preset_FromString(node->AsString(), value)) SetPreset(value); } } if((node = searchNode->GetNode("Hexahedron")) != 0) SetHexahedron(node->AsBool()); if((node = searchNode->GetNode("hex_lower")) != 0) SetHex_lower(node->AsDouble()); if((node = searchNode->GetNode("hex_upper")) != 0) SetHex_upper(node->AsDouble()); if((node = searchNode->GetNode("Tetrahedron")) != 0) SetTetrahedron(node->AsBool()); if((node = searchNode->GetNode("tet_lower")) != 0) SetTet_lower(node->AsDouble()); if((node = searchNode->GetNode("tet_upper")) != 0) SetTet_upper(node->AsDouble()); if((node = searchNode->GetNode("Wedge")) != 0) SetWedge(node->AsBool()); if((node = searchNode->GetNode("wed_lower")) != 0) SetWed_lower(node->AsDouble()); if((node = searchNode->GetNode("wed_upper")) != 0) SetWed_upper(node->AsDouble()); if((node = searchNode->GetNode("Pyramid")) != 0) SetPyramid(node->AsBool()); if((node = searchNode->GetNode("pyr_lower")) != 0) SetPyr_lower(node->AsDouble()); if((node = searchNode->GetNode("pyr_upper")) != 0) SetPyr_upper(node->AsDouble()); if((node = searchNode->GetNode("Triangle")) != 0) SetTriangle(node->AsBool()); if((node = searchNode->GetNode("tri_lower")) != 0) SetTri_lower(node->AsDouble()); if((node = searchNode->GetNode("tri_upper")) != 0) SetTri_upper(node->AsDouble()); if((node = searchNode->GetNode("Quad")) != 0) SetQuad(node->AsBool()); if((node = searchNode->GetNode("quad_lower")) != 0) SetQuad_lower(node->AsDouble()); if((node = searchNode->GetNode("quad_upper")) != 0) SetQuad_upper(node->AsDouble()); }
QLCCapability::Preset QLCCapability::stringToPreset(const QString &preset) { int index = staticMetaObject.indexOfEnumerator("Preset"); return Preset(staticMetaObject.enumerator(index).keyToValue(preset.toStdString().c_str())); }
//-------------------------------------------------------------- void PartyCLApp::setup() { ofBackground(ofColor::black); ofSetLogLevel(OF_LOG_VERBOSE); ofSetVerticalSync(false); ofDisableArbTex(); // Load presets. presets.push_back(Preset(0.016f, 1.54f, 8.0f, 0.1f, 1.0f)); presets.push_back(Preset(0.016f, 1.54f, 8.0f, 0.1f, 1.0f)); presets.push_back(Preset(0.016f, 0.68f, 20.0f, 0.1f, 1.0f)); presets.push_back(Preset(0.0006f, 0.16f, 1000.0f, 1.0f, 1.0f)); presets.push_back(Preset(0.0006f, 0.16f, 1000.0f, 1.0f, 1.0f)); presets.push_back(Preset(0.0019f, 0.32f, 276.0f, 1.0f, 1.0f)); presets.push_back(Preset(0.0016f, 0.32f, 272.0f, 0.145f, 1.0f)); presets.push_back(Preset(0.016f, 6.04f, 0.0f, 1.0f, 1.0f)); params.setName("PartyCL"); params.add(bPaused.set("paused", false)); params.add(bReset.set("reset", false)); params.add(timestep.set("timestep", 0.016, 0.0, 1.0)); params.add(clusterScale.set("cluster scale", 1.54, 0.0, 10.0)); params.add(velocityScale.set("velocity scale", 8.0, 4.0, 1000.0)); params.add(softening.set("softening factor", 0.1, 0.001, 1.0)); params.add(damping.set("velocity damping", 1.0, 0.5, 1.0)); params.add(pointSize.set("point size", 16.0f, 1.0f, 64.0f)); params.add(bExportFrames.set("export frames", false)); ofAddListener(params.parameterChangedE(), this, &PartyCLApp::paramsChanged); camera.setDistance(32.0f); // Set Gui. guiPanel.setup(params, "partycl.xml"); guiPanel.loadFromFile("partycl.xml"); bGuiVisible = true; // Load the first preset. presetIndex = 0; loadPreset(); #ifdef LOAD_TIPSY filename = "galaxy_20K.bin"; #else filename = ""; #endif if (filename.length()) { // Clear host memory. hPos.clear(); hVel.clear(); hColor.clear(); // Load the data file. int numDark; int numStar; vector<int> hIDs; ofxLoadTipsyFile(filename, numBodies, numDark, numStar, hPos, hVel, hIDs); } else { // Set the number of bodies and configure appropriately. numBodies = 1024 * 12; // Allocate host memory. hPos.resize(numBodies); hVel.resize(numBodies); hColor.resize(numBodies); } ofLogNotice("PartyCLApp", "Number of Bodies = %d", numBodies); switch (numBodies) { case 1024: clusterScale = 1.52f; velocityScale = 2.f; break; case 2048: clusterScale = 1.56f; velocityScale = 2.64f; break; case 4096: clusterScale = 1.68f; velocityScale = 2.98f; break; case 8192: clusterScale = 1.98f; velocityScale = 2.9f; break; default: case 16384: clusterScale = 1.54f; velocityScale = 8.f; break; case 32768: clusterScale = 1.44f; velocityScale = 11.f; break; } int p = 256; // workgroup X dimension int q = 1; // workgroup Y dimension if ((q * p) > 256) { p = 256 / q; ofLogNotice("PartyCLApp::setup", "Setting p=%d to maintain %d threads per block", p, 256); } if ((q == 1) && (numBodies < p)) { p = numBodies; ofLogNotice("PartyCLApp::setup", "Setting p=%d because # of bodies < p", p); } ofLogNotice("PartyCLApp::setup", "Workgroup Dims = (%d x %d)", p, q); // Init system. #ifdef USE_OPENCL system = new NBodySystemOpenCL(numBodies, p, q); #else system = new NBodySystemCPU(numBodies); #endif // Init renderer. renderer = new ParticleRenderer(); displayMode = ParticleRenderer::PARTICLE_SPRITES; // Start the show. bPaused = false; bReset = true; }
const std::vector<WPassGen::Preset>& WPassGen::GetDefaultPresets() { static std::vector<Preset> default_presets; if (default_presets.empty()) { default_presets.push_back(Preset(_("8 Char AlPhANuM"), PT_ALPHANUMERIC, false, false, _T(""), 8)); default_presets.push_back(Preset(_("12 Char AlPhANuM"), PT_ALPHANUMERIC, false, false, _T(""), 12)); default_presets.push_back(Preset(_("12 Char alpha"), PT_ALPHALOWER, false, false, _T(""), 12)); default_presets.push_back(Preset(_("12 Letter Pronounceable"), PT_PRONOUNCEABLE, false, false, _T(""), 12)); default_presets.push_back(Preset(_("16 Char AlPhANuM"), PT_ALPHANUMERIC, false, false, _T(""), 16)); default_presets.push_back(Preset(_("16 Char alpha"), PT_ALPHALOWER, false, false, _T(""), 16)); default_presets.push_back(Preset(_("16 Letter Pronounceable"), PT_PRONOUNCEABLE, false, false, _T(""), 16)); default_presets.push_back(Preset(_("128 Keybits AlPhANuM"), PT_ALPHANUMERIC, false, false, _T(""), 22)); default_presets.push_back(Preset(_("256 Keybits AlPhANuM"), PT_ALPHANUMERIC, false, false, _T(""), 43)); default_presets.push_back(Preset(_("IP Port Number"), PT_PORTNUMBER, false, false, _T(""), 5)); default_presets.push_back(Preset(_("64-bit WEP Key (40 keybits)"), PT_HEXADECIMAL, false, false, _T(""), 10)); default_presets.push_back(Preset(_("128-bit WEP Key (104 keybits)"), PT_HEXADECIMAL, false, false, _T(""), 26)); default_presets.push_back(Preset(_("256-bit WEP Key (232 keybits)"), PT_HEXADECIMAL, false, false, _T(""), 58)); } return default_presets; }
AudioEqualizerDialog::AudioEqualizerDialog(QWidget *parent) : QDialog(parent), d(new Data) { d->p = this; auto vbox = new QVBoxLayout; auto hbox = new QHBoxLayout; hbox->addWidget(new QLabel(tr("Preset"))); d->presets = new QComboBox; d->presets->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); for (int i = 0; i < Eq::MaxPreset; ++i) d->presets->addItem(AudioEqualizer::name((Preset)i), i); auto sig = static_cast<Signal<QComboBox, int>>(&QComboBox::currentIndexChanged); auto load = [=] () { auto data = d->presets->currentData(); if (data.type() == (int)QMetaType::Int) setEqualizer(Eq(Preset(data.toInt()))); }; connect(d->presets, sig, this, load); hbox->addWidget(d->presets); auto button = new QPushButton(tr("Load")); connect(button, &QPushButton::clicked, this, load); hbox->addWidget(button); vbox->addLayout(hbox); hbox = new QHBoxLayout; auto font = this->font(); font.setPointSizeF(font.pointSizeF()*0.8); const int w = QFontMetrics(font).width(u"+20.0dB"_q) + 2; for (int i = 0; i < Eq::bands(); ++i) { auto s = d->sliders[i] = new QSlider; s->setOrientation(Qt::Vertical); s->setRange(Eq::min() * Factor, Eq::max() * Factor); s->setFixedWidth(w); auto vbox = new QVBoxLayout; const auto f = Eq::freqeuncy(i); const QString fq = f < 999.9 ? (QString::number(f) % "Hz"_a) : (QString::number(f/1000.0) % "kHz"_a); auto label = new QLabel(fq); label->setFont(font); label->setAlignment(Qt::AlignCenter); vbox->addWidget(label); vbox->addWidget(s); auto dB = new QLabel("0.0dB"_a); dB->setFont(font); dB->setAlignment(Qt::AlignCenter); vbox->addWidget(dB); hbox->addLayout(vbox); connect(s, &QSlider::valueChanged, this, [=] () { const auto v = s->value()/(double)Factor; dB->setText((v > 0 ? "+"_a : ""_a) % QString::number(v, 'f', 1) % "dB"_a); if (_Change(d->eq[i], v) && d->update) d->update(d->eq); }); } vbox->addLayout(hbox); setLayout(vbox); _SetWindowTitle(this, tr("Audio Equalizer")); }