AKRESULT SetAudioSrcPath(const wchar_t* in_pszAudioSrcPath) { AkOSChar* audioSrcPathOsString = NULL; CONVERT_WIDE_TO_OSCHAR( in_pszAudioSrcPath, audioSrcPathOsString ); SafeAppendTrailingPathSeparator(audioSrcPathOsString); return g_lowLevelIO.SetAudioSrcPath( audioSrcPathOsString ); }
AKRESULT SetBankPath(const wchar_t* in_pszBankPath) { AkOSChar* bankPathOsString = NULL; CONVERT_WIDE_TO_OSCHAR( in_pszBankPath, bankPathOsString ); SafeAppendTrailingPathSeparator(bankPathOsString); return g_lowLevelIO.SetBankPath( bankPathOsString ); }
//----------------------------------------------------------------------------------------- // Sound Engine termination. //----------------------------------------------------------------------------------------- void Term( ) { #ifndef AK_OPTIMIZED Comm::Term(); #endif // AK_OPTIMIZED MusicEngine::Term(); SoundEngine::Term(); m_lowLevelIO.Term(); if ( IAkStreamMgr::Get() ) IAkStreamMgr::Get()->Destroy(); MemoryMgr::Term(); }
//----------------------------------------------------------------------------------------- // Sound Engine termination. //----------------------------------------------------------------------------------------- void Term( ) { if (!AK::SoundEngine::IsInitialized()) return; AK::SoundEngine::StopAll(); #ifndef AK_OPTIMIZED #ifndef AK_METRO AK::Comm::Term(); #endif // #ifndef AK_METRO #endif // AK_OPTIMIZED AK::MusicEngine::Term(); AK::SoundEngine::Term(); g_lowLevelIO.Term(); if ( AK::IAkStreamMgr::Get() ) AK::IAkStreamMgr::Get()->Destroy(); AK::MemoryMgr::Term(); }
//----------------------------------------------------------------------------------------- // Sound Engine initialization. //----------------------------------------------------------------------------------------- AKRESULT Init( AkMemSettings * in_pMemSettings, AkStreamMgrSettings * in_pStmSettings, AkDeviceSettings * in_pDefaultDeviceSettings, AkInitSettings * in_pSettings, AkPlatformInitSettings * in_pPlatformSettings, AkMusicSettings * in_pMusicSettings ) { // Check required arguments. if ( !in_pMemSettings || !in_pStmSettings || !in_pDefaultDeviceSettings ) { assert( !"Invalid arguments" ); return AK_InvalidParameter; } // Create and initialise an instance of our memory manager. if ( MemoryMgr::Init( in_pMemSettings ) != AK_Success ) { assert( !"Could not create the memory manager." ); return AK_Fail; } // Create and initialise an instance of the default stream manager. if ( !StreamMgr::Create( *in_pStmSettings ) ) { assert( !"Could not create the Stream Manager" ); return AK_Fail; } // Create an IO device. if ( m_lowLevelIO.Init( *in_pDefaultDeviceSettings ) != AK_Success ) { assert( !"Cannot create streaming I/O device" ); return AK_Fail; } // Initialize sound engine. if ( SoundEngine::Init( in_pSettings, in_pPlatformSettings ) != AK_Success ) { assert( !"Cannot initialize sound engine" ); return AK_Fail; } // Initialize music engine. if ( MusicEngine::Init( in_pMusicSettings ) != AK_Success ) { assert( !"Cannot initialize music engine" ); return AK_Fail; } #ifndef AK_OPTIMIZED // Initialize communication. AkCommSettings settingsComm; AK::Comm::GetDefaultInitSettings( settingsComm ); if ( AK::Comm::Init( settingsComm ) != AK_Success ) { assert( !"Cannot initialize music communication" ); return AK_Fail; } #endif // AK_OPTIMIZED // Register Vorbis codec SoundEngine::RegisterCodec( AKCOMPANYID_AUDIOKINETIC, AKCODECID_VORBIS, CreateVorbisFilePlugin, CreateVorbisBankPlugin ); return AK_Success; }
namespace SOUNDENGINE_DLL { CAkDefaultIOHookBlocking m_lowLevelIO; //----------------------------------------------------------------------------------------- // Sound Engine initialization. //----------------------------------------------------------------------------------------- AKRESULT Init( AkMemSettings * in_pMemSettings, AkStreamMgrSettings * in_pStmSettings, AkDeviceSettings * in_pDefaultDeviceSettings, AkInitSettings * in_pSettings, AkPlatformInitSettings * in_pPlatformSettings, AkMusicSettings * in_pMusicSettings ) { // Check required arguments. if ( !in_pMemSettings || !in_pStmSettings || !in_pDefaultDeviceSettings ) { assert( !"Invalid arguments" ); return AK_InvalidParameter; } // Create and initialise an instance of our memory manager. if ( MemoryMgr::Init( in_pMemSettings ) != AK_Success ) { assert( !"Could not create the memory manager." ); return AK_Fail; } // Create and initialise an instance of the default stream manager. if ( !StreamMgr::Create( *in_pStmSettings ) ) { assert( !"Could not create the Stream Manager" ); return AK_Fail; } // Create an IO device. if ( m_lowLevelIO.Init( *in_pDefaultDeviceSettings ) != AK_Success ) { assert( !"Cannot create streaming I/O device" ); return AK_Fail; } // Initialize sound engine. if ( SoundEngine::Init( in_pSettings, in_pPlatformSettings ) != AK_Success ) { assert( !"Cannot initialize sound engine" ); return AK_Fail; } // Initialize music engine. if ( MusicEngine::Init( in_pMusicSettings ) != AK_Success ) { assert( !"Cannot initialize music engine" ); return AK_Fail; } #ifndef AK_OPTIMIZED // Initialize communication. AkCommSettings settingsComm; AK::Comm::GetDefaultInitSettings( settingsComm ); if ( AK::Comm::Init( settingsComm ) != AK_Success ) { assert( !"Cannot initialize music communication" ); return AK_Fail; } #endif // AK_OPTIMIZED // Register Vorbis codec SoundEngine::RegisterCodec( AKCOMPANYID_AUDIOKINETIC, AKCODECID_VORBIS, CreateVorbisFilePlugin, CreateVorbisBankPlugin ); return AK_Success; } //----------------------------------------------------------------------------------------- // Sound Engine termination. //----------------------------------------------------------------------------------------- void Term( ) { #ifndef AK_OPTIMIZED Comm::Term(); #endif // AK_OPTIMIZED MusicEngine::Term(); SoundEngine::Term(); m_lowLevelIO.Term(); if ( IAkStreamMgr::Get() ) IAkStreamMgr::Get()->Destroy(); MemoryMgr::Term(); } //----------------------------------------------------------------------------------------- // Sound Engine periodic update. //----------------------------------------------------------------------------------------- void Tick( ) { SoundEngine::RenderAudio( ); } //----------------------------------------------------------------------------------------- // Access to LowLevelIO's file localization. //----------------------------------------------------------------------------------------- // File system interface. AKRESULT SetBasePath( const AkOSChar* in_pszBasePath ) { return m_lowLevelIO.SetBasePath( in_pszBasePath ); } AKRESULT SetBankPath( const AkOSChar* in_pszBankPath ) { return m_lowLevelIO.SetBankPath( in_pszBankPath ); } AKRESULT SetAudioSrcPath( const AkOSChar* in_pszAudioSrcPath ) { return m_lowLevelIO.SetAudioSrcPath( in_pszAudioSrcPath ); } AKRESULT SetLangSpecificDirName( const AkOSChar* in_pszDirName ) { return m_lowLevelIO.SetLangSpecificDirName( in_pszDirName ); } }
AKRESULT SetLangSpecificDirName( const AkOSChar* in_pszDirName ) { return m_lowLevelIO.SetLangSpecificDirName( in_pszDirName ); }
AKRESULT SetAudioSrcPath( const AkOSChar* in_pszAudioSrcPath ) { return m_lowLevelIO.SetAudioSrcPath( in_pszAudioSrcPath ); }
AKRESULT SetBankPath( const AkOSChar* in_pszBankPath ) { return m_lowLevelIO.SetBankPath( in_pszBankPath ); }
AKRESULT SetAudioSrcPath(AkOSChar* in_pszAudioSrcPath) { SafeAppendTrailingPathSeparator(in_pszAudioSrcPath); return g_lowLevelIO.SetAudioSrcPath(in_pszAudioSrcPath); }
AKRESULT SetBasePath(AkOSChar* in_pszBasePath) { SafeAppendTrailingPathSeparator((AkOSChar*)in_pszBasePath); return g_lowLevelIO.SetBasePath(in_pszBasePath); }
AKRESULT Init( AkMemSettings * in_pMemSettings, AkStreamMgrSettings * in_pStmSettings, AkDeviceSettings * in_pDefaultDeviceSettings, AkInitSettings * in_pSettings, AkPlatformInitSettings * in_pPlatformSettings, AkMusicSettings * in_pMusicSettings ) { // Check required arguments. if ( !in_pMemSettings || !in_pStmSettings || !in_pDefaultDeviceSettings ) { AKASSERT( !"Invalid arguments" ); return AK_InvalidParameter; } // Create and initialise an instance of our memory manager. if ( AK::MemoryMgr::Init( in_pMemSettings ) != AK_Success ) { AKASSERT( !"Could not create the memory manager." ); return AK_Fail; } // Create and initialise an instance of the default stream manager. if ( !AK::StreamMgr::Create( *in_pStmSettings ) ) { AKASSERT( !"Could not create the Stream Manager" ); return AK_Fail; } // Create an IO device. #ifdef AK_ANDROID if (g_assetManager == NULL) { AKASSERT( !"Could not find Android asset manager" ); return AK_Fail; } g_lowLevelIO.SetAssetManager(g_assetManager); #endif if ( g_lowLevelIO.Init( *in_pDefaultDeviceSettings ) != AK_Success ) { AKASSERT( !"Cannot create streaming I/O device" ); return AK_Fail; } #ifdef AK_ANDROID in_pPlatformSettings->pJavaVM = java_vm; #endif #ifdef AK_IOS in_pPlatformSettings->bAppListensToInterruption = true; #endif // #ifdef AK_IOS // Initialize sound engine. if ( AK::SoundEngine::Init( in_pSettings, in_pPlatformSettings ) != AK_Success ) { AKASSERT( !"Cannot initialize sound engine" ); return AK_Fail; } // Initialize music engine. if ( AK::MusicEngine::Init( in_pMusicSettings ) != AK_Success ) { AKASSERT( !"Cannot initialize music engine" ); return AK_Fail; } #ifndef AK_OPTIMIZED #ifndef AK_METRO // Initialize communication. AkCommSettings settingsComm; AK::Comm::GetDefaultInitSettings( settingsComm ); if ( AK::Comm::Init( settingsComm ) != AK_Success ) { AKASSERT( !"Cannot initialize music communication" ); } #endif // #ifndef AK_METRO #endif // AK_OPTIMIZED // Register plugins if ( AK::SoundEngine::RegisterAllPlugins( ) != AK_Success ) { AKASSERT( !"Error while registering plug-ins" ); return AK_Fail; } return AK_Success; }