Esempio n. 1
0
    public override void Load(SoundProfile profile, ISoundLoader.ResultCallback callback, SoundDatabase soundDatabase)
    {
        String text = AssetManagerUtil.GetStreamingAssetsPath() + "/Sounds/" + profile.ResourceID;

        SoundLib.Log("Load: " + text);
        FileInfo fileInfo = new FileInfo(text);

        Byte[] array = null;
        if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.IPhonePlayer)
        {
            array = File.ReadAllBytes(text);
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
        }
        if (array != null)
        {
            IntPtr intPtr = Marshal.AllocHGlobal((Int32)fileInfo.Length);
            Marshal.Copy(array, 0, intPtr, (Int32)fileInfo.Length);
            Int32 bankID = ISdLibAPIProxy.Instance.SdSoundSystem_AddData(intPtr);
            profile.AkbBin = intPtr;
            profile.BankID = bankID;
        }
        else
        {
            SoundLib.Log("akbBytes is null");
        }
        callback(profile, soundDatabase);
    }
Esempio n. 2
0
    public override void Load(SoundProfile profile, ISoundLoader.ResultCallback callback, SoundDatabase soundDatabase)
    {
        String text = String.Empty;

        if (profile.SoundProfileType == SoundProfileType.SoundEffect)
        {
            text = Application.persistentDataPath + "/SoundEffect/" + profile.ResourceID;
        }
        else if (profile.SoundProfileType == SoundProfileType.Music)
        {
            text = Application.persistentDataPath + "/Music/" + profile.ResourceID;
        }
        else
        {
            text = Application.persistentDataPath + "/" + profile.ResourceID;
        }
        FileInfo fileInfo = new FileInfo(text);

        Byte[] source = File.ReadAllBytes(text);
        IntPtr intPtr = Marshal.AllocHGlobal((Int32)fileInfo.Length);

        Marshal.Copy(source, 0, intPtr, (Int32)fileInfo.Length);
        Int32 bankID = ISdLibAPIProxy.Instance.SdSoundSystem_AddData(intPtr);

        profile.AkbBin = intPtr;
        profile.BankID = bankID;
        callback(profile, soundDatabase);
    }
Esempio n. 3
0
    public override void Load(SoundProfile profile, ISoundLoader.ResultCallback callback, SoundDatabase soundDatabase)
    {
        String    text      = "Sounds/" + profile.ResourceID + ".akb";
        TextAsset textAsset = AssetManager.Load <TextAsset>(text, false);

        SoundLib.Log("Load: " + text);
        if ((UnityEngine.Object)null == textAsset)
        {
            SoundLib.LogError("File not found AT path: " + text);
            callback((SoundProfile)null, (SoundDatabase)null);
            return;
        }
        Byte[] bytes  = textAsset.bytes;
        IntPtr intPtr = Marshal.AllocHGlobal((Int32)textAsset.bytes.Length);

        Marshal.Copy(bytes, 0, intPtr, (Int32)textAsset.bytes.Length);
        Int32 bankID = ISdLibAPIProxy.Instance.SdSoundSystem_AddData(intPtr);

        profile.AkbBin = intPtr;
        profile.BankID = bankID;
        callback(profile, soundDatabase);
    }
Esempio n. 4
0
 public abstract void Load(SoundProfile profile, ISoundLoader.ResultCallback callback, SoundDatabase soundDatabase);