Commit 53936af7 authored by Jonas Stienen's avatar Jonas Stienen
Browse files

better handling of unsuccessful freeing of HRIR

parent e86dd310
......@@ -88,24 +88,26 @@ int CVAHRIRManager::LoadHRIR(const std::string& sFilename, const std::string& sN
return iHRIRID;
}
bool CVAHRIRManager::FreeHRIR(int iHRIRID) {
VA_VERBOSE("HRIRMan", "FreeHRIR(" << iHRIRID << ")");
bool CVAHRIRManager::FreeHRIR( int iID )
{
VA_VERBOSE( "VAHRIRManager", "Freeing HRIR with ID " << iID );
// Prfen ob die ID gltig ist
int iRefCount = m_ocHRIR.GetRefCount(iHRIRID);
int iRefCount = m_ocHRIR.GetRefCount( iID );
if (iRefCount != 0) {
if( iRefCount != 0 )
{
// Noch Referenzen vorhanden oder ungltige ID (-1)
VA_VERBOSE("HRIRMan", "FreeHRIR failed, HRIR in use or invalid ID" << iHRIRID << ")");
VA_VERBOSE( "VAHRIRManager", "FreeHRIR failed, HRIR still in use by a user or invalid ID " << iID << ")" );
return false;
}
// HRIR lschen
IVAHRIRDataset* pHRIR = m_ocHRIR[iHRIRID];
IVAHRIRDataset* pHRIR = m_ocHRIR[ iID ];
delete pHRIR;
m_ocHRIR.Remove(iHRIRID);
m_ocHRIR.Remove( iID );
VA_VERBOSE("HRIRMan", "FreeHRIR successful");
VA_VERBOSE( "VAHRIRManager", "HRIR successfully cleared" );
return true;
}
......
......@@ -1184,6 +1184,8 @@ int CVAMonauralFreeFieldAudioRenderer::CallObject( const CVAStruct& oArgs, CVASt
if( oDir.Exists() == false )
oDir.CreateWithParentDirectories();
m_sBaseFolder = sNewBaseFolder;
VA_INFO( "VAMonauralFreeFieldAudioRenderer", "Setting new base folder to '" << m_sBaseFolder << "'" );
}
}
......
......@@ -1053,35 +1053,41 @@ int CVACoreImpl::LoadHRIRDataset(const std::string& sFilename,
} VA_RETHROW;
}
bool CVACoreImpl::FreeHRIRDataset(int iHRIRID) {
bool CVACoreImpl::FreeHRIRDataset( int iHRIRID )
{
VA_NO_REENTRANCE;
VA_CHECK_INITIALIZED;
VA_TRY {
bool bSuccess = m_pHRIRMan->FreeHRIR(iHRIRID);
assert( bSuccess );
VA_TRY
{
if( !m_pHRIRMan->FreeHRIR( iHRIRID ) )
return false;
// Ereignis generieren, wenn Operation erfolgreich
CVACoreEvent ev;
ev.iEventType = CVACoreEvent::VA_COREEVENT_HRIR_FREED;
ev.pSender = this;
ev.iObjectID = iHRIRID;
m_pCoreEventMan->BroadcastEvent(ev);
m_pCoreEventMan->BroadcastEvent( ev );
VA_INFO("Core", "FreeHRIRDataset successful, freed HRIR dataset " << iHRIRID);
VA_INFO( "Core", "FreeHRIRDataset successful, freed HRIR dataset " << iHRIRID );
return bSuccess;
return true;
} VA_RETHROW;
}
VA_RETHROW;
}
CVAHRIRInfo CVACoreImpl::GetHRIRInfo(int iHRIRID) const {
CVAHRIRInfo CVACoreImpl::GetHRIRInfo(int iHRIRID) const
{
VA_NO_REENTRANCE;
VA_CHECK_INITIALIZED;
VA_TRY {
return m_pHRIRMan->GetHRIRInfo(iHRIRID);
} VA_RETHROW;
VA_TRY
{
return m_pHRIRMan->GetHRIRInfo( iHRIRID );
}
VA_RETHROW;
}
void CVACoreImpl::GetHRIRInfos(std::vector<CVAHRIRInfo>& vhiDest) const {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment