int Spatializer<SPATIALIZER_CALLBACK_IMPL>::addSoundSource(std::string &soundName) { printf("Function %s, file %s, line %d: About to add the sound source %s\n", __func__, __FILE__, __LINE__, soundName.c_str()); std::string fnameStr(soundName); apf::parameter_map params; params.set("audio_file_name", fnameStr); printf("Function %s, file %s, line %d: About to add the sound source %s\n", __func__, __FILE__, __LINE__, soundName.c_str()); if (renderer.get() == nullptr) std::cout << "Renderer is null!" << std::endl; int sourceID = renderer->add_source(params); printf("Function %s, file %s, line %d: Added the sound source %s\n", __func__, __FILE__, __LINE__, soundName.c_str()); static_cast<SPATIALIZER_CALLBACK_IMPL*>(this)->soundAddedCallback(fnameStr); num_sources_in_renderer++; printf("Function %s, line %d: Added successfully the sound source %s\n", __func__, __LINE__, soundName.c_str()); return sourceID; }
// Load optimized defaults from GeneticOptimizer runs void GlobalDefaultsForBkgModel::SetGoptDefaults ( char *fname ) { if(fname == NULL) return; std::string fnameStr(fname); bool isJson = false; //default is .param //check file format based on suffix if (boost::algorithm::ends_with(fnameStr, ".json")) isJson = true; //json way if(isJson){ Json::Value gopt_params; std::ifstream in(fname, std::ios::in); if (!in.good()) { printf("Opening gopt parameter file %s unsuccessful. Aborting\n", fname); exit(1); } in >> gopt_params; const Json::Value km_const = gopt_params["parameters"]["km_const"]; for ( int index = 0; index < (int) km_const.size(); ++index ) region_param_start.kmax_default[index] = km_const[index].asFloat(); const Json::Value krate = gopt_params["parameters"]["krate"]; for ( int index = 0; index < (int) krate.size(); ++index ) region_param_start.krate_default[index] = krate[index].asFloat(); const Json::Value d_coeff = gopt_params["parameters"]["d_coeff"]; for ( int index = 0; index < (int) d_coeff.size(); ++index ) region_param_start.d_default[index] = d_coeff[index].asFloat(); const Json::Value sigma_mult = gopt_params["parameters"]["sigma_mult"]; for ( int index = 0; index < (int) sigma_mult.size(); ++index ) region_param_start.sigma_mult_default[index] = sigma_mult[index].asFloat(); const Json::Value t_mid_nuc_delay = gopt_params["parameters"]["t_mid_nuc_delay"]; for ( int index = 0; index < (int) t_mid_nuc_delay.size(); ++index ) region_param_start.t_mid_nuc_delay_default[index] = t_mid_nuc_delay[index].asFloat(); region_param_start.sens_default = gopt_params["parameters"]["sens"].asFloat(); region_param_start.molecules_to_micromolar_conv = gopt_params["parameters"]["molecules_to_micromolar_conv"].asFloat(); region_param_start.tau_R_m_default = gopt_params["parameters"]["tau_R_m"].asFloat(); region_param_start.tau_R_o_default = gopt_params["parameters"]["tau_R_o"].asFloat(); const Json::Value emphasis = gopt_params["parameters"]["emphasis"]; for ( int index = 0; index < (int) emphasis.size(); ++index ) data_control.emp[index] = emphasis[index].asFloat(); data_control.emphasis_ampl_default = gopt_params["parameters"]["emp_amplitude"].asFloat(); data_control.emphasis_width_default = gopt_params["parameters"]["emp_width"].asFloat(); const Json::Value clonal_call_scale = gopt_params["parameters"]["clonal_call_scale"]; for ( int index = 0; index < (int) clonal_call_scale.size(); ++index ) fitter_defaults.clonal_call_scale[index] = clonal_call_scale[index].asFloat(); fitter_defaults.shrink_factor = gopt_params["parameters"]["shrink_factor"].asFloat(); in.close(); } else{