Beispiel #1
0
        public void PlayVoiceLine(string voice, uint hash, Action onEnd)
        {
            //TODO: Make this asynchronous
            var      path = data.GetVoicePath(voice);
            VoiceUtf v;

            if (!voiceUtfs.TryGetValue(path, out v))
            {
                v = new VoiceUtf(path);
                voiceUtfs.Add(path, v);
            }
            var file = v.AudioFiles[hash];
            var sn   = audio.AllocateData();

            sn.LoadStream(new MemoryStream(file));
            audio.PlaySound(sn, false, 0, -1, -1, null, sn, onEnd);
        }
Beispiel #2
0
        public void PlayVoiceLine(string voice, uint hash, Action onEnd)
        {
            //TODO: Make this asynchronous
            var      path = data.GetVoicePath(voice);
            VoiceUtf v;

            if (!voiceUtfs.TryGetValue(path, out v))
            {
                v = new VoiceUtf(path);
                voiceUtfs.Add(path, v);
            }
            var file = v.AudioFiles[hash];
            var sn   = audio.AllocateData();

            sn.LoadStream(new MemoryStream(file));
            var instance = audio.CreateInstance(sn, SoundType.Voice);

            instance.DisposeOnStop = true;
            instance.OnStop        = () => {
                sn.Dispose();
                onEnd();
            };
            instance.Play();
        }