Beispiel #1
0
 public bool GetSoundtrack(int trackIndex, out string trackPath, out TR_AUDIO_STREAM_METHOD loadMethod, out TR_AUDIO_STREAM_TYPE streamType)
 {
     var res = Call("getTrackInfo", (int) EngineWorld.EngineVersion, trackIndex);
     trackPath = (string) res[0];
     streamType = (TR_AUDIO_STREAM_TYPE) (int) res[1];
     loadMethod = (TR_AUDIO_STREAM_METHOD) (int) res[2];
     return streamType != TR_AUDIO_STREAM_TYPE.Unknown;
 }
Beispiel #2
0
        /// <summary>
        /// Load routine prepares track for playing. Arguments are track index,
        /// stream type (background, one-shot or chat) and load method, which
        /// differs for TR1-2, TR3 and TR4-5.
        /// </summary>
        public bool Load(string path, int index, TR_AUDIO_STREAM_TYPE type, TR_AUDIO_STREAM_METHOD loadMethod)
        {
            if (path == null || loadMethod >= TR_AUDIO_STREAM_METHOD.LastIndex || type >= TR_AUDIO_STREAM_TYPE.LastIndex)
                return false; // Do not load, if path, type or method are incorrect.

            currentTrack = index;
            streamType = type;
            method = loadMethod;
            IsDampable = streamType == TR_AUDIO_STREAM_TYPE.Background; // Damp only looped (BGM) tracks.

            // Select corresponding stream loading method.
            return 
                method == TR_AUDIO_STREAM_METHOD.Track 
                ? loadTrack(path) 
                : loadWad((byte) index, path);
        }
Beispiel #3
0
 /// <summary>
 /// Resume all streams [of specified type]
 /// </summary>
 public static void ResumeStreams(TR_AUDIO_STREAM_TYPE streamType = TR_AUDIO_STREAM_TYPE.Unknown)
 {
     throw new NotImplementedException("Not implemented in OpenTomb!");
 }
Beispiel #4
0
        /// <summary>
        /// Immediately stop all streams [of specified type]
        /// </summary>
        public static bool StopStreams(TR_AUDIO_STREAM_TYPE streamType = TR_AUDIO_STREAM_TYPE.Unknown)
        {
            var res = false;

            foreach (
                var c in
                    EngineWorld.StreamTracks.Where(
                        c => c.IsPlaying && (c.IsType(streamType) || streamType == TR_AUDIO_STREAM_TYPE.Unknown)))
            {
                res = true;
                c.Stop();
            }

            return res;
        }
Beispiel #5
0
 /// <summary>
 /// Check desired track's type
 /// </summary>
 public bool IsType(TR_AUDIO_STREAM_TYPE trackType)
 {
     return trackType == streamType;
 }