/// <summary>
        /// Update SFX selection
        /// </summary>
        public void UpdateSFXSelection()
        {
            int sfx_file_index = SFXFileIndex;
            int num_banks      = 0;

            if (sfx_file_index >= 0)
            {
                GTAAudioSFXFile[] sfx_audio_files = gtaAudioFiles.SFXAudioFiles;
                if (sfx_audio_files != null)
                {
                    if (sfx_file_index < sfx_audio_files.Length)
                    {
                        GTAAudioSFXFile sfx_audio_file = sfx_audio_files[sfx_file_index];
                        if (sfx_audio_file != null)
                        {
                            num_banks = sfx_audio_file.NumBanks - 1;
                        }
                    }
                }
            }
            if (sfxBankSlider != null)
            {
                sfxBankSlider.value    = 0.0f;
                sfxBankSlider.maxValue = Mathf.Max(0, num_banks);
            }
            UpdateSFXBankSelection();
        }
        /// <summary>
        /// Update sfx bank selection
        /// </summary>
        private void UpdateSFXBankSelection()
        {
            int sfx_file_index = SFXFileIndex;
            int num_audios     = 0;

            if (sfx_file_index >= 0)
            {
                GTAAudioSFXFile[] sfx_audio_files = gtaAudioFiles.SFXAudioFiles;
                if (sfx_audio_files != null)
                {
                    if (sfx_file_index < sfx_audio_files.Length)
                    {
                        GTAAudioSFXFile sfx_audio_file = sfx_audio_files[sfx_file_index];
                        if (sfx_audio_file != null)
                        {
                            num_audios = sfx_audio_file.GetNumAudioClipsFromBank((uint)SFXBankIndex) - 1;
                        }
                    }
                }
            }
            if (sfxAudioSlider != null)
            {
                sfxAudioSlider.value    = 0.0f;
                sfxAudioSlider.maxValue = Mathf.Max(0, num_audios);
            }
        }
 public void ReadFileTest()
 {
     using (GTAAudioFiles files = GTAAudio.OpenRead(Config.AudioFilesDir))
     {
         Assert.IsNotNull(files, "Files can't be opened. Please configure \"" + configPath + "\".");
         GTAAudioSFXFile[] sfx_audio_files = files.SFXAudioFiles;
         Assert.IsTrue(sfx_audio_files.Length == validSFXFiles.Length, "Missing SFX file entries. " + files.SFXAudioFiles.Length + " files found, not " + validSFXFiles.Length);
         for (int i = 0, j, k; i < sfx_audio_files.Length; i++)
         {
             GTAAudioSFXFile sfx_audio_file = sfx_audio_files[i];
             if (sfx_audio_file != null)
             {
                 Assert.IsTrue(sfx_audio_file.Name == validSFXFiles[i], "SFX file \"" + sfx_audio_file.Name + "\" is not \"" + validSFXFiles[i] + "\" at index " + i);
                 Debug.WriteLine(sfx_audio_file.Name + ":");
                 Debug.WriteLine("\tNumber of banks: " + sfx_audio_file.NumBanks);
                 for (j = 0; j < sfx_audio_file.NumBanks; j++)
                 {
                     GTAAudioBankData bank_data = sfx_audio_file.GetBankData((uint)j);
                     Debug.WriteLine("\t\t" + sfx_audio_file.Name + " bank " + j + ":");
                     Debug.WriteLine("\t\t\tLength: " + bank_data.Length);
                     Debug.WriteLine("\t\t\tOffset: " + bank_data.Offset);
                     Debug.WriteLine("\t\t\tNumber of audio clips: " + bank_data.NumAudioClips);
                     for (k = 0; k < bank_data.NumAudioClips; k++)
                     {
                         GTAAudioAudioClipData audio_clip_data = bank_data.GetAudioClipData((uint)k);
                         Debug.WriteLine("\t\t\t" + sfx_audio_file.Name + " bank " + j + " audio " + k + ":");
                         Debug.WriteLine("\t\t\t\tSample rate: " + audio_clip_data.SampleRate);
                         Debug.WriteLine("\t\t\t\tSound buffer offset: " + audio_clip_data.SoundBufferOffset);
                         Debug.WriteLine("\t\t\t\tLoop offset: " + audio_clip_data.LoopOffset);
                         Debug.WriteLine("\t\t\t\tSound headroom: " + audio_clip_data.SoundHeadroom);
                         Debug.WriteLine("\t\t\t\tLength: " + audio_clip_data.Length);
                     }
                 }
             }
         }
         GTAAudioStreamsFile[] streams_audio_files = files.StreamsAudioFiles;
         Assert.IsTrue(streams_audio_files.Length == validStreamsFiles.Length, "Missing streams file entries. " + files.SFXAudioFiles.Length + " files found, not " + validSFXFiles.Length);
         for (int i = 0, j; i < streams_audio_files.Length; i++)
         {
             GTAAudioStreamsFile streams_audio_file = streams_audio_files[i];
             if (streams_audio_file != null)
             {
                 Assert.IsTrue(streams_audio_file.Name == validStreamsFiles[i], "Streams file \"" + streams_audio_file.Name + "\" is not \"" + validStreamsFiles[i] + "\" at index " + i);
                 Debug.WriteLine(streams_audio_file.Name + ":");
                 Debug.WriteLine("\tNumber of banks: " + streams_audio_file.NumBanks);
                 for (j = 0; j < streams_audio_file.NumBanks; j++)
                 {
                     GTAAudioBankData bank_data = streams_audio_file.GetBankData((uint)j);
                     Debug.WriteLine("\t\t" + streams_audio_file.Name + " bank " + j + ":");
                     Debug.WriteLine("\t\t\tLength: " + bank_data.Length);
                     Debug.WriteLine("\t\t\tOffset: " + bank_data.Offset);
                 }
                 for (j = 0; j < streams_audio_file.NumBeats; j++)
                 {
                     GTAAudioBeatData beat_data = streams_audio_file.GetBeatData((uint)j);
                     Debug.WriteLine("\t\t\t" + streams_audio_file.Name + " beat " + j + ":");
                     Debug.WriteLine("\t\t\t\tControl: " + beat_data.Control);
                     Debug.WriteLine("\t\t\t\tTiming: " + beat_data.Timing);
                 }
             }
         }
     }
 }