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);
        }