params_t ReadParams(const ::std::string& path, char delimiter = ',') { params_t params; IFile* fp = detail::IFileSystem::New(); if( fp != NULL ) { if( fp->Open(path.c_str(), IFile::OpenRead) ) { const ::std::string dataset = fp->ReadAll(); ::std::string::size_type prev = 0; ::std::string::size_type pos = 0; while( pos = dataset.find(delimiter, prev), pos != ::std::string::npos ) { const ::std::string data = dataset.substr(prev, pos - prev); AppendParams(params, data); ++pos; prev = pos; } AppendParams(params, dataset.substr(prev)); } else { fprintf(stderr, "Unable to open file \"%s\".\n", path.c_str()); fflush(stderr); } detail::IFileSystem::Free(fp); } IUTEST_CHECK_(!params.empty()); return params; }
bool CAESinkALSA::TryDeviceWithParams(const std::string &name, const std::string ¶ms, snd_pcm_t **pcmp, snd_config_t *lconf) { if (!params.empty()) { std::string nameWithParams = name; AppendParams(nameWithParams, params); if (TryDevice(nameWithParams, pcmp, lconf)) return true; } /* Try the variant without extra parameters. * Custom devices often do not take the AESx parameters, for example. */ return TryDevice(name, pcmp, lconf); }