int musainit() { midasSetDefaults(); MIDASstartup(); if (!MIDASdetectSoundCard()) MIDASerror(); refreshRate = MIDASgetDisplayRefreshRate(); if ( refreshRate == 0 ) { /* cout << "Warning! Unable to synchronize to display refresh!\n"; if ( getch() == 27 ) return 0;*/ refreshRate = 70000; /* default 70Hz */ } if ( !MIDASinit() ) MIDASerror(); if ( (error = vuInit()) != OK ) midasError(error); if ( !MIDASsetTimerCallbacks(refreshRate, TRUE, &prevr, NULL, NULL) ) MIDASerror(); return 0; }
static int MIDAS_detect(struct mpxplay_audioout_info_s *aui) { unsigned int iscard,len; char midascnffile[300]; pds_getpath_from_fullname(midascnffile,freeopts[OPT_PROGNAME]); len=pds_strlen(midascnffile); if(len && (midascnffile[len-1]!=PDS_DIRECTORY_SEPARATOR_CHAR)) len+=pds_strcpy(&midascnffile[len],PDS_DIRECTORY_SEPARATOR_STR); pds_strcpy(&midascnffile[len],"mpxmidas.ini"); MIDASstartup(); MIDASsetOption(MIDAS_OPTION_MIXING_MODE,1); if(aui->card_controlbits&AUINFOS_CARDCNTRLBIT_MIDASMANUALCFG){ iscard=MIDASconfig(); MIDASsaveConfig(midascnffile); }else{ iscard=MIDASloadConfig(midascnffile); if(!iscard) iscard=MIDASdetectSoundCard(); } iscard+=MIDASinit(); iscard+=MIDASopenChannels(2); if(iscard==3){ midashandle=MIDASplayStreamPolling(4,aui->freq_card,1000); if(midashandle){ MIDASpauseStream(midashandle); iscard++; } } if(iscard<4){ pds_textdisplay_printf("MIDAS error: "); pds_textdisplay_printf(MIDASgetErrorMessage(MIDASgetLastError())); MIDASclose(); return 0; } return 1; }