EnergyToBeat::EnergyToBeat ( const char * config_filename, float min_tempo_hz, float max_tempo_hz) : m_config(config_filename), m_min_tempo_hz(min_tempo_hz), m_max_tempo_hz(max_tempo_hz), m_time(Seconds::now()), m_pos(0), m_vel(0), m_acc(0), m_norm(0), m_pos_mean(m_config("energy_to_beat.pos_mean", 10.0f)), m_pos_variance(m_config("energy_to_beat.pos_variance", 100.0f)), m_acc_variance(m_config("energy_to_beat.acc_variance", 1000.0f)), m_lag(0) { ASSERT_LT(1/60.0f, min_tempo_hz); ASSERT_LT(min_tempo_hz, max_tempo_hz); ASSERT_LT(max_tempo_hz, 60.0f); }
void CNTKEvalBase<ElemType>::Init(const std::string& config) { m_config.Parse(config); size_t nThreads = m_config("numCPUThreads", "1"); CPUMatrix<ElemType>::SetNumThreads(nThreads); Globals::SetShareNodeValueMatrices(m_config(L"shareNodeValueMatrices", true)); }
bool WidgetStyleModel::applyWidgetStyle(const QString &style) { qDebug() << "Setting widget Style " << style; KConfig m_config(QStringLiteral("kdeglobals")); KConfigGroup m_configGroup(m_config.group("KDE")); m_configGroup.writeEntry("widgetStyle", style); m_configGroup.sync(); //FIXME: changing style on the fly breaks QQuickWidgets KGlobalSettings::self()->emitChange(KGlobalSettings::StyleChanged); return true; }
ControllerSlotConfigPtr ControllerSlotConfig::create(UInput& uinput, int slot, bool extra_devices, const ControllerSlotOptions& opts) { ControllerSlotConfigPtr m_config(new ControllerSlotConfig); for(ControllerSlotOptions::Options::const_iterator i = opts.get_options().begin(); i != opts.get_options().end(); ++i) { const ControllerOptions& ctrl_opt = i->second; ControllerConfigPtr config(new ControllerConfig(uinput, slot, extra_devices, ctrl_opt)); create_modifier(ctrl_opt, &config->get_modifier()); m_config->add_config(config); #ifdef FIXME // introspection of the config std::cout << "==[[ Active Modifier ]]==" << std::endl; for(std::vector<ModifierPtr>::iterator mod = config->get_modifier().begin(); mod != config->get_modifier().end(); ++mod) { std::cout << (*mod)->str() << std::endl; } #endif } // LED //ioctl(fd, UI_SET_EVBIT, EV_LED); //ioctl(fd, UI_SET_LEDBIT, LED_MISC); if (opts.get_force_feedback()) { // FF_GAIN - relative strength of rumble // FF_RUMBLE - basic rumble (delay, time) // FF_CONSTANT - envelope, emulate with rumble // FF_RAMP - same as constant, except strength grows // FF_PERIODIC - envelope // |- FF_SINE types of periodic effects // |- FF_TRIANGLE // |- FF_SQUARE // |- FF_SAW_UP // |- FF_SAW_DOWN // '- FF_CUSTOM // FIXME: this should go through the regular resolution process uint32_t ff_device = UInput::create_device_id(slot, opts.get_ff_device()); // basic types uinput.add_ff(ff_device, FF_RUMBLE); uinput.add_ff(ff_device, FF_PERIODIC); uinput.add_ff(ff_device, FF_CONSTANT); uinput.add_ff(ff_device, FF_RAMP); // periodic effect subtypes uinput.add_ff(ff_device, FF_SINE); uinput.add_ff(ff_device, FF_TRIANGLE); uinput.add_ff(ff_device, FF_SQUARE); uinput.add_ff(ff_device, FF_SAW_UP); uinput.add_ff(ff_device, FF_SAW_DOWN); uinput.add_ff(ff_device, FF_CUSTOM); // gin support uinput.add_ff(ff_device, FF_GAIN); // Unsupported effects // uinput.add_ff(ff_device, FF_SPRING); // uinput.add_ff(ff_device, FF_FRICTION); // uinput.add_ff(ff_device, FF_DAMPER); // uinput.add_ff(ff_device, FF_INERTIA); uinput.set_ff_callback(ff_device, boost::bind(&ControllerSlotConfig::set_rumble, m_config.get(), _1, _2)); } return m_config; }
FeatureProcessor::FeatureProcessor (const char * config_filename) : m_config(config_filename), m_large_size(m_config("spectrum_large_size", SPECTRUM_LARGE_SIZE)), m_medium_size(m_config("spectrum_medium_size", SPECTRUM_MEDIUM_SIZE)), m_small_size(m_config("spectrum_small_size", SPECTRUM_SMALL_SIZE)), m_history_length(m_config("history_length", HISTORY_LENGTH)), m_feature_size(m_medium_size + m_small_size * m_history_length), m_batch_size(m_config("feature_batch_size", Voice::FEATURE_BATCH_SIZE)), m_timestep(1.0f / DEFAULT_VIDEO_FRAMERATE), m_feature_timescale( m_config("feature_timescale_sec", FEATURE_TIMESCALE_SEC)), m_feature_rate(1.0f / m_feature_timescale / DEFAULT_AUDIO_FRAMERATE), m_logamp_mean(m_config("logamp_mean", LOGAMP_MEAN)), m_logamp_sigma(m_config("logamp_sigma", LOGAMP_SIGMA)), m_history_density(m_config("history_density", HISTORY_DENSITY)), m_spectrum_param( m_large_size, m_config("min_freq_hz", RasterAudio::SPECTRUM_MIN_FREQ_HZ), m_config("max_freq_hz", RasterAudio::SPECTRUM_MAX_FREQ_HZ), m_config("max_timescale_sec", RasterAudio::SPECTRUM_MAX_TIMESCALE_SEC)), m_history(m_small_size, 1 + m_history_length, m_history_density), m_large_to_medium(m_large_size, m_medium_size), m_medium_to_small(m_medium_size, m_small_size), m_features_real(m_feature_size), m_medium_energy(m_medium_size, m_features_real.begin()), m_small_history( m_small_size * m_history_length, m_medium_energy.end()), m_small_energy( m_small_size, m_small_size == m_medium_size ? m_medium_energy.data : NULL), m_features(m_feature_size) { ASSERT_LE(m_medium_size, m_large_size); ASSERT_LE(m_small_size, m_medium_size); }