コード例 #1
0
        public DecodableBankHandle(string name, bool save) : base(name)
        {
            if (string.IsNullOrEmpty(decodedBankPath))
            {
                decodedBankPath = AkUtilities.GetWiseBankFolder_Full_Decode();
            }
            saveDecodedBank = save;
            bankNameExt     = Path.HasExtension(bankName) ? bankName + ".bnk" : bankName;
            // test language-specific decoded file path
            // var language = AkSoundEngine.GetCurrentLanguage();
            // var decodedBankFullPath = AkUtilities.GetWiseBankFolder_Full_Decode();

            var decodedBankFilePath = Path.Combine(decodedBankPath, bankNameExt);

            if (File.Exists(decodedBankFilePath))
            {
                try
                {
                    var decodedFileTime     = File.GetLastWriteTime(decodedBankFilePath);
                    var defaultBankPath     = AkUtilities.GetWiseBankFolder_Full();
                    var encodedBankFilePath = Path.Combine(defaultBankPath, bankNameExt);
                    var encodedFileTime     = File.GetLastWriteTime(encodedBankFilePath);

                    decodeBank = decodedFileTime <= encodedFileTime;
                }
                catch
                {
                    // Assume the decoded bank exists, but is not accessible. Re-decode it anyway, so we do nothing.
                }
            }
        }
コード例 #2
0
    /// Load a language-specific bank from WWW object
    public void LoadLocalizedBank(string in_bankFilename)
    {
        var bankPath = "file://" + System.IO.Path.Combine(
            System.IO.Path.Combine(AkUtilities.GetWiseBankFolder_Full(), AkSoundEngine.GetCurrentLanguage()),
            in_bankFilename);

        DoLoadBank(bankPath);
    }
コード例 #3
0
ファイル: AudioUtil.cs プロジェクト: yangfan111/common
 public static string[] GetBankAssetNamesByFolder(string folder)
 {
     try
     {
         string assetFolder = (string.IsNullOrEmpty(folder)) ? AkUtilities.GetWiseBankFolder_Full() : folder;
         var    paths       = Directory.GetFiles(assetFolder, "*.bnk", SearchOption.TopDirectoryOnly);
         for (int i = 0; i < paths.Length; i++)
         {
             paths[i] = Path.GetFileName(paths[i]);
         }
         return(paths);
     }
     catch (System.Exception e)
     {
     }
     return(null);
 }
コード例 #4
0
        public DecodableBankHandle(string name, bool save) : base(name)
        {
            saveDecodedBank = save;

            var bankFileName = bankName + ".bnk";

            // test language-specific decoded file path
            var language            = AkSoundEngine.GetCurrentLanguage();
            var decodedBankFullPath = AkUtilities.GetWiseBankFolder_Full_Decode();

            var decodedBankFilePath = System.IO.Path.Combine(decodedBankPath, bankFileName);

            var decodedFileExists = System.IO.File.Exists(decodedBankFilePath);

            if (!decodedFileExists)
            {
                // test non-language-specific decoded file path
                decodedBankFilePath = System.IO.Path.Combine(decodedBankPath, bankFileName);
                decodedFileExists   = System.IO.File.Exists(decodedBankFilePath);
            }

            if (decodedFileExists)
            {
                try
                {
                    var decodedFileTime     = System.IO.File.GetLastWriteTime(decodedBankFilePath);
                    var defaultBankPath     = AkUtilities.GetWiseBankFolder_Full();
                    var encodedBankFilePath = System.IO.Path.Combine(defaultBankPath, bankFileName);
                    var encodedFileTime     = System.IO.File.GetLastWriteTime(encodedBankFilePath);

                    decodeBank = decodedFileTime <= encodedFileTime;
                }
                catch
                {
                    // Assume the decoded bank exists, but is not accessible. Re-decode it anyway, so we do nothing.
                }
            }
        }
コード例 #5
0
 private static bool SetDestinationPath(string platformName, ref string destinationFolder)
 {
     destinationFolder = System.IO.Path.Combine(AkUtilities.GetWiseBankFolder_Full(), platformName);
     return(!string.IsNullOrEmpty(destinationFolder));
 }
コード例 #6
0
    public static bool Populate()
    {
        if (UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isCompiling)
        {
            return(false);
        }

        try
        {
            // Try getting the SoundbanksInfo.xml file for Windows or Mac first, then try to find any other available platform.
            var FullSoundbankPath = AkUtilities.GetWiseBankFolder_Full();

            var filename = System.IO.Path.Combine(FullSoundbankPath, "SoundbanksInfo.xml");
            if (!System.IO.File.Exists(filename))
            {
                FullSoundbankPath = System.IO.Path.Combine(UnityEngine.Application.streamingAssetsPath,
                                                           WwiseSetupWizard.Settings.SoundbankPath);

                if (!System.IO.Directory.Exists(FullSoundbankPath))
                {
                    return(false);
                }

                var foundFiles =
                    System.IO.Directory.GetFiles(FullSoundbankPath, "SoundbanksInfo.xml", System.IO.SearchOption.AllDirectories);

                if (foundFiles.Length == 0)
                {
                    return(false);
                }

                filename = foundFiles[0];
            }

            var time = System.IO.File.GetLastWriteTime(filename);
            if (time <= s_LastParsed)
            {
                return(false);
            }

            var doc = new System.Xml.XmlDocument();
            doc.Load(filename);

            var bChanged   = false;
            var soundBanks = doc.GetElementsByTagName("SoundBanks");
            for (var i = 0; i < soundBanks.Count; i++)
            {
                var soundBank = soundBanks[i].SelectNodes("SoundBank");
                for (var j = 0; j < soundBank.Count; j++)
                {
                    bChanged = SerialiseSoundBank(soundBank[j]) || bChanged;
                }
            }

            return(bChanged);
        }
        catch
        {
            return(false);
        }
    }
コード例 #7
0
    /// Load a sound bank from WWW object
    public void LoadNonLocalizedBank(string in_bankFilename)
    {
        var bankPath = "file://" + System.IO.Path.Combine(AkUtilities.GetWiseBankFolder_Full(), in_bankFilename);

        DoLoadBank(bankPath);
    }