void AmConfigAudioDetect::set_audiodetect_config(AudioDetectParameters *config)
{
    uint32_t i;
    char* string = (char *)malloc(sizeof(char) * 128);
    if (AM_LIKELY(config)) {
        if (init()) {
            set_value("GENERAL:AudioChannelNumber", config->audio_channel_number);
            set_value("GENERAL:AudioSampleRate", config->audio_sample_rate);
            set_value("GENERAL:AudioChunkBytes", config->audio_chunk_bytes);
            set_value("ALERT_DETECT:EnableAlertDetect", config->enable_alert_detect);
            set_value("ALERT_DETECT:AudioAlertSensitivity", config->audio_alert_sensitivity);
            set_value("ALERT_DETECT:AudioAlertDirection", config->audio_alert_direction);
            set_value("ANALYSIS_DETECT:EnableAnalysisDetect", config->enable_analysis_detect);
            set_value("ANALYSIS_DETECT:AudioAnalysisDirection", config->audio_analysis_direction);
            set_value("ANALYSIS_DETECT:AudioAnalysisModNum", config->audio_analysis_mod_num);
            for (i = 0; i < config->audio_analysis_mod_num; i++) {
                sprintf(string, "%s%d", "ANALYSISDETECT:AudioAnalysisMod", i + 1);
                set_value(string, config->aa_param[i].aa_mod_names);
                sprintf(string, "%s%d", "ANALYSIS_DETECT:AudioAnalysisSensitivityMod", i + 1);
                set_value(string, config->aa_param[i].aa_mod_th);
            }
            config->config_changed = 0;
            save_config();
        } else {
            WARN("Failed openint %s, audio detect configuration NOT saved!", mConfigFile);
        }
    }
    free(string);
}
void CommandLineHandlerBase::print_system_information(SuperLogger& logger)
{
    SaveLogFormatterConfig save_config(logger);
    logger.set_format(LogMessage::Info, "{message}");

    System::print_information(logger);
}
Пример #3
0
void config_main_menu() {
    show_menu(config_opts);

    save_config(); // Save config when exiting.

    generate_patch_cache();
}
Пример #4
0
Файл: gui.c Проект: nop90/Vex3DS
	void gui_SaveConfig()
{
	char savename[512];
	sprintf(savename, "%s/Vex3ds.cfg", config_base_path);  // using savename char buffer to save config
	save_config(savename);
	done = 1; 
}
Пример #5
0
void menu_main()
{
    while (1) {
        char *options[] = {"Boot CFW",
                           "Select Patches",
                           "More options...",
                           "Version info",
                           "Power off"};
        int result = draw_menu("CakesFW " CAKES_VERSION, 0, sizeof(options) / sizeof(char *), options);

        switch (result) {
            case 0:
                save_config();
                boot_cfw();
                break;
            case 1:
                menu_select_patches();
                break;
            case 2:
                menu_more();
                break;
            case 3:
                version_info();
                break;
            case 4:
                i2cWriteRegister(I2C_DEV_MCU, 0x20, 1);
                while(1);  // Won't break out of this one >:D
        }
    }
}
Пример #6
0
void PowerCallback (int unknown, int pwrflags)
{
	if (pwrflags & PSP_POWER_CB_HOLD_SWITCH)
	{
		extern bool8 g_bShowProfilerIno;
		g_bShowProfilerInfo = (! g_bShowProfilerInfo);
	}
	
	if (pwrflags & PSP_POWER_CB_POWER_SWITCH){
		if (g_bROMLoaded) {
			scePowerSetClockFrequency (222, 222, 111);
			S9xSetSoundMute           (TRUE);
			g_bSleep = true;
			save_config     ();
			Memory.SaveSRAM (S9xGetFilename ("srm"));
		}
	} else if (pwrflags & PSP_POWER_CB_RESUME_COMPLETE) {
		g_bSleep = false;
	}

	if (pwrflags & PSP_POWER_CB_BATTERY_LOW){
		scePowerSetClockFrequency (222,222,111);
		S9xSetInfoString          ("WARNING: PSP Battery is Low! (Automatically Throttling CPU)");
	}

	int cbid;
	cbid = sceKernelCreateCallback ("Power Callback", (SceKernelCallbackFunction)PowerCallback, NULL);
	scePowerRegisterCallback       (0, cbid);
}
Пример #7
0
void on_quit(void)
{
	save_config();
	free(config_file);
	
	gtk_main_quit();
}
Пример #8
0
/**
 * \brief Procedure called when closing the window.
 * \param event This event occured.
 */
void bf::main_frame::on_close( wxCloseEvent& event )
{
  save_config();

  bool quit = !event.CanVeto();

  if ( !quit )
    {
      quit = true;
      m_animation_edit->validate();

      if ( is_changed() )
        {
          wxMessageDialog dlg
            ( this,
              _("The animation is not saved."
                 " Do you want to save it now?"),
              _("Animation is not saved."), wxYES_NO | wxCANCEL );

          int answer = dlg.ShowModal();

          if ( answer == wxID_CANCEL )
            quit = false;
          else if ( answer == wxID_YES )
            quit = save();
        }
    }

  if ( quit )
    event.Skip();
  else
    event.Veto();
} // main_frame::on_close()
Пример #9
0
/*---------------------------------------------------------------------------*/
void
cc26xx_web_demo_restore_defaults(void)
{
  cc26xx_web_demo_sensor_reading_t *reading = NULL;

  leds_on(LEDS_ALL);

  for(reading = list_head(sensor_list);
      reading != NULL;
      reading = list_item_next(reading)) {
    reading->publish = 1;
  }

#if CC26XX_WEB_DEMO_MQTT_CLIENT
  process_post_synch(&mqtt_client_process,
                     cc26xx_web_demo_load_config_defaults, NULL);
#endif

#if CC26XX_WEB_DEMO_NET_UART
  process_post_synch(&net_uart_process, cc26xx_web_demo_load_config_defaults,
                     NULL);
#endif

  save_config();

  leds_off(LEDS_ALL);
}
Пример #10
0
void
on_save_pref_button_clicked (GtkButton * button, gpointer user_data)
{
  confirm_changes();	/* to save we simulate confirmation */
  save_config ();
  hide_pref_dialog();
}				/* on_save_pref_button_clicked */
Пример #11
0
void CommandLineHandler::print_program_usage(
    const char*     program_name,
    SuperLogger&    logger) const
{
    SaveLogFormatterConfig save_config(logger);
    logger.set_format(LogMessage::Info, "{message}");

    LOG_INFO(logger, "usage: %s [project.appleseed]", program_name);
    LOG_INFO(logger, "options:");

    parser().print_usage(logger);

#ifdef _WIN32

    const StringLogTarget& target =
        static_cast<const StringLogTarget&>(logger.get_log_target());
    const QString str = QString::fromStdString(target.get_string());

    QMessageBox msgbox;
    msgbox.setWindowTitle("appleseed.studio Program Usage");
    msgbox.setIcon(QMessageBox::Information);
    msgbox.setText("<pre>" + str + "</pre>");
    msgbox.setStandardButtons(QMessageBox::Ok);
    msgbox.setDefaultButton(QMessageBox::Ok);
    msgbox.exec();

#endif
}
Пример #12
0
static void
chanlist_maxusers (GtkSpinButton *wid, server *serv)
{
	serv->gui->chanlist_maxusers = gtk_spin_button_get_value_as_int (wid);
	prefs.hex_gui_chanlist_maxusers = serv->gui->chanlist_maxusers;
	save_config();
}
Пример #13
0
/* destroy_config:
 *  Destroys a config structure, writing it out to disk if the contents
 *  have changed.
 */
static void destroy_config(CONFIG *cfg)
{
   CONFIG_ENTRY *pos, *prev;

   if (cfg) {
      if (cfg->filename) {
		save_config(cfg);
	    free(cfg->filename);
      }

      /* destroy the variable list */
      pos = cfg->head;

      while (pos) {
	 prev = pos;
	 pos = pos->next;

	 if (prev->name)
	    free(prev->name);

	 if (prev->data)
	    free(prev->data);

	 free(prev);
      }

      free(cfg);
   }
}
Пример #14
0
void
on_button_general_config_save_clicked  (GtkButton       *button,
                                        gpointer         user_data)
{
	gtk_general_settings_grab();
	save_config();
}
Пример #15
0
 // mc2: 0x0053B510
 bool save_settings() {
     if (this->requires_saving == false)
         return false;
     //return save_settings_force();
     save_config();
     return true;
 }
Пример #16
0
static void on_insert_for_dummies(void)
{
	gboolean enabled = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu_items.insert_for_dummies_item));
	vi_set_insert_for_dummies(enabled);
	ui_set_statusbar(FALSE, _("Insert Mode for Dummies: %s"), enabled ? _("ON") : _("OFF"));
	save_config();
}
Пример #17
0
static void cliSave(char *cmdline)
{
    if(save_config())
        cliPrint("data saved");
    else 
        cliPrint("failed");
}
Пример #18
0
void CMultiMoveClientDlg::OnBnClickedButtonQuit()
{
		// TODO: Add your control notification handler code here
		save_config();

		if(m_up_is_connected)
		{
				OnBnClickedButtonUpConnect();
		}

		if(m_down_is_connected)
		{
				OnBnClickedButtonDownConnect();
		}

		if(m_left_is_connected)
		{
				OnBnClickedButtonLeftConnect();
		}

		if(m_right_is_connected)
		{
				OnBnClickedButtonRightConnect();
		}


		CDialogEx::OnOK();
}
Пример #19
0
GtkWidget *create_lavrec_layout(GtkWidget *window)
{
	GtkWidget *vbox, *hbox, *hbox2, *hbox3, *vbox2, *table;

	vbox = gtk_vbox_new(FALSE,0);
	hbox = gtk_hbox_new(FALSE,20);
	hbox2 = gtk_hbox_new(FALSE,20);

	tv = gtk_tvplug_new(port);
	if (port == -1)
		exit(1);
	else if (port == 0 && tv != NULL)
	{
		port = GTK_TVPLUG (tv)->port;
		save_config();
	}

	if (tv)
 	{
		hbox3 = create_video_sliders();
		gtk_box_pack_start (GTK_BOX (hbox2), hbox3, TRUE, FALSE, 10);
		gtk_widget_show(hbox3);
	}

	if (tv == NULL)
	{
		//return NULL;
		tv = gtk_event_box_new();
		set_background_color(tv, 0,0,0);
	}
	gtk_widget_set_usize(GTK_WIDGET(tv), tv_width_capture, tv_height_capture);
	gtk_box_pack_start (GTK_BOX (hbox2), tv, TRUE, FALSE, 10);
	gtk_widget_show(tv);

	vbox2 = create_audio_sliders();
	gtk_box_pack_start (GTK_BOX (hbox2), vbox2, TRUE, FALSE, 10);
	gtk_widget_show(vbox2);

	gtk_box_pack_start (GTK_BOX (vbox), hbox2, TRUE, TRUE, 20);
	gtk_widget_show(hbox2);

	vbox2 = create_buttons(gtk_vbox_new(FALSE, 0), window);
	hbox2 = gtk_hbox_new(FALSE, 20);
	gtk_box_pack_start (GTK_BOX (hbox2), vbox2, TRUE, TRUE, 20);
	gtk_widget_show(vbox2);

	table = gtk_table_new (2,9, FALSE);
	create_lavrec_logtable(table);
	gtk_box_pack_start (GTK_BOX (hbox2), table, TRUE, TRUE, 20);
	gtk_widget_show(table);

	gtk_box_pack_start (GTK_BOX (vbox), hbox2, TRUE, TRUE, 20);
	gtk_widget_show(hbox2);

	gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, FALSE, 20);
	gtk_widget_show(vbox);

	return hbox;
}
ui_element_config::ptr wsh_panel_window_dui::get_configuration()
{
	ui_element_config_builder builder;
	abort_callback_dummy abort;

	save_config(&builder.m_stream, abort);
	return builder.finish(g_get_guid());
}
Пример #21
0
void
plugin_cleanup (void)
{
  detach_browser ();
  
  gwh_keybindings_cleanup ();
  save_config ();
}
Пример #22
0
gboolean
save_setup (gboolean save_options, gboolean save_panel_options)
{
    gboolean ret = TRUE;

    saving_setup = 1;

    save_hotlist ();

    if (save_panel_options)
        save_panel_types ();

    if (save_options)
    {
        char *tmp_profile;

        save_config ();
        save_layout ();
        panels_save_options ();
        save_panelize ();
        /* directory_history_save (); */

#ifdef ENABLE_VFS_FTP
        mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "ftpfs_password",
                              ftpfs_anonymous_passwd);
        if (ftpfs_proxy_host)
            mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "ftp_proxy_host",
                                  ftpfs_proxy_host);
#endif /* ENABLE_VFS_FTP */

#ifdef HAVE_CHARSET
        mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "display_codepage",
                              get_codepage_id (mc_global.display_codepage));
        mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "source_codepage",
                              get_codepage_id (default_source_codepage));
        mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "autodetect_codeset",
                              autodetect_codeset);
#endif /* HAVE_CHARSET */

#ifdef HAVE_ASPELL
        mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "spell_language",
                              spell_language);
#endif /* HAVE_ASPELL */

        mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "clipboard_store",
                              clipboard_store_path);
        mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "clipboard_paste",
                              clipboard_paste_path);

        tmp_profile = mc_config_get_full_path (MC_CONFIG_FILE);
        ret = mc_config_save_to_file (mc_main_config, tmp_profile, NULL);
        g_free (tmp_profile);
    }

    saving_setup = 0;

    return ret;
}
Пример #23
0
static void
cb_close(void *data)
{
   save_config();
   Epplet_unremember();
   Esync();
   exit(0);
   data = NULL;
}
Пример #24
0
void usb_tasks() {
    // User Application USB tasks
    if (USBDeviceState < CONFIGURED_STATE || USBSuspendControl == 1)
        return;
    
    // Check if we have received an OUT data packet from the host, and nothing is left in buffer
    if (!HIDRxHandleBusy(USBOutHandleCfg) && !HIDTxHandleBusy(USBInHandleCfg)) {
        // We just received a packet of data from the USB host.
        // Check the first byte of the packet to see what command the host
        // application software wants us to fulfill.
        uint8_t cmd = usbOutBuffer[0];
        if (cmd == CFG_CMD_READ) {
            // format response
            cfg_read_report_t* report = (cfg_read_report_t*)usbInBuffer;
            report->command_id = CFG_CMD_READ;
            report->fw_major = FW_MAJOR;
            report->fw_minor = FW_MINOR;
            report->hw_revision = HW_REVISION;
            report->device_type = MUNIA_DEVICETYPE;

            uint8_t* r = &report->devid1;
            TBLPTR = 0x3FFFFF;
            asm("tblrd*-");
            *r++ = TABLAT;
            asm("tblrd*");
            *r = TABLAT;
            TBLPTRU = 0;

            memcpy(&report->config, &config, sizeof(config_t));
            memset(usbInBuffer + sizeof(cfg_read_report_t), 0, sizeof(usbInBuffer) - sizeof(cfg_read_report_t));       
            
            USBInHandleCfg = HIDTxPacket(HID_EP_CFG, usbInBuffer, CFG_CMD_REPORT_SIZE);
        }
        else if (cmd == CFG_CMD_WRITE) {
            // extract config
            cfg_write_report_t* report = (cfg_write_report_t*)usbOutBuffer;
            memcpy(&config, &report->config, sizeof(config_t));
            save_config();
            apply_config();
            
            // response
            usbInBuffer[0] = CFG_CMD_WRITE;
            usbInBuffer[1] = 1; // signifies ok
            memset(usbInBuffer + 2, 0, sizeof(usbInBuffer) - 2);
            
            USBInHandleCfg = HIDTxPacket(HID_EP_CFG, usbInBuffer, CFG_CMD_REPORT_SIZE);
        }
        
        else if (cmd == CFG_CMD_ENTER_BL) {
            // dbgs("jumping to bootloader\n");
            asm("goto 0x001C");
        }
        
        // re-arm
        USBOutHandleCfg = HIDRxPacket(HID_EP_CFG, usbOutBuffer, sizeof (usbOutBuffer));
    }
}
Пример #25
0
static void on_enable_vim_mode(void)
{
	gboolean enabled = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu_items.enable_vim_item));
	vi_set_enabled(enabled);
	vi_set_mode(start_in_insert ? VI_MODE_INSERT : VI_MODE_COMMAND);
	if (!enabled)
		ui_set_statusbar(FALSE, "Vim Mode Disabled");
	save_config();
}
Пример #26
0
active_protocol_c::~active_protocol_c()
{
    save_config(true);
    stop_and_die(true);
    if (gui)
    {
        gui->delete_event(DELEGATE(this,check_die));
        gui->delete_event(DELEGATE(this,check_save));
    }
}
Пример #27
0
void leave(GtkWidget *widget, gpointer *data)
{
    draw_stop();
    save_config(widget);
    input_thread_stopper(data_handle);
    close_datasource(data_handle);
    /* Free all buffers */
    mem_dealloc();
    gtk_main_quit();
}
Пример #28
0
// permanently writes all changes
bool
SimpleConfig::flush()
{
    if (!valid ()) return false;

    // If no config has been modified, then just return.
    if (!m_new_config.size () && !m_erased_keys.size ())
        return true;

    String userconf     = get_userconf_filename ();
    String userconf_dir = get_userconf_dir ();

    if (access (userconf_dir.c_str (), R_OK | W_OK) != 0) {
        mkdir (userconf_dir.c_str (), S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
        if (access (userconf_dir.c_str (), R_OK | W_OK) != 0)
            return false;
    }

    if (userconf.length ()) {
        // Reload config to ensure user made modification won't lost.
        load_all_config ();

        std::ofstream os (userconf.c_str ());
        if (!os) return false;

        KeyValueRepository::iterator i;
        std::vector<String>::iterator j;

        // Merge new config with old ones.
        for (i = m_new_config.begin (); i != m_new_config.end (); ++i)
            m_config [i->first] = i->second;

        // Remove all erased keys.
        for (j = m_erased_keys.begin (); j != m_erased_keys.end (); ++j) {
            if ((i = m_config.find (*j)) != m_config.end ())
                m_config.erase (i);
        }

        m_new_config.clear ();
        m_erased_keys.clear ();

        gettimeofday (&m_update_timestamp, 0);

        char buf [128];
        snprintf (buf, 128, "%lu:%lu", m_update_timestamp.tv_sec, m_update_timestamp.tv_usec);

        m_config [String (SCIM_CONFIG_UPDATE_TIMESTAMP)] = String (buf);

        save_config (os);
        return true;
    }

    return false;
}
Пример #29
0
static void
ok_cb(void *data)
{
   apply_config();
   save_config();
   Epplet_window_destroy(confwin);
   confwin = 0;

   return;
   data = NULL;
}
Пример #30
0
void CommandLineHandler::print_program_usage(
    const char*     program_name,
    SuperLogger&    logger) const
{
    SaveLogFormatterConfig save_config(logger);
    logger.set_format(LogMessage::Info, "{message}");

    LOG_INFO(logger, "usage: %s [options] input.appleseed output.appleseed", program_name);
    LOG_INFO(logger, "options:");

    parser().print_usage(logger);
}