int set_iface(const char *iface, int on) { int u4Count = 0; if(ifc_init() != 0) { LOGE("[%s] interface set %d failed", iface, on); return -1; } if(on) { while(ifc_up(iface) == -1) { LOGD("[%s] interface is not ready, wait %dus", iface, SET_IFACE_DELAY); sched_yield(); usleep(SET_IFACE_DELAY); if (++u4Count >= SET_IFACE_POLLING_LOOP) { LOGE("[%s] interface set %d failed", iface, on); ifc_close(); return -1; } } LOGD("[%s] interface is up", iface); init_iface(iface); } else { ifc_down(iface); LOGD("[%s] interface is down", iface); } ifc_close(); return 0; }
/* Device and transport to be used are determined by minimum latency */ static ucs_status_t dev_tl_lookup(const char *dev_name, const char *tl_name, struct iface_info *iface_p) { int i; int j; ucs_status_t status; uct_md_resource_desc_t *md_resources; /* Memory domain resource descriptor */ uct_tl_resource_desc_t *tl_resources; /*Communication resource descriptor */ unsigned num_md_resources; /* Number of protected domain */ unsigned num_tl_resources; /* Number of transport resources resource objects created */ uct_md_config_t *md_config; status = uct_query_md_resources(&md_resources, &num_md_resources); CHKERR_JUMP(UCS_OK != status, "query for protected domain resources", error_ret); /* Iterate through protected domain resources */ for (i = 0; i < num_md_resources; ++i) { status = uct_md_config_read(md_resources[i].md_name, NULL, NULL, &md_config); CHKERR_JUMP(UCS_OK != status, "read PD config", release_pd); status = uct_md_open(md_resources[i].md_name, md_config, &iface_p->pd); uct_config_release(md_config); CHKERR_JUMP(UCS_OK != status, "open protected domains", release_pd); status = uct_md_query_tl_resources(iface_p->pd, &tl_resources, &num_tl_resources); CHKERR_JUMP(UCS_OK != status, "query transport resources", close_pd); /* Go through each available transport and find the proper name */ for (j = 0; j < num_tl_resources; ++j) { if (!strcmp(dev_name, tl_resources[j].dev_name) && !strcmp(tl_name, tl_resources[j].tl_name)) { status = init_iface(tl_resources[j].dev_name, tl_resources[j].tl_name, iface_p); if (UCS_OK == status) { printf("Using %s with %s.\n", tl_resources[j].dev_name, tl_resources[j].tl_name); fflush(stdout); uct_release_tl_resource_list(tl_resources); goto release_pd; } } } uct_release_tl_resource_list(tl_resources); uct_md_close(iface_p->pd); } fprintf(stderr, "No supported (dev/tl) found (%s/%s)\n", dev_name, tl_name); status = UCS_ERR_UNSUPPORTED; release_pd: uct_release_md_resource_list(md_resources); error_ret: return status; close_pd: uct_md_close(iface_p->pd); goto release_pd; }
void Model::init() { read_instr (); read_presets (); // init audio Divis* D = _divis; for (int d = 0; d < _ndivis; d++, D++) { M_new_divis* M = new M_new_divis (); M->_flags = D->_flags; M->_dmask = D->_dmask; M->_asect = D->_asect; M->_swell = D->_param [Divis::SWELL].fval(); M->_tfreq = D->_param [Divis::TFREQ].fval(); M->_tmodd = D->_param [Divis::TMODD].fval(); _aeolus->newDivis(M); } init_iface(); init_ranks(MT_LOAD_RANK); init_ranks(MT_SAVE_RANK); }