int MCOpenALSourceManager::assignSource(int EntityID, int EntityChannel) { int iIndexOldestAssignment = 0; unsigned int iOldestAssignment = alSource[0].Assignment; for(int i = 0; i < iNumSources; i++) { // this source is free if(alSource[i].Free) { assignSource(i, EntityID, EntityChannel); return i; } if(alSource[i].Assignment < iOldestAssignment) { iOldestAssignment = alSource[i].Assignment; iIndexOldestAssignment = i; } } // there are no free sources assignSource(iIndexOldestAssignment, EntityID, EntityChannel); alSourceStop(alSource[iIndexOldestAssignment].Source); return iIndexOldestAssignment; }
int main() { // FRAGMENT(example) // The horizontal and vertical sequence (database and query). seqan::CharString seqH = "The quick BROWN fox jumped again!"; seqan::CharString seqV = "thick BROWN boxes of brownies!"; // ^^^ // Create seed and print the seeed sequence. seqan::Seed<seqan::Simple> seed(11, 7, 14, 10); // Perform match extension. seqan::Score<int, seqan::Simple> scoringScheme(1, -1, -1); extendSeed(seed, seqH, seqV, seqan::EXTEND_BOTH, scoringScheme, 3, seqan::UnGappedXDrop()); // Perform a banded alignment. seqan::Align<seqan::CharString> align; resize(rows(align), 2); assignSource(row(align, 0), infix(seqH, beginPositionH(seed), endPositionH(seed))); assignSource(row(align, 1), infix(seqV, beginPositionV(seed), endPositionV(seed))); // TODO(holtgrew): Use seed diagonals as bands. globalAlignment(align, scoringScheme); std::cerr << "Resulting alignment\n" << align << "\n"; // FRAGMENT(footer) return 0; }
PairwiseAlignment _pairwise_global(const std::string& ref, const std::string& qry, const int match_score, const int mismatch_score, const int gap_open, const int gap_extend) { typedef String<char> TSequence; typedef Align<TSequence,ArrayGaps> TAlign; typedef Row<TAlign>::Type TRow; typedef Iterator<TRow>::Type TRowIterator; TAlign align; resize(rows(align), 2); assignSource(row(align, 0), ref); assignSource(row(align, 1), qry); Score<int,Simple> score_scheme(match_score, mismatch_score, gap_extend, gap_open); AlignConfig<false,QGAP,false,QGAP> a_config; PairwiseAlignment result; result.score = globalAlignment(align, score_scheme, a_config); result.aligned_ref = aligned_string(row(align, 0)); result.aligned_qry = aligned_string(row(align, 1)); return result; }
Session::Session(SessionManager* parent, DataSource* source) { m_zoneMgr = NULL; m_mapMgr = NULL; m_groupMgr = NULL; m_guildMgr = NULL; m_guildShell = NULL; m_player = NULL; m_spawnMonitor = NULL; m_spawnShell = NULL; m_spellShell = NULL; m_filterMgr = NULL; m_messages = NULL; m_messageFilters = NULL; m_messageShell = NULL; m_parent = parent; m_preferences = parent->preferences(); m_timer = new QTimer(this); m_delay = 1000; m_dataSource = 0; /*********************************************************************** * Create Message Objects **********************************************************************/ // Create message filters object m_messageFilters = new MessageFilters(this, "messagefilters"); // Create messages storage m_messages = new Messages(m_parent->dateTimeMgr(), m_messageFilters, this, "messages"); // Create the terminal object m_terminal = new Terminal(m_messages, this, "terminal"); /*********************************************************************** * Create ShowEQ Objects **********************************************************************/ // Create the Zone Manager m_zoneMgr = new ZoneMgr(this, "zonemgr"); // Create the Guild Manager QString fileName = m_preferences->getPrefString("GuildsFile", "Interface", "guilds2.dat"); QFileInfo fileInfo = m_parent->dataLocationMgr()->findWriteFile("tmp", fileName); m_guildMgr = new GuildMgr(fileInfo.absFilePath(), this, "guildmgr"); // Create the Player Object m_player = new Player(this, m_zoneMgr, m_guildMgr); // Create the filter manager QString filterFile = pSEQPrefs->getPrefString("FilterFile", "Interface", "global.xml"); bool isCaseSensitive = pSEQPrefs->getPrefBool("IsCaseSensitive", "Interface", false); m_filterMgr = new FilterMgr(m_parent->dataLocationMgr(), filterFile, isCaseSensitive); // if there is a short zone name already, try to load its filters // (there isn't one, this should be removed) QString shortZoneName = m_zoneMgr->shortZoneName(); if (!shortZoneName.isEmpty() && shortZoneName != "unknown") m_filterMgr->loadZone(shortZoneName); // Create the Guild Shell m_guildShell = new GuildShell(m_zoneMgr, this, "GuildShell"); // Create the Spawn Shell m_spawnShell = new SpawnShell(*m_filterMgr, m_zoneMgr, m_player, m_guildMgr); // Create the Map Manager m_mapMgr = new MapMgr(m_parent->dataLocationMgr(), m_spawnShell, m_player, m_zoneMgr); // Create the Spell Shell m_spellShell = new SpellShell(m_player, m_spawnShell, m_parent->spells()); // Create the Spawn Monitor m_spawnMonitor = new SpawnMonitor(m_parent->dataLocationMgr(), m_zoneMgr, m_spawnShell); // Create the Group Manager m_groupMgr = new GroupMgr(m_spawnShell, m_player, this, "groupmgr"); // Create the message shell m_messageShell = new MessageShell(m_messages, m_parent->eqStrings(), m_parent->spells(), m_zoneMgr, m_spawnShell, m_player, this, "messageshell"); // Create the Filter Notification object m_filterNotifications = new FilterNotifications(this, "filternotifications"); attachSignals(); assignSource(source); }