int virtualizer_init(effect_context_t *context) { ALOGV("%s", __func__); virtualizer_context_t *virt_ctxt = (virtualizer_context_t *)context; context->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ; context->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO; context->config.inputCfg.format = AUDIO_FORMAT_PCM_16_BIT; context->config.inputCfg.samplingRate = 44100; context->config.inputCfg.bufferProvider.getBuffer = NULL; context->config.inputCfg.bufferProvider.releaseBuffer = NULL; context->config.inputCfg.bufferProvider.cookie = NULL; context->config.inputCfg.mask = EFFECT_CONFIG_ALL; context->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE; context->config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO; context->config.outputCfg.format = AUDIO_FORMAT_PCM_16_BIT; context->config.outputCfg.samplingRate = 44100; context->config.outputCfg.bufferProvider.getBuffer = NULL; context->config.outputCfg.bufferProvider.releaseBuffer = NULL; context->config.outputCfg.bufferProvider.cookie = NULL; context->config.outputCfg.mask = EFFECT_CONFIG_ALL; set_config(context, &context->config); virt_ctxt->temp_disabled = false; memset(&(virt_ctxt->offload_virt), 0, sizeof(struct virtualizer_params)); return 0; }
int bassboost_init(effect_context_t *context) { bassboost_context_t *bass_ctxt = (bassboost_context_t *)context; ALOGV("%s: ctxt %p", __func__, bass_ctxt); context->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ; context->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO; context->config.inputCfg.format = AUDIO_FORMAT_PCM_16_BIT; context->config.inputCfg.samplingRate = 44100; context->config.inputCfg.bufferProvider.getBuffer = NULL; context->config.inputCfg.bufferProvider.releaseBuffer = NULL; context->config.inputCfg.bufferProvider.cookie = NULL; context->config.inputCfg.mask = EFFECT_CONFIG_ALL; context->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE; context->config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO; context->config.outputCfg.format = AUDIO_FORMAT_PCM_16_BIT; context->config.outputCfg.samplingRate = 44100; context->config.outputCfg.bufferProvider.getBuffer = NULL; context->config.outputCfg.bufferProvider.releaseBuffer = NULL; context->config.outputCfg.bufferProvider.cookie = NULL; context->config.outputCfg.mask = EFFECT_CONFIG_ALL; set_config(context, &context->config); bass_ctxt->hw_acc_fd = -1; bass_ctxt->temp_disabled = false; memset(&(bass_ctxt->offload_bass), 0, sizeof(struct bass_boost_params)); return 0; }
static void slide_callback(mtk_event *e, void *arg) { unsigned int control = (unsigned int)arg; unsigned int val; char *guiname; guiname = NULL; switch(control) { case CONTROL_BRIGHTNESS: guiname = "s_brightness.value"; break; case CONTROL_CONTRAST: guiname = "s_contrast.value"; break; case CONTROL_HUE: guiname = "s_hue.value"; break; default: return; } val = mtk_req_i(appid, guiname); set_value(control, val); set_config(); }
void write_default_param_file() { /* all LEDs for 1.5 seconds */ #if 0 timers.led_on_a=150; timers.led_on_b=150; timers.led_on_c=150; timers.led_on_d=150; #else output_high(LED_A); output_high(LED_B); output_high(LED_C); output_high(LED_D); delay_ms(1500); output_low(LED_A); output_low(LED_B); output_low(LED_C); output_low(LED_D); #endif set_config(); /* write them so next time we use from EEPROM */ write_param_file(); }
exported int mrpc_set_accept_backoff(struct mrpc_conn_set *set, unsigned ms) { if (set == NULL || ms == 0) return EINVAL; set_config(set, accept_backoff, ms); return 0; }
static int show_range_int (CmdConfig *cmd_config, CameraWidget *range) { CDKSLIDER *slider = NULL; float value, min, max, increment; const char *label; char title[1024]; int selection; CHECK (gp_widget_get_value (range, &value)); CHECK (gp_widget_get_label (range, &label)); snprintf (title, sizeof (title), "<C></5>%s", label); CHECK (gp_widget_get_range (range, &min, &max, &increment)); slider = newCDKSlider (cmd_config->screen, CENTER, CENTER, title, _("Value: "), '-', 50, (int) value, min, max, increment, MAX (increment, (max - min)/20.0), TRUE, FALSE); if (!slider) return (GP_ERROR); selection = activateCDKSlider (slider, 0); if (slider->exitType == vNORMAL) { value = selection; gp_widget_set_value (range, &value); set_config (cmd_config); } destroyCDKSlider (slider); return (GP_OK); }
int equalizer_init(effect_context_t *context) { ALOGV("%s: ctxt %p", __func__, context); equalizer_context_t *eq_ctxt = (equalizer_context_t *)context; context->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ; context->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO; context->config.inputCfg.format = AUDIO_FORMAT_PCM_16_BIT; context->config.inputCfg.samplingRate = 44100; context->config.inputCfg.bufferProvider.getBuffer = NULL; context->config.inputCfg.bufferProvider.releaseBuffer = NULL; context->config.inputCfg.bufferProvider.cookie = NULL; context->config.inputCfg.mask = EFFECT_CONFIG_ALL; context->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE; context->config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO; context->config.outputCfg.format = AUDIO_FORMAT_PCM_16_BIT; context->config.outputCfg.samplingRate = 44100; context->config.outputCfg.bufferProvider.getBuffer = NULL; context->config.outputCfg.bufferProvider.releaseBuffer = NULL; context->config.outputCfg.bufferProvider.cookie = NULL; context->config.outputCfg.mask = EFFECT_CONFIG_ALL; set_config(context, &context->config); memset(&(eq_ctxt->offload_eq), 0, sizeof(struct eq_params)); offload_eq_set_preset(&(eq_ctxt->offload_eq), INVALID_PRESET); return 0; }
static int show_text (CmdConfig *cmd_config, CameraWidget *text) { CDKENTRY *entry = NULL; const char *label, *value; char title[1024], *info; CHECK (gp_widget_get_value (text, &value)); CHECK (gp_widget_get_label (text, &label)); snprintf (title, sizeof (title), "<C></5>%s", label); entry = newCDKEntry (cmd_config->screen, CENTER, CENTER, title, _("Value: "), A_NORMAL, ' ', vMIXED, 40, 0, 256, TRUE, FALSE); if (!entry) return (GP_ERROR); setCDKEntryValue (entry, (char*) value); info = activateCDKEntry (entry, 0); if (entry->exitType == vNORMAL) { gp_widget_set_value (text, info); set_config (cmd_config); } destroyCDKEntry (entry); return (GP_OK); }
static int show_toggle (CmdConfig *cmd_config, CameraWidget *toggle) { CDKITEMLIST *list = NULL; int value, selection; const char *label; char title[1024], *info[] = {N_("Yes"), N_("No")}; CHECK (gp_widget_get_value (toggle, &value)); CHECK (gp_widget_get_label (toggle, &label)); snprintf (title, sizeof (title), "<C></5>%s", label); list = newCDKItemlist (cmd_config->screen, CENTER, CENTER, title, "", info, 2, 1 - value, TRUE, FALSE); if (!list) return (GP_ERROR); selection = activateCDKItemlist (list, 0); if (list->exitType == vNORMAL) { selection = 1 - selection; gp_widget_set_value (toggle, &selection); set_config (cmd_config); } destroyCDKItemlist (list); return (GP_OK); }
static int check_config(void) { DIR *dir; struct dirent *entry; char *name; int n; struct stat sb; char status[32]; char buf[1023]; listcnt=0; if((dir = opendir(DIRCHECK)) == NULL) return(1); for(;;) { if((entry = readdir(dir)) == NULL) { closedir(dir); return(1); } name = entry->d_name; if(!strcmp(name,".") || !strcmp(name,"..")) continue; sprintf(status, "%s/%s", DIRCHECK, name); if(stat(status, &sb)) continue; if(read_oneline(status, buf) < 0) continue; trim(buf);trim(name); set_config(name,buf,listcnt); listcnt++; } return(0); }
void General_Menu::apply_config() { QMap<QString,QString> config; config["external_editor"] = CHECK_TO_STRING(ui.use_external_editor->checkState()); config["editor"]=ui.editor_lineEdit->text(); config["help_path"]=ui.help_path_lineEdit->text(); config["terminal_font"]=config_font.toString(); config["terminal_foreground_color"]=foreground_color.name(); config["terminal_background_color"]=background_color.name(); config["terminal_error_color"]=error_color.name(); config["lines_in_terminal"]=ui.max_line_num_lineEdit->text(); config["lines_in_history"]=ui.lines_in_history_lineEdit->text(); config["cols_in_terminal"]=ui.max_col_in_terminal_lineEdit->text(); config["octave_arguments"]=ui.octaveArgs_lineEdit->text(); config["octave_path"]=ui.octave_path_lineEdit->text(); config["syntaxHighlighting"]=CHECK_TO_STRING(ui.syntaxHighlighting_checkBox->checkState()); config["bracketsMatch"]=CHECK_TO_STRING(ui.bracketsMatch_checkBox->checkState()); config["autoCompletion"]=CHECK_TO_STRING(ui.autoCompletion_checkBox->checkState()); config["simple_rcs"]=CHECK_TO_STRING(ui.simple_rcs_checkBox->checkState()); config["show_ide_commands"]=CHECK_TO_STRING(ui.show_ide_commands_checkBox->checkState()); config["qtinfo_ok"]=CHECK_TO_STRING(ui.qtinfo_ok_checkBox->checkState()); if(ui.autoindent_statements_radioButton->isChecked()) { config["autoindent"]="true"; config["autoindent_statements"]="true"; } else if(ui.autoindent_radioButton->isChecked()) { config["autoindent"]="true"; config["autoindent_statements"]="false"; } else { config["autoindent"]="false"; config["autoindent_statements"]="false"; } config["textEditFont"]=text_edit_font.family(); config["textEditFontSize"]=QString::number(text_edit_font.pointSize()); // Directory list QString str, tmp; QListWidgetItem *item; for(int i = 0; (item = ui.octaveDir_list->item(i)); i++) { tmp = item->text(); tmp.replace('"', "\\\""); str += "\"" + tmp + "\","; } config["octave_folders"] = str; config["easy_plot_active"] = CHECK_TO_STRING(ui.easy_plot_checkBox->checkState()); config["easy_plot_path"] = ui.easy_plot_path_lineEdit->text(); set_config(config); QMessageBox::information(this, "Note","Reload QtOctave to apply changes."); }
int SimulatedPockels::setOpenVolts( f64 volts ) { Config c = get_config(); c.set_v_open(volts); set_config(c); return 1; }
static int init_config(void) { GKeyFile *cfg; const char *path; char *file; gboolean loaded = FALSE; cfg = g_key_file_new(); path = g_get_user_config_dir(); file = g_build_filename(path, "lightpad/lightpad.cfg", NULL); g_free((gpointer)path); loaded = g_key_file_load_from_file(cfg, file, G_KEY_FILE_NONE, NULL); for(const char *const *dir = g_get_system_config_dirs(); !loaded && *dir; dir++) { file = g_build_filename(*dir, "/lightpad/lightpad.cfg", NULL); loaded = g_key_file_load_from_file(cfg, file, G_KEY_FILE_NONE, NULL); } if(loaded) set_config(cfg); else { g_fprintf(stderr, "Error: cannot find a configuration file!\nPlease make sure Lightpad is installed correctly.\n"); return -1; } g_free(file); g_key_file_free(cfg); return 0; }
void Server::recieveData() { QTcpSocket* tcpSocket = remote_server_socket; if (tcpSocket && tcpSocket->bytesAvailable()>0) { int size = tcpSocket->bytesAvailable(); QDataStream in(tcpSocket); in.setVersion(QDataStream::Qt_4_0); char *mem = new char[size]; in.readRawData(mem, size); QString message = QString::fromUtf8(mem, size); delete mem; emit write_message(tr("Recieved data (size=%1) from %2. Content: \"%3\"").arg(size).arg(tcpSocket->peerAddress().toString()).arg(message)); if (!is_config_mode) { QHash<QString, ClientAction *>::const_iterator i = actions->constBegin(); while (i != actions->constEnd()) { if (i.value() && i.value()->isEnabled() && !i.value()->getPrefix().isEmpty() && message.startsWith(i.value()->getPrefix()+"=")) { QString params_message = message; params_message.replace(QRegExp("^("+i.value()->getPrefix()+")\\="), ""); i.value()->setParamsFromMessage(params_message); i.value()->runAction(); } ++i; } } else if(message.startsWith("DS_SETUP:\r\n")) { QStringList params_message = message.split("\r\n"); params_message.removeFirst(); if (!params_message.isEmpty() && params_message.length()>=4) { device_id = params_message.value(3, "0").toInt(); remoteIPAddress = params_message.value(2, ""); emit set_config(remoteIPAddress, device_id); } } } }
exported int mrpc_set_keepalive_enabled(struct mrpc_conn_set *set, int enabled) { if (set == NULL) return EINVAL; set_config(set, keepalive_enabled, enabled); return 0; }
exported int mrpc_set_max_buf_len(struct mrpc_conn_set *set, unsigned len) { if (set == NULL || len == 0) return EINVAL; set_config(set, msg_max_buf_len, len); return 0; }
exported int mrpc_set_listen_backlog(struct mrpc_conn_set *set, unsigned backlog) { if (set == NULL || backlog == 0) return EINVAL; set_config(set, listen_backlog, backlog); return 0; }
exported int mrpc_set_ioerr_func(struct mrpc_conn_set *set, mrpc_ioerr_fn *func) { if (set == NULL) return EINVAL; set_config(set, ioerr, func); return 0; }
exported int mrpc_set_disconnect_func(struct mrpc_conn_set *set, mrpc_disconnect_fn *func) { if (set == NULL) return EINVAL; set_config(set, disconnect, func); return 0; }
exported int mrpc_set_accept_func(struct mrpc_conn_set *set, mrpc_accept_fn *func) { if (set == NULL || !set->protocol->is_server || func == NULL) return EINVAL; set_config(set, accept, func); return 0; }
lsh::lsh( const config& conf, jubatus::util::lang::shared_ptr<storage::column_table> table, const std::string& id) : bit_vector_nearest_neighbor_base(conf.hash_num, table, id) { set_config(conf); }
static void ok_callback(mtk_event *e, void *arg) { w_open = 0; close_dmxspy_window(); close_dmxdesk_window(); mtk_cmd(appid, "w.close()"); set_config(); }
int pre_do_module(char *module, filelist_t *files, char *path, char *argv[], struct subdir_list *subdirs) { void *handle; module_list_t *module_func; module_list_t* (*module_loader)(); void (*set_config)(hashtable_t *ht); char *err; pre_log("MODULE", "%s", module); handle = dlopen(module, RTLD_LAZY); if (!handle) { err = dlerror(); pre_log("MODULE-ERROR", "%s \"%s\"", module, err); printf("Error loading module %s: %s\n", module, err); return 0; } module_loader = dlsym(handle, MODULE_LOADER_FUNC); set_config = dlsym(handle, MODULE_SETCONFIG_FUNC); if (!module_loader || !set_config) { pre_log("MODULE-ERROR", "%s %s", module, "No loader func found"); printf("Error loading module %s: No loader func found\n"); dlclose(handle); return 0; } pre_log("MODULE-RUN", "%s %s", module, path); set_config(get_config()); // try to set environment if module allows. set_config = dlsym(handle, MODULE_SETENV_FUNC); if (set_config) set_config(get_context()); pre_exec_module(module_loader(), files, path, argv, subdirs); pre_log("MODULE-DONE", "%s %s", module, path); dlclose(handle); return 1; }
int16_t MeUSBHost::initHIDDevice() { int16_t irq, len, address; if(usbtype==USB1_0) set_freq(); //work on a lower freq, necessary for ch375 irq = get_desr(1); #ifdef CH375_DBG Serial.printf("get des irq:%x\n",irq); #endif if(irq==USB_INT_SUCCESS){ len = rd_usb_data( RECV_BUFFER ); #ifdef CH375_DBG Serial.printf("descr1 len %d type %x\r\n",len,p_dev_descr->bDescriptorType); #endif irq = set_addr(2); if(irq==USB_INT_SUCCESS){ irq = get_desr(2); // max buf 64byte, todo:config descr overflow if(irq==USB_INT_SUCCESS){ len = rd_usb_data( RECV_BUFFER ); #ifdef CH375_DBG Serial.printf("descr2 len %d class %x subclass %x\r\n",len,p_cfg_descr->itf_descr.bInterfaceClass, p_cfg_descr->itf_descr.bInterfaceSubClass); // interface class should be 0x03 for HID Serial.printf("num of ep %d\r\n",p_cfg_descr->itf_descr.bNumEndpoints); Serial.printf("ep0 %x %x\r\n",p_cfg_descr->endp_descr[0].bLength, p_cfg_descr->endp_descr[0].bDescriptorType); #endif if(p_cfg_descr->endp_descr[0].bDescriptorType==0x21){ // skip hid des tmpEp = (PUSB_ENDP_DESCR)((int8_t*)(&(p_cfg_descr->endp_descr[0]))+p_cfg_descr->endp_descr[0].bLength); // get the real ep position } #ifdef CH375_DBG Serial.printf("endpoint %x %x\r\n",tmpEp->bEndpointAddress,tmpEp->bDescriptorType); #endif endp_out_addr=endp_in_addr=0; address =tmpEp->bEndpointAddress; /* Address of First EndPoint */ // actually we only care about the input end points if( address&0x80 ){ endp_in_addr = address&0x0f; /* Address of IN EndPoint */ }else{ /* OUT EndPoint */ endp_out_addr = address&0x0f; endp_out_size = p_cfg_descr->endp_descr[0].wMaxPacketSize; /* Length of Package for Received Data EndPoint */ if( endp_out_size == 0 || endp_out_size > 64 ) endp_out_size = 64; } // todo: some joystick with more than 2 node // just assume every thing is fine, bring the device up irq = set_config(p_cfg_descr->cfg_descr.bConfigurationvalue); if(irq==USB_INT_SUCCESS){ CH375_WR( CMD_SET_RETRY ); // set the retry times CH375_WR( 0x25 ); CH375_WR( 0x85 ); device_ready = true; return 1; } } } } return 0; }
euclid_lsh::euclid_lsh( const config& conf, jubatus::util::lang::shared_ptr<column_table> table, vector<column_type>& schema, const std::string& id) : nearest_neighbor_base(table, id) { set_config(conf); fill_schema(schema); }
static void close_callback(mtk_event *e, void *arg) { format = old_format; brightness = old_brightness; contrast = old_contrast; hue = old_hue; set_config(); close_videoin_window(); }
/* load_config_file: * Does the work of loading a config file. */ static void load_config_file(CONFIG **config, char *filename, char *savefile) { int length = file_size(filename); if (length > 0) { FILE *f = fopen(filename, "r"); if (f) { char *tmp = (char *) malloc(length); fread(tmp, 1, length, f); fclose(f); set_config(config, tmp, length, savefile); free(tmp); } else set_config(config, NULL, 0, savefile); } else set_config(config, NULL, 0, savefile); }
int main(int argc, char** argv) { char p[512]; char *server_mem; char *client_mem; int client_size; int server_size; force_net_dev_linked(); cyg_do_net_init(); SetWlanESSID("zhuna"); #ifdef MP4 sprintf(p, g_RtspServer_conf, "IMAADPCM", "Mpeg4", "Mpeg4", "IMAADPCM"); #else sprintf(p, g_RtspServer_conf, "AMR", "H263", "H263", "AMR"); #endif set_config(p); cyg_semaphore_init(&video_sem0, 0); cyg_semaphore_init(&video_sem1, 0); cyg_semaphore_init(&audio_sem0, 0); cyg_semaphore_init(&audio_sem1, 0); cyg_interrupt_disable(); cyg_interrupt_disable(); cyg_interrupt_disable(); cyg_interrupt_enable(); set_auth_id("jfyan","jfyanpass"); set_auth_id("jfyan1","jfyan1"); set_auth_id("jfyan2","jfyan2"); del_auth_id("jfyan1","jfyan1"); //set_auth_disable(); VideoPhoneInit(); fmiSetFMIReferenceClock(112000); fmiSetSDOutputClockbykHz(18000); //FTH_Init(); init_wbdevice(initlcm); set_encoderenable(set_encoderenableFunc); set_encoderdisable(set_encoderdisableFunc); init_get_video(get_back_video); init_get_audio(get_back_audio); server_size = get_server_size(); server_mem = (char*)malloc(server_size); if(server_mem == NULL) printf("memory out\n"); rtsp_server_init(server_mem, server_size); client_size = get_rtspmem_size(3); client_mem = (char*)malloc(client_size); if(client_mem == NULL) printf("memory out\n"); rtsp_mem_init(client_mem, client_size); RtspServerStart(2); }
void git_repository__cleanup(git_repository *repo) { assert(repo); git_cache_clear(&repo->objects); git_attr_cache_flush(repo); git_submodule_cache_free(repo); set_config(repo, NULL); set_index(repo, NULL); set_odb(repo, NULL); set_refdb(repo, NULL); }
static int pxmxdx_enable(struct vclk *vclk) { struct pwrcal_vclk_pxmxdx *pxmxdx; int ret; pxmxdx = to_pxmxdx(vclk); ret = set_config(pxmxdx->clk_list, 0); if (ret) pr_err("pxmxdx_enable error (%s)", vclk->name); return ret; }