Commit 4f58a57d authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Changing config reader to use section and file switches during INI parsing,...

Changing config reader to use section and file switches during INI parsing, solves problems of misinterpretation during VACore ini parsing
parent d84c7fbc
......@@ -81,37 +81,36 @@ void CVAAudioRendererRegistry::RegisterInternalCoreFactoryMethods()
// Binaural
#ifdef VACORE_WITH_RENDERER_BINAURAL_FREE_FIELD
RegisterRendererDefaultFactory< CVABinauralFreeFieldAudioRenderer >( "BinauralFreeField" );
#endif // VACORE_WITH_RENDERER_BINAURAL_FREE_FIELD
#endif
#ifdef VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE
RegisterRendererDefaultFactory< CVABinauralAirTrafficNoiseAudioRenderer >( "BinauralAirTrafficNoise" );
#endif // VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE
#endif
#ifdef VACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB
RegisterRendererDefaultFactory< CVABinauralArtificialReverbAudioRenderer >( "BinauralArtificialReverb" );
#endif // VACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB
#endif
#ifdef VACORE_WITH_RENDERER_BINAURAL_ROOM_ACOUSTICS
RegisterRendererDefaultFactory< CVARoomAcousticsAudioRenderer>( "BinauralRoomAcoustics" );
#endif // VACORE_WITH_RENDERER_BINAURAL_ROOM_ACOUSTICS
#endif
// Prototyping
#ifdef VACORE_WITH_RENDERER_PROTOTYPE_FREE_FIELD
RegisterRendererDefaultFactory< CVAPrototypeFreeFieldAudioRenderer >( "PrototypeFreeField" );
#endif // VACORE_WITH_RENDERER_PROTOTYPE_FREE_FIELD
#endif
#ifdef VACORE_WITH_RENDERER_PROTOTYPE_DUMMY
RegisterRendererDefaultFactory< CVAPTDummyAudioRenderer >( "PrototypeDummy" );
#endif // VACORE_WITH_RENDERER_PROTOTYPE_DUMMY
#endif
#ifdef VACORE_WITH_RENDERER_PROTOTYPE_GENERIC_PATH
//VA_REGISTER_AUDIO_RENDERER( CVAPTGenericPathAudioRenderer, "GenericPath" );
RegisterRendererDefaultFactory< CVAPTGenericPathAudioRenderer >( "PrototypeGenericPath" );
#endif // VACORE_WITH_RENDERER_PROTOTYPE_GENERIC_PATH
#endif
#ifdef VACORE_WITH_RENDERER_PROTOTYPE_HEARING_AID
RegisterRendererDefaultFactory< CVAPTHearingAidRenderer >( "PrototypeHearingAid" );
#endif // VACORE_WITH_RENDERER_PROTOTYPE_HEARING_AID
#endif
// VBAP
#ifdef VACORE_WITH_RENDERER_VBAP_FREE_FIELD
RegisterRendererDefaultFactory< CVAVBAPFreeFieldAudioRenderer >( "VBAPFreeField" );
#endif // VACORE_WITH_RENDERER_VBAP_FREE_FIELD
#endif
m_bInternalCoreFactoriesRegistered = true;
}
......@@ -23,6 +23,7 @@
#include <VistaBase/VistaTimeUtils.h>
#include <VistaBase/VistaQuaternion.h>
#include <VistaTools/VistaFileSystemFile.h>
#include <cassert>
......@@ -146,16 +147,20 @@ CVAStructValue interpretStructKey( const std::string& s )
void LoadStructFromINIFIle( const std::string& sFilePath, CVAStruct& oData )
{
if( !doesFileExist( sFilePath ) )
if( !VistaFileSystemFile( sFilePath ).Exists() )
VA_EXCEPT2( FILE_NOT_FOUND, std::string( "INI file \"" ) + sFilePath + std::string( "\" not found" ) );
INIFileUseFile( sFilePath );
oData.Clear();
std::vector<std::string> vsSections = INIFileGetSections( sFilePath );
auto vsSections = INIFileGetSections( sFilePath );
for( std::vector<std::string>::iterator it = vsSections.begin(); it != vsSections.end(); ++it )
{
std::string& sSection( *it );
std::vector<std::string> vsKeys = INIFileGetKeys( sFilePath, sSection );
INIFileUseSection( sSection );
std::vector<std::string> vsKeys = INIFileGetKeys( sSection );
// Spezialfall: Section [] nach Root abbilden
if( it->empty() )
......@@ -165,7 +170,8 @@ void LoadStructFromINIFIle( const std::string& sFilePath, CVAStruct& oData )
std::string& sKey( *jt );
if( oData.HasKey( sKey ) )
VA_EXCEPT2( INVALID_PARAMETER, "Uniqueness violation in " + sFilePath + ": multiple detection of key '" + sKey + "' in section '" + sSection + "'" );
oData[ sKey ] = interpretStructKey( INIFileReadString( sFilePath, sSection, sKey ) );
const std::string sValue = INIFileReadString( sKey );
oData[ sKey ] = interpretStructKey( sValue );
}
}
else
......@@ -176,7 +182,9 @@ void LoadStructFromINIFIle( const std::string& sFilePath, CVAStruct& oData )
std::string& sKey( *jt );
if( oData.HasKey( sKey ) )
VA_EXCEPT2( INVALID_PARAMETER, "Uniqueness violation in " + sFilePath + ": multiple detection of key '" + sKey + "' in section '" + sSection + "'" );
oSubData[ *jt ] = interpretStructKey( INIFileReadString( sFilePath, sSection, sKey ) );
const std::string sValue = INIFileReadString( sKey );
oSubData[ sKey ] = interpretStructKey( sValue );
}
oData[ sSection ] = oSubData;
}
......
Markdown is supported
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