using System; /// /// GTA audio sharp namespace /// namespace GTAAudioSharp { /// /// GTA audio bank data structure /// public struct GTAAudioBankData { /// /// Offset /// public readonly uint Offset; /// /// Length /// public readonly uint Length; /// /// Audio clip data /// private GTAAudioAudioClipData[] audioClipData; /// /// Audio clip data /// internal GTAAudioAudioClipData[] AudioClipData { get { if (audioClipData == null) { audioClipData = new GTAAudioAudioClipData[0]; } return audioClipData; } } /// /// Number of audio clips /// public int NumAudioClips { get { return AudioClipData.Length; } } /// /// Constructor /// /// Offset /// Length internal GTAAudioBankData(uint offset, uint length) { Offset = offset; Length = length; audioClipData = null; } /// /// Constructor /// /// Offset /// Length /// Audio clip data internal GTAAudioBankData(uint offset, uint length, GTAAudioAudioClipData[] audioClipData) { Offset = offset; Length = length; this.audioClipData = audioClipData; } /// /// Is audio clip available /// /// Audio clip index /// "true" if audio clip is available, otherwise "false" public bool IsAudioClipAvailable(uint audioClipIndex) { return (audioClipIndex < NumAudioClips); } /// /// Get audio clip data /// /// Audio clip index /// Audio clip data public GTAAudioAudioClipData GetAudioClipData(uint audioClipIndex) { if (!(IsAudioClipAvailable(audioClipIndex))) { throw new IndexOutOfRangeException("Audio clip index: " + audioClipIndex + "; Number of audio clips: " + NumAudioClips); } return AudioClipData[audioClipIndex]; } } }