public SndListResource() { format = 0; numModifiers = 0; modifierPart = null; numCommands = 0; commandPart = null; enSoundHeaderType = SoundHeaderType.Std; dataPart = null; }
public SndListResource(IntPtr pSLR) : this() { if (pSLR == IntPtr.Zero) return; format = Marshal.ReadInt16(pSLR); pSLR = (IntPtr)(pSLR.ToInt32() + 2); numModifiers = Marshal.ReadInt16(pSLR); pSLR = (IntPtr)(pSLR.ToInt32() + 2); modifierPart = new QuickTimeAPI.ModRef[numModifiers]; for (int nModifierIndx = 0; numModifiers > nModifierIndx; nModifierIndx++) { modifierPart[nModifierIndx].modNumber = (ushort)Marshal.ReadInt16(pSLR); pSLR = (IntPtr)(pSLR.ToInt32() + 2); modifierPart[nModifierIndx].modInit = Marshal.ReadInt32(pSLR); pSLR = (IntPtr)(pSLR.ToInt32() + 4); } numCommands = Marshal.ReadInt16(pSLR); pSLR = (IntPtr)(pSLR.ToInt32() + 2); commandPart = new SndCommand[numCommands]; for (int nCommandIndx = 0; numCommands > nCommandIndx; nCommandIndx++) { commandPart[nCommandIndx].cmd = (ushort)Marshal.ReadInt16(pSLR); pSLR = (IntPtr)(pSLR.ToInt32() + 2); commandPart[nCommandIndx].param1 = Marshal.ReadInt16(pSLR); pSLR = (IntPtr)(pSLR.ToInt32() + 2); commandPart[nCommandIndx].param2 = Marshal.ReadInt32(pSLR); pSLR = (IntPtr)(pSLR.ToInt32() + 4); } enSoundHeaderType = SoundHeader.GetHeaderEncode(pSLR); switch(enSoundHeaderType) { case SoundHeaderType.Std: dataPart = new SoundHeader(pSLR); break; case SoundHeaderType.Cmp: dataPart = new CmpSoundHeader(pSLR); break; case SoundHeaderType.Ext: dataPart = new ExtSoundHeader(pSLR); break; } }
void WWWSoundLoad(string path, SoundHeader sc, Transform soundTrans) { soundObjects[sc.id] = Instantiate(soundchannelpre) as GameObject; soundObjects[sc.id].name = sc.name; soundObjects[sc.id].transform.SetParent(soundTrans); WWW www = new WWW("file:///" + path.Replace("#", "%23")); AudioClip clip = www.GetAudioClip(false, false); while (!www.isDone) { } clip.name = Path.GetFileName(path); soundObjects[sc.id].GetComponent<AudioSource>().clip = clip; string status = clip.loadState.ToString(); }