int Open(int lSamprate, int wChannels, int wBitsPerSample, int bufferlenms, int prebufferms) { CMyEncCfg cfg; char OutFilename[MAX_PATH], *srcFilename=NULL; // buf[MAX_PATH], // *tsrcFilename; w_offset = writtentime = 0; numchan = wChannels; srate = lSamprate; bps = wBitsPerSample; strcpy(config_AACoutdir,cfg.OutDir); GetNewFileName(OutFilename); Cpcmaac=new Cfaac(); #ifdef USE_IMPORT_TAG /* GetWindowText(out.hMainWindow,buf,sizeof(buf)); tsrcFilename=getWASourceName(buf); srcFilename=Cpcmaac->getSourceFilename(cfg.TagSrcPath,tsrcFilename,cfg.TagSrcExt); FREE_ARRAY(tsrcFilename);*/ srcFilename=getSourceName(out.hMainWindow); #endif if(!Cpcmaac->Init(srcFilename,OutFilename,lSamprate,wBitsPerSample,wChannels,-1)) ERROR_O(0); FREE_ARRAY(srcFilename); return 0; }
std::ostream& GetOfs(const std::string& logName) { auto ofs_it = ofss.find(logName); if (ofs_it == ofss.end()) { std::unique_ptr<std::ofstream, OFSDeleter> new_ofs(new std::ofstream()); ofss.insert(make_pair(logName, move(new_ofs))); std::ofstream& ofs(*ofss[logName]); std::string fileName = GetNewFileName(logName); ofs.open(fileName); if (!ofs) { return std::cerr; //throw std::string("cannot open file " + fileName); } return ofs; } else { return *(*ofs_it).second; } }