LoadAndDecodeBank() public static method

public static LoadAndDecodeBank ( string in_pszString, bool in_bSaveDecodedBank, uint &out_bankID ) : AKRESULT
in_pszString string
in_bSaveDecodedBank bool
out_bankID uint
return AKRESULT
Beispiel #1
0
        /// Loads a bank. This version blocks until the bank is loaded. See AK::SoundEngine::LoadBank for more information.
        public override AKRESULT DoLoadBank()
        {
            if (decodeBank)
            {
                return(AkSoundEngine.LoadAndDecodeBank(bankName, saveDecodedBank, out m_BankID));
            }

            AKRESULT res = AKRESULT.AK_Success;

            if (!string.IsNullOrEmpty(decodedBankPath))
            {
                res = AkSoundEngine.SetBasePath(decodedBankPath);
            }

            if (res == AKRESULT.AK_Success)
            {
                res = AkSoundEngine.LoadBank(bankName, AkSoundEngine.AK_DEFAULT_POOL_ID, out m_BankID);

                if (!string.IsNullOrEmpty(decodedBankPath))
                {
                    AkSoundEngine.SetBasePath(AkBasePathGetter.GetSoundbankBasePath());
                }
            }

            return(res);
        }
Beispiel #2
0
    /// Loads a bank. This version blocks until the bank is loaded. See AK::SoundEngine::LoadBank for more information.
    public void LoadBank()
    {
        if (m_RefCount == 0)
        {
            AKRESULT res = AKRESULT.AK_Fail;

            // There might be a case where we were asked to unload the SoundBank, but then asked immediately after to load that bank.
            // If that happens, there will be a short amount of time where the ref count will be 0, but the bank will still be in memory.
            // In that case, we do not want to unload the bank, so we have to remove it from the list of pending bank unloads.
            if (AkBankManager.BanksToUnload.Contains(this))
            {
                AkBankManager.BanksToUnload.Remove(this);
                IncRef();
                return;
            }

            if (decodeBank == false)
            {
                string basePathToSet = null;

                if (!string.IsNullOrEmpty(relativeBasePath))
                {
                    basePathToSet = AkBasePathGetter.GetValidBasePath();
                    if (string.IsNullOrEmpty(basePathToSet))
                    {
                        Debug.LogWarning("WwiseUnity: Bank " + bankName + " failed to load (could not obtain base path to set).");
                        return;
                    }

                    res = AkSoundEngine.SetBasePath(System.IO.Path.Combine(basePathToSet, relativeBasePath));
                }
                else
                {
                    res = AKRESULT.AK_Success;
                }

                if (res == AKRESULT.AK_Success)
                {
                    res = AkSoundEngine.LoadBank(bankName, AkSoundEngine.AK_DEFAULT_POOL_ID, out m_BankID);

                    if (!string.IsNullOrEmpty(basePathToSet))
                    {
                        AkSoundEngine.SetBasePath(basePathToSet);
                    }
                }
            }
            else
            {
                res = AkSoundEngine.LoadAndDecodeBank(bankName, saveDecodedBank, out m_BankID);
            }

            if (res != AKRESULT.AK_Success)
            {
                Debug.LogWarning("WwiseUnity: Bank " + bankName + " failed to load (" + res.ToString() + ")");
            }
        }
        IncRef();
    }
Beispiel #3
0
        /// Loads a bank. This version blocks until the bank is loaded. See AK::SoundEngine::LoadBank for more information.
        protected override AKRESULT DoLoadBank()
        {
            if (decodeBank)
            {
                return(AkSoundEngine.LoadAndDecodeBank(bankName, saveDecodedBank, out m_BankID));
            }


            var res = AkSoundEngine.SetBasePath(decodedBankPath);

            if (res == AKRESULT.AK_Success)
            {
                res = AkSoundEngine.LoadBank(bankName, m_PoolId, out m_BankID);
            }

            return(res);
        }
Beispiel #4
0
        /// Loads a bank. This version blocks until the bank is loaded. See AK::SoundEngine::LoadBank for more information.
        public override AKRESULT DoLoadBank()
        {
            if (decodeBank)
            {
                return(AkSoundEngine.LoadAndDecodeBank(bankName, saveDecodedBank, out m_BankID));
            }

            var res = AKRESULT.AK_Success;

            res = AkSoundEngine.SetBasePath(decodedBankPath);

            if (res == AKRESULT.AK_Success)
            {
                res = AkSoundEngine.LoadBank(bankName, AkSoundEngine.AK_DEFAULT_POOL_ID, out m_BankID);
            }

            return(res);
        }
Beispiel #5
0
        /// Loads a bank. This version blocks until the bank is loaded. See AK::SoundEngine::LoadBank for more information.
        public override AKRESULT DoLoadBank()
        {
            if (decodeBank)
            {
                return(AkSoundEngine.LoadAndDecodeBank(bankName, saveDecodedBank, out m_BankID));
            }

            if (string.IsNullOrEmpty(decodedBankPath))
            {
                return(AkSoundEngine.LoadBank(bankName, out m_BankID));
            }

            var res = AkSoundEngine.SetBasePath(decodedBankPath);

            if (res == AKRESULT.AK_Success)
            {
                res = AkSoundEngine.LoadBank(bankName, out m_BankID);
                AkSoundEngine.SetBasePath(AkBasePathGetter.SoundBankBasePath);
            }
            return(res);
        }