public static LIP LoadLipSync(string resref) { // Load the stream Stream stream = data.GetStream(resref, ResourceType.LIP); if (stream == null) { UnityEngine.Debug.LogWarning("Missing lip: " + resref); return(null); } // Read the lip file LIP lip = new LIP(); Dictionary <string, Stream> other = new Dictionary <string, Stream> { { "lip", stream } }; lip.Load(stream, other); return(lip); }
void LoadFile() { string loadLoc = EditorUtility.OpenFilePanel("Load LIP file", "", ""); using (FileStream stream = new FileStream(loadLoc, FileMode.Open)) { lipData = new LIP(); lipData.Load(stream, new Dictionary <string, Stream>(), 0, 0); Debug.Log(lipData.frames.Length); } string audioLoc = EditorUtility.OpenFilePanel("Load Audio File", "", ""); using (FileStream stream = new FileStream(audioLoc, FileMode.Open)) { // Using the KotOR-Unity VO loading code, might as well! WAVObject wav = new WAVObject(stream); audioClip = AudioClip.Create("clip", wav.data.Length / wav.channels, wav.channels, wav.sampleRate, false); audioClip.SetData(wav.data, 0); audioTexture = PaintWaveformSpectrum(audioClip, 1, WIDTH, HEIGHT, Color.yellow); } }