void QBSoundWin::stopAll() { //printf("stopAll\n"); QBSoundLocker locker(&mMutex); #ifdef __USE_OGG_VORBIS__ { PlayerList::iterator it = streamTrack.begin(); while(it != streamTrack.end()) { delete (*it).second; ++it; } streamTrack.clear(); } { EffectList::iterator it = sharedList().begin(); while(it != sharedList().end()) { delete (*it).second; ++it; } sharedList().clear(); } #endif return QBSound::stopAll(); }
void SimpleAudioEngine::setEffectsVolume(float volume) { EffectList::iterator iter; for (iter = sharedList().begin(); iter != sharedList().end(); iter++) { iter->second->SetVolume(int(volume * 100)); } }
void SimpleAudioEngine::resumeEffect(unsigned int nSoundId) { EffectList::iterator p = sharedList().find(nSoundId); if (p != sharedList().end()) { p->second->Resume(); } }
void SimpleAudioEngine::stopAllEffects() { EffectList::iterator iter; for (iter = sharedList().begin(); iter != sharedList().end(); iter++) { iter->second->Stop(); } }
float SimpleAudioEngine::getEffectsVolume() { EffectList::iterator iter; iter = sharedList().begin(); if (iter != sharedList().end()) { return float(iter->second->GetVolume()) / 100.f; } }
void SimpleAudioEngine::unloadEffect(const char* pszFilePath) { unsigned int nID = _Hash(pszFilePath); EffectList::iterator p = sharedList().find(nID); if (p != sharedList().end()) { delete p->second; p->second = nullptr; sharedList().erase(nID); } }
void SimpleAudioEngine::end() { sharedMusic().Close(); for (auto& iter : sharedList()) { delete iter.second; iter.second = nullptr; } sharedList().clear(); return; }
void SimpleAudioEngine::end() { sharedMusic().Close(); EffectList::iterator p = sharedList().begin(); while (p != sharedList().end()) { delete p->second; p->second = NULL; p++; } sharedList().clear(); }
unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop) { unsigned int nRet = _Hash(pszFilePath); preloadEffect(pszFilePath); EffectList::iterator p = sharedList().find(nRet); if (p != sharedList().end()) { p->second->Play((bLoop) ? -1 : 1); } return nRet; }
bool SimpleAudioEngine::isEffectPlaying(const char* pszFilePath) { unsigned int nRet = _Hash(pszFilePath); bool result = false; EffectList::iterator p = sharedList().find(nRet); if (p != sharedList().end()) { return p->second->IsPlaying(); } return result; }
void QBSoundWin::unloadEffect(const char* filename) { QBSoundLocker locker(&mMutex,"unloadEffect"); if (filename) { unsigned int nRet = _Hash(filename); EffectList::iterator p = sharedList().find(nRet); if (p != sharedList().end()) { delete p->second; p->second = NULL; sharedList().erase(nRet); } } }
unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop/* = false*/, float pitch/* = 1.0f*/, float pan/* = 0.0f*/, float gain/* = 1.0f*/) { unsigned int nRet = _Hash(pszFilePath); preloadEffect(pszFilePath); EffectList::iterator p = sharedList().find(nRet); if (p != sharedList().end()) { p->second->Play(bLoop); } return nRet; }
void SimpleAudioEngine::resumeAllEffects() { for (auto& iter : sharedList()) { iter.second->Resume(); } }
void SimpleAudioEngine::pauseAllEffects() { for (auto& iter : sharedList()) { iter.second->Pause(); } }
void SimpleAudioEngine::stopAllEffects() { for (auto& iter : sharedList()) { iter.second->Stop(); } }
void QBSoundWin::preloadEffect(const char* filename) { QBSoundLocker locker(&mMutex,"preloadEffect"); do { if (filename==NULL) break; unsigned int nRet = _Hash(filename); if (sharedList().end() != sharedList().find(nRet)) break; sharedList().insert(make_pair(nRet,new EffectBuffer())); EffectBuffer* buffer = sharedList()[nRet]; if (buffer->load(filename)!=0) { sharedList().erase(nRet); } } while (0); }
void SimpleAudioEngine::preloadEffect(const char* pszFilePath) { int nRet = 0; do { BREAK_IF(! pszFilePath); nRet = _Hash(pszFilePath); BREAK_IF(sharedList().end() != sharedList().find(nRet)); sharedList().insert(Effect(nRet, new MciPlayer())); MciPlayer * pPlayer = sharedList()[nRet]; pPlayer->Open(_FullPath(pszFilePath), nRet); BREAK_IF(nRet == pPlayer->GetSoundID()); sharedList().erase(nRet); nRet = 0; } while (0); }
unsigned int QBSoundWin::playEffect(const char* filename,bool bLoop,float pitch, float pan, float gain) { QBSoundLocker locker(&mMutex,"playEffect"); if (filename) { unsigned int nRet = _Hash(filename); do { if (filename==NULL) break; unsigned int nRet = _Hash(filename); if (sharedList().end() != sharedList().find(nRet)) break; sharedList().insert(make_pair(nRet,new EffectBuffer())); EffectBuffer* buffer = sharedList()[nRet]; if (buffer->load(filename)!=0) { sharedList().erase(nRet); } } while (0); EffectList::iterator p = sharedList().find(nRet); if (p != sharedList().end()) { EffectBuffer* effect = p->second; findPlayer(soundID)->setVolume(gain); findPlayer(soundID)->play((unsigned char*)effect->pcmbuffer,effect->pcmsize); soundID ++; if (soundID > 9999) soundID = 1; } return soundID; } return 0; }
void SimpleAudioEngine::unloadEffect(const char* pszFilePath) { unsigned int nID = _Hash(pszFilePath); sharedList().erase(nID); }
void OXMLi_ListenerState_Numbering::endElement (OXMLi_EndElementRequest * rqst) { if ( nameMatches(rqst->pName, NS_W_KEY, "numbering") || nameMatches(rqst->pName, NS_W_KEY, "abstractNum") || nameMatches(rqst->pName, NS_W_KEY, "multiLevelType") || nameMatches(rqst->pName, NS_W_KEY, "name") || nameMatches(rqst->pName, NS_W_KEY, "nsid") || nameMatches(rqst->pName, NS_W_KEY, "numStyleLink") || nameMatches(rqst->pName, NS_W_KEY, "styleLink") || nameMatches(rqst->pName, NS_W_KEY, "tmpl") || nameMatches(rqst->pName, NS_W_KEY, "isLgl") || nameMatches(rqst->pName, NS_W_KEY, "legacy") || nameMatches(rqst->pName, NS_W_KEY, "lvlJc") || nameMatches(rqst->pName, NS_W_KEY, "lvlPicBulletId") || nameMatches(rqst->pName, NS_W_KEY, "lvlRestart") || nameMatches(rqst->pName, NS_W_KEY, "lvlText") || nameMatches(rqst->pName, NS_W_KEY, "numFmt") || nameMatches(rqst->pName, NS_W_KEY, "start") || nameMatches(rqst->pName, NS_W_KEY, "suff") || nameMatches(rqst->pName, NS_W_KEY, "abstractNumId") ) { //TODO: add functionality here rqst->handled = true; } else if(nameMatches(rqst->pName, NS_W_KEY, "lvl")) { OXML_Document * doc = OXML_Document::getInstance(); if(!doc) { doc = OXML_Document::getNewInstance(); } OXML_SharedList sharedList(m_currentList); doc->addList(sharedList); m_currentList = NULL; rqst->handled = true; } else if(nameMatches(rqst->pName, NS_W_KEY, "num")) { m_currentNumId.clear(); //set it to empty string rqst->handled = true; } else if(nameMatches(rqst->pName, NS_W_KEY, "pPr") || nameMatches(rqst->pName, NS_W_KEY, "rPr")) { if(rqst->stck->empty()) { rqst->handled = false; rqst->valid = false; return; } OXML_SharedElement dummy = rqst->stck->top(); if(m_currentList) { m_currentList->setAttributes(dummy->getAttributes()); m_currentList->setProperties(dummy->getProperties()); } rqst->stck->pop(); //remove the dummy element rqst->handled = true; } }
void SimpleAudioEngine::end() { sharedMusic().Close(); sharedList().clear(); return; }