예제 #1
0
    private void SubscribeToCategory()
    {
        switch (soundType)
        {
        case SoundType.Effect:
            SoundSettings.AddToEffectSources(this);
            break;

        case SoundType.Voice:
            SoundSettings.AddToVoiceSources(this);
            break;

        case SoundType.Ambient:
            SoundSettings.AddToAmbientSources(this);
            break;

        case SoundType.Music:
            SoundSettings.AddToMusicSources(this);
            break;

        default:
            SoundSettings.AddToEffectSources(this);
            break;
        }
    }
예제 #2
0
        private void SetDefaults_Instance()
        {
            settings = GetDefaultSettings();
            Log("Default sound settings.");

            ApplyAll();
        }
예제 #3
0
        public static void CreateLocalisationSettings()
        {
            string soundName = "Assets/" + Constants.GameName.NameOfGame + "/Settings/Localisations/SoundSettings.asset";

            AssertExistingAsset(soundName);
            string textName = "Assets/" + Constants.GameName.NameOfGame + "/Settings/Localisations/TranslationSettings.asset";

            AssertExistingAsset(textName);
            string localisationName = "Assets/" + Constants.GameName.NameOfGame + "/Settings/Localisations/LocalisationSettings.asset";

            AssertExistingAsset(localisationName);

            SoundSettings soundAsset = ScriptableObject.CreateInstance <SoundSettings>();

            AssetDatabase.CreateAsset(soundAsset, soundName);

            TranslationSettings translationAsset = ScriptableObject.CreateInstance <TranslationSettings>();

            AssetDatabase.CreateAsset(translationAsset, textName);

            LocalisationSettings localisationAsset = ScriptableObject.CreateInstance <LocalisationSettings>();

            localisationAsset.Sound = new[] { soundAsset };
            localisationAsset.Text  = new[] { translationAsset };
            AssetDatabase.CreateAsset(localisationAsset, localisationName);

            Selection.activeObject = localisationAsset;
            EditorGUIUtility.PingObject(localisationAsset);
        }
예제 #4
0
        Action ResetAudioPanel(Widget panel)
        {
            var ss  = Game.Settings.Sound;
            var dss = new SoundSettings();

            return(() =>
            {
                ss.SoundVolume = dss.SoundVolume;
                ss.MusicVolume = dss.MusicVolume;
                ss.VideoVolume = dss.VideoVolume;
                ss.CashTicks = dss.CashTicks;
                ss.Mute = dss.Mute;
                ss.Device = dss.Device;
                ss.Engine = dss.Engine;

                panel.Get <SliderWidget>("SOUND_VOLUME").Value = ss.SoundVolume;
                Game.Sound.SoundVolume = ss.SoundVolume;
                panel.Get <SliderWidget>("MUSIC_VOLUME").Value = ss.MusicVolume;
                Game.Sound.MusicVolume = ss.MusicVolume;
                panel.Get <SliderWidget>("VIDEO_VOLUME").Value = ss.VideoVolume;
                Game.Sound.VideoVolume = ss.VideoVolume;
                Game.Sound.UnmuteAudio();
                soundDevice = Game.Sound.AvailableDevices().First();
            });
        }
예제 #5
0
    public static SoundManager Setup(SoundSettings settings)
    {
        instance = new GameObject("SoundManager").AddComponent <SoundManager>();

        instance.idToSound     = new Dictionary <int, SoundInstance>();
        instance.playingSounds = new List <SoundInstance>();

        instance.idCounter = 0;

        instance.soundPool = new DynamicPool <SoundInstance>(() =>
        {
            var sound = new GameObject("SFX").AddComponent <SoundInstance>();

            sound.source = sound.gameObject.AddComponent <AudioSource>();

            sound.transform.parent = instance.transform;
            sound.gameObject.SetActive(false);

            return(sound);
        });

        instance.soundPool.onFree += (SoundInstance sound) =>
        {
            sound.source.Stop();
            sound.source.clip = null;
            sound.id          = 0;

            sound.transform.parent = instance.transform;

            sound.gameObject.SetActive(false);
        };

        return(instance);
    }
예제 #6
0
파일: Sound.cs 프로젝트: OpenRA/OpenRA
        public Sound(IPlatform platform, SoundSettings soundSettings)
        {
            soundEngine = platform.CreateSound(soundSettings.Device);

            if (soundSettings.Mute)
                MuteAudio();
        }
예제 #7
0
        private void ChangeSoundDevice(SoundDevice soundDevice)
        {
            // Check recording state
            RecordingState state = this.recorder.State;

            // Debug.Assert(state == RecordingState.Idle);
            if (state != RecordingState.Idle)
            {
                return;
            }
            SoundSettings soundSettings = this.SoundSettings;

            if (soundDevice != null)
            {
                soundSettings.DeviceId = soundDevice.Id;
                if (soundSettings.Format == null)
                {
                    soundSettings.Format = SoundProvider.SuggestFormat(soundDevice.Id, null, null, null);
                    this.configuration.Sound.DeviceId = soundDevice.Id;
                }
            }
            else
            {
                soundSettings.DeviceId   = null;
                this.configuration.Sound = soundSettings;
            }
            this.SoundSettings = soundSettings;
        }
        /// <summary>
        /// Returns localised audio
        /// </summary>
        public AudioRecordSettings GetAudioClip(SoundSettingsKey key)
        {
            string clipName = SoundSettingsValue.Mapping[key];

            if (string.IsNullOrEmpty(clipName))
            {
                Debug.Log($"[AUDIO] Skipping sound: {key}");
                return(null);
            }

            if (!sounds.ContainsKey(currentLanguage))
            {
                Debug.LogError($"[LOCALISATION] Missing locale: {currentLanguage}");
                return(null);
            }

            SoundSettings soundSettings = sounds[currentLanguage];

            if (!soundSettings.CachedRecords.ContainsKey(clipName))
            {
                Debug.LogWarning($"[AUDIO] Missing sound: {key}");
                return(null);
            }

            return(soundSettings.CachedRecords[clipName]);
        }
예제 #9
0
        public SoundPlayer(SoundDevice device, SoundSettings settings)
        {
            _soundSettings = settings;
            _inputDevice   = device.Device;

            if (_inputDevice.DataFlow == DataFlow.Render)
            {
                _capture = new WasapiLoopbackCapture(_inputDevice)
                {
                    ShareMode = AudioClientShareMode.Shared
                };

                _log.Debug($"Initialized WasapiLoopbackCapture for device {_inputDevice.FriendlyName} of type {_inputDevice.DataFlow}. ShareMode: {_capture.ShareMode}, State: {_inputDevice.State}");

                _log.Debug($"Capturing in format: {_capture.WaveFormat} {_capture.WaveFormat.BitsPerSample}bit {_capture.WaveFormat.SampleRate}Hz {_capture.WaveFormat.Channels} channels");

                _captureProvider = new WaveInProvider(_capture);

                _remoteOutput = new DefaultResampler(_capture.WaveFormat).Resample(_captureProvider);

                _remoteBuffer           = new BufferedWaveProvider(SoundSettings.DiscordFormat);
                _capture.DataAvailable += (s, e) => { _remoteOutput.Read(buf, 0, e.BytesRecorded / 2); _remoteBuffer.AddSamples(buf, 0, e.BytesRecorded / 2); };
            }
            else
            {
                _capture = new WasapiCapture(_inputDevice)
                {
                    ShareMode = AudioClientShareMode.Shared
                };

                _log.Debug($"Initialized WasapiCapture for device {_inputDevice.FriendlyName} of type {_inputDevice.DataFlow}. ShareMode: {_capture.ShareMode}, State: {_inputDevice.State}.");

                _log.Debug($"Capturing in format: {_capture.WaveFormat} {_capture.WaveFormat.BitsPerSample}bit {_capture.WaveFormat.SampleRate}Hz {_capture.WaveFormat.Channels} channels");

                _captureProvider = new WaveInProvider(_capture);

                _remoteOutput = new DefaultResampler(_capture.WaveFormat).Resample(_captureProvider);

                var captureRate = _capture.WaveFormat.AverageBytesPerSecond;
                var outputRate  = SoundSettings.DiscordFormat.AverageBytesPerSecond;

                _log.Info($"Capture rate is {captureRate}, output rate is {outputRate}, that gives a ratio of {(float)captureRate / (float)outputRate}");
                _log.Debug($"Outputting in format: {_remoteOutput.WaveFormat} {_remoteOutput.WaveFormat.BitsPerSample}bit {_remoteOutput.WaveFormat.SampleRate}Hz {_remoteOutput.WaveFormat.Channels} channels");

                var rate = (float)SoundSettings.DiscordFormat.AverageBytesPerSecond / _capture.WaveFormat.AverageBytesPerSecond;

                _remoteBuffer           = new BufferedWaveProvider(_remoteOutput.WaveFormat);
                _capture.DataAvailable += (s, e) => { _remoteOutput.Read(buf, 0, (int)Math.Round(e.BytesRecorded * rate)); _remoteBuffer.AddSamples(buf, 0, (int)Math.Round(e.BytesRecorded * rate)); };
            }

            if (_soundSettings.PlayLocally)
            {
                _localOutput = new WasapiOut();
                _localBuffer = new BufferedWaveProvider(_remoteOutput.WaveFormat);

                _localOutput.Init(_localBuffer);
                _capture.DataAvailable += (s, e) => { _localBuffer.AddSamples(buf, 0, e.BytesRecorded / 2); };
            }
        }
예제 #10
0
    public void UnPauseGame()
    {
        Time.timeScale = 1;
        GameIsPaused   = false;
        SoundSettings.UnPauseAllPausableSounds();

        OnUnPause();
    }
예제 #11
0
    public void PauseGame()
    {
        Time.timeScale = 0;
        GameIsPaused   = true;
        SoundSettings.PauseAllPausableSounds();

        OnPause();
    }
예제 #12
0
    public bool Initialize(SoundSettings settings)
    {
        this.settings = settings;

        GameManager.Instance.updated += DoUpdate;

        isInitialized = true;
        return(isInitialized);
    }
예제 #13
0
    //BGM
    public void BGM(bool bgm)
    {
        ToggleEffect();
        int m = (bgm) ? 0 : 1;

        PlayerPrefs.SetInt("BGM", m);

        bgmSet = mainCamera.GetComponent <Camera>().GetComponentInChildren <SoundSettings>();
        bgmSet.BGM(bgm);
    }
예제 #14
0
 private void Initialise()
 {
     CurrentGameState = GameState.Intro;
     warningOfClothingTypeChangeInProgress = false;
     introTimeLeft = introDuration;
     InitialiseClothingTypeRequired();
     UnPauseGame();
     SoundSettings.StopAllSounds();
     SoundSettings.Instance.PlaySound(SoundNames.Background);
 }
예제 #15
0
파일: ImpactSound.cs 프로젝트: jslone/Jenga
    void OnCollisionExit(Collision col)
    {
        sustainedContactSound.Stop();

        SoundSettings oldSettings = colliderVolumeContribution[col.collider];

        sustainedContactSound.volume -= oldSettings.volume;
        sustainedContactPitch        -= oldSettings.pitch;

        colliderVolumeContribution.Remove(col.collider);
    }
예제 #16
0
        private void OnOK(EventArgs e)
        {
            // General
            GeneralSettings general = this.configuration.General;

            general.MinimizeOnRecord = this.chkMinimizeOnRecord.Checked;
            general.HideFromTaskbar  = this.chkHideFromTaskbar.Checked;
            general.OutputDirectory  = this.txtOutputDirectory.Text;
            // Keys
            HotKeySettings hotKeys = this.configuration.HotKeys;

            hotKeys.Cancel = this.hkCancel.Value;
            hotKeys.Global = this.chkGlobalHotKeys.Checked;
            hotKeys.Pause  = this.hkPause.Value;
            hotKeys.Record = this.hkRecord.Value;
            hotKeys.Stop   = this.hkStop.Value;
            // Mouse
            MouseSettings mouse = this.configuration.Mouse;

            mouse.HighlightCursor        = this.chkHighlighCursor.Checked;
            mouse.HighlightCursorColor   = this.cursorHighlightOptions.Color;
            mouse.HighlightCursorRadious = this.cursorHighlightOptions.Radious;
            mouse.RecordCursor           = this.chkRecordCursor.Checked;
            // Sound
            SoundSettings sound = this.configuration.Sound;
            SoundDevice   selectedSoundDevice = this.soundDeviceSelector.SoundDevice;

            sound.DeviceId = selectedSoundDevice != null ? selectedSoundDevice.Id : null;
            sound.Format   = this.cmbSoundFormat.SelectedItem as SoundFormat;
            // Tracking
            // this.configuration.Tracking = this.trackerSelector.TrackingSettings;
            // Video
            VideoSettings video = this.configuration.Video;

            video.Compressor = (this.cmbCompressor.SelectedItem as Avi.VideoCompressor).FccHandlerString;
            video.Fps        = this.videoFps;
            video.Quality    = this.videoQuality;
            // Watermark
            WatermarkSettings watermark = this.configuration.Watermark;

            watermark.Alignment    = this.watermarkOptions.WatermarkAlignment;
            watermark.Color        = this.watermarkOptions.WatermarkColor;
            watermark.Display      = this.chkWatermark.Checked;
            watermark.Font         = this.watermarkOptions.WatermarkFont;
            watermark.Margin       = this.watermarkOptions.WatermarkMargin;
            watermark.Outline      = this.watermarkOptions.WatermarkOutline;
            watermark.OutlineColor = this.watermarkOptions.WatermarkOutlineColor;
            watermark.RightToLeft  = this.watermarkOptions.WatermarkRightToLeft;
            watermark.Text         = this.watermarkOptions.WatermarkText;
            if (this.OK != null)
            {
                this.OK(this, e);
            }
        }
예제 #17
0
    /// <summary>
    /// Plays an audio clip from id (if it exists) at a certain pitch (default 1)
    /// </summary>
    /// <param name="soundClip"></param>
    /// <param name="pitch"></param>
    public void PlayAudio(Sound soundClip, float pitch = 1)
    {
        SoundSettings sound = Array.Find(sounds, t => t.id == soundClip);

        if (sound == null)
        {
            Debug.LogError($"Sound {sound} not found!");
        }

        sound.source.pitch = pitch;
        sound.source.Play();
    }
예제 #18
0
 public SoundsViewModel(IDialogService dialogService, SoundSettings settings)
 {
     Items = new[]
     {
         SoundKind.Start,
         SoundKind.Stop,
         SoundKind.Pause,
         SoundKind.Shot,
         SoundKind.Error,
         SoundKind.Notification
     }.Select(kind => new SoundsViewModelItem(kind, dialogService, settings)).ToList();
 }
 public Status UpdateUserSoundSettings(string userID, SoundSettings soundSettings)
 {
     if (_ListOfUsers.Exists(x => x.ID == userID))
     {
         _ListOfUsers[_ListOfUsers.FindIndex(x => x.ID == userID)].SoundSettings = soundSettings;
     }
     else
     {
         return(Status.Error);
     }
     return(Status.OK);
 }
예제 #20
0
        private void PopulateSoundSettings()
        {
            var soundSettings = new SoundSettings()
            {
                PlayRewindSound  = rewindCheckBox.Checked,
                PlayTickingSound = tickingSoundcheckBox.Checked,
                PlayRingSound    = ringSoundcheckBox.Checked,
            };

            this.plugins.CherryCommands["Set Sound Settings"].Do(
                new SoundSettingsCommandArgs(soundSettings));
        }
예제 #21
0
 public Status UpdateUserSoundSettings(string userID, SoundSettings soundSettings)
 {
     if (_ListOfUsers.Exists(x => x.ID == userID))
     {
         _ListOfUsers[_ListOfUsers.FindIndex(x => x.ID == userID)].SoundSettings = soundSettings;
     }
     else
     {
         return Status.Error;
     }
     return Status.OK;
 }
예제 #22
0
    private void Start()
    {
        string path = Path.Combine(Application.persistentDataPath, "Settings", "SoundSettings.json");

        if (File.Exists(path) && masterMixer)
        {
            SoundSettings settings = JsonUtility.FromJson <SoundSettings>(File.ReadAllText(path));

            SetVolume(settings.MasterIsOn, "MasterVolume", settings.MasterDecibel);
            SetVolume(settings.MusicIsOn, "MusicVolume", settings.MusicDecibel);
            SetVolume(settings.EffectsIsOn, "EffectsVolume", settings.EffectsDecibel);
        }
    }
예제 #23
0
    private void OnEnable()
    {
        soundSettings = new SoundSettings();

        masterSlider.onValueChanged.AddListener(delegate { OnVolumeMasterChange(); });
        musicSlider.onValueChanged.AddListener(delegate { OnVolumeMusicChange(); });
        effectsSlider.onValueChanged.AddListener(delegate { OnVolumeEffectsChange(); });

        masterToggle.onValueChanged.AddListener(delegate { OnMasterVolumeToggle(); });
        musicToggle.onValueChanged.AddListener(delegate { OnMusicVolumeToggle(); });
        effectsToggle.onValueChanged.AddListener(delegate { OnEffectsVolumeToggle(); });

        LoadSettings();
    }
예제 #24
0
    // Start is called before the first frame update
    void Start()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(this.gameObject);
            return;
        }

        DontDestroyOnLoad(this.gameObject);
    }
예제 #25
0
        private void ApplyConfiguration(Configuration oldConfiguration)
        {
            // General
            GeneralSettings general = this.configuration.General;

            this.view.HideFromTaskbar = general.HideFromTaskbar;
            // Display (Mouse, Tracking and Watermark)
            this.DisplaySettings = new DisplaySettings()
            {
                Mouse     = configuration.Mouse,
                Tracking  = configuration.Tracking,
                Watermark = configuration.Watermark,
            };
            this.view.TrackingSettings = configuration.Tracking;
            // Hot Keys
            HotKeySettings hotKey = this.configuration.HotKeys;

            this.view.CancelHotKey = hotKey.Cancel;
            this.view.PauseHotKey  = hotKey.Pause;
            this.view.RecordHotKey = hotKey.Record;
            this.view.StopHotKey   = hotKey.Stop;
            this.UpdateHotKeys(oldConfiguration != null ? oldConfiguration.HotKeys : null);
            // Sound
            SoundSettings sound = this.configuration.Sound;

            SoundDevice[] soundDevices = SoundProvider.GetDevices();
            this.view.SoundDevices = soundDevices;
            string      soundDeviceId = sound.DeviceId;
            SoundDevice soundDevice   = null;

            if (!string.IsNullOrEmpty(soundDeviceId))
            {
                soundDevice = SoundProvider.GetDeviceOrDefault(soundDeviceId);
                if (soundDevice != null)
                {
                    // Update configuration if device id is invalid
                    sound.DeviceId = soundDevice.Id;
                }
            }
            this.view.SoundDevice = soundDevice;
            this.SoundSettings    = this.configuration.Sound;
            // Get updated (valid) configuration from recorder
            this.configuration.Sound = this.SoundSettings;
            // Video
            this.recorder.VideoSettings = this.configuration.Video;
            // Get updated (valid) configuration from recorder
            this.configuration.Video = this.recorder.VideoSettings;
            this.UpdateView();
        }
예제 #26
0
    private BaseSound CreateSound(SoundSettings sound)
    {
        switch (sound.Type)
        {
        case SoundSettings.SoundFileType.Recources:
            return(new ResourceSound(sound.Name));

        case SoundSettings.SoundFileType.File:
            return(new FileSound(sound.Name));

        case SoundSettings.SoundFileType.Remote:
            return(new RemoteSound(sound.Name));
        }
        return(null);
    }
예제 #27
0
    public SoundManager(GameObject parentGO, SoundSettings settings)
    {
        this.settings = settings;

        parentGO.AddComponent <AudioListener>();

        theme      = parentGO.AddComponent <AudioSource>();
        theme.clip = settings.mainTheme;
        theme.loop = true;
        theme.Play();

        splatter      = parentGO.AddComponent <AudioSource>();
        splatter.clip = settings.splatter;
        splatter.loop = false;
    }
예제 #28
0
        public async Task <bool> UpdateSoundSettings(SoundSettings settings)
        {
            try
            {
                var appSettings = await GetAppSettings().ConfigureAwait(false);

                appSettings.SoundSettings = settings;
                await AppSettingsRepository.Replace(appSettings).ConfigureAwait(false);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
예제 #29
0
파일: ImpactSound.cs 프로젝트: jslone/Jenga
    void OnCollisionEnter(Collision col)
    {
        SoundSettings settings = createSettings(col.relativeVelocity.magnitude);

        impactSound.volume = settings.volume;

        sustainedContactSound.volume += settings.volume;
        sustainedContactPitch        += settings.pitch;

        colliderVolumeContribution[col.collider] = settings;

        impactSound.Play();

        sustainedContactSound.time = Random.Range(0, sustainedContactSound.clip.length * 0.999f);
        sustainedContactSound.Play();
    }
예제 #30
0
        public SoundsViewModelItem(SoundKind SoundKind, IDialogService DialogService, SoundSettings Settings)
        {
            this.SoundKind = SoundKind;
            _settings      = Settings;

            ResetCommand = new DelegateCommand(() => FileName = null);

            SetCommand = new DelegateCommand(() =>
            {
                var folder = DialogService.PickFile(Path.GetDirectoryName(FileName), "");

                if (folder != null)
                {
                    FileName = folder;
                }
            });
        }
예제 #31
0
        bool ShowAudioDeviceDropdown(DropDownButtonWidget dropdown, SoundSettings s, SoundDevice[] devices)
        {
            var i       = 0;
            var options = devices.ToDictionary(d => (i++).ToString(), d => d);

            Func <string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
            {
                var item = ScrollItemWidget.Setup(itemTemplate,
                                                  () => soundDevice == options[o],
                                                  () => soundDevice = options[o]);

                item.Get <LabelWidget>("LABEL").GetText = () => options[o].Label;
                return(item);
            };

            dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
            return(true);
        }
예제 #32
0
파일: ImpactSound.cs 프로젝트: jslone/Jenga
    void OnCollisionStay(Collision col)
    {
        if (!sustainedContactSound.isPlaying)
        {
            sustainedContactSound.Play();
            sustainedContactSound.time = Random.Range(0.0f, sustainedContactSound.clip.length * 0.999f);
        }

        SoundSettings newSettings = createSettings(col.relativeVelocity.magnitude);
        SoundSettings oldSettings;

        colliderVolumeContribution.TryGetValue(col.collider, out oldSettings);

        sustainedContactSound.volume += newSettings.volume - oldSettings.volume;
        sustainedContactPitch        += newSettings.pitch - oldSettings.pitch;

        colliderVolumeContribution[col.collider] = newSettings;
    }
예제 #33
0
        Action ResetAudioPanel(Widget panel)
        {
            var ss = Game.Settings.Sound;
            var dss = new SoundSettings();
            return () =>
            {
                ss.SoundVolume = dss.SoundVolume;
                ss.MusicVolume = dss.MusicVolume;
                ss.VideoVolume = dss.VideoVolume;
                ss.CashTicks = dss.CashTicks;
                ss.Mute = dss.Mute;
                ss.Device = dss.Device;
                ss.Engine = dss.Engine;

                panel.Get<SliderWidget>("SOUND_VOLUME").Value = ss.SoundVolume;
                Game.Sound.SoundVolume = ss.SoundVolume;
                panel.Get<SliderWidget>("MUSIC_VOLUME").Value = ss.MusicVolume;
                Game.Sound.MusicVolume = ss.MusicVolume;
                panel.Get<SliderWidget>("VIDEO_VOLUME").Value = ss.VideoVolume;
                Game.Sound.VideoVolume = ss.VideoVolume;
                Game.Sound.UnmuteAudio();
                soundDevice = Game.Sound.AvailableDevices().First();
            };
        }
예제 #34
0
        private void SoundsReadWriteSettings(bool read)
        {
            try
            {
                FileInfo SoundSettingsFile = new FileInfo(GearDir + @"\Sounds.xml");

                if (read)
                {
                    try
                    {
                        if (!SoundSettingsFile.Exists)
                        {
                            try
                            {
                                mSoundsSettings = new SoundSettings();

                                using (XmlWriter writer = XmlWriter.Create(SoundSettingsFile.ToString()))
                                {
                           			XmlSerializer serializer2 = new XmlSerializer(typeof(SoundSettings));
                           			serializer2.Serialize(writer, mSoundsSettings);
                           			writer.Close();
                                }
                            }
                            catch (Exception ex) { LogError(ex); }
                        }

                        using (XmlReader reader = XmlReader.Create(SoundSettingsFile.ToString()))
                        {
                            XmlSerializer serializer = new XmlSerializer(typeof(SoundSettings));
                            mSoundsSettings = (SoundSettings)serializer.Deserialize(reader);
                            reader.Close();
                        }
                    }
                    catch
                    {
                        mSoundsSettings = new SoundSettings();
                    }
                }

                if(!read)
                {
                    if(SoundSettingsFile.Exists)
                    {
                        SoundSettingsFile.Delete();
                    }

                    using (XmlWriter writer = XmlWriter.Create(SoundSettingsFile.ToString()))
                    {
               			XmlSerializer serializer2 = new XmlSerializer(typeof(SoundSettings));
               			serializer2.Serialize(writer, mSoundsSettings);
               			writer.Close();
                    }
                }
            }catch(Exception ex){LogError(ex);}
        }