private void CleanUpSound(ref FMOD.Sound fmodSound)
        {
            this.State = PlayerState.Stop;
              this.CurrentMediaFile = null;

              if (this.channelInfo != null && this.channelInfo.Channel != null) {
            this.channelInfo.File.State = PlayerState.Stop;
            this.channelInfo.Channel.setCallback(null);
            this.channelInfo.Channel = null;
            this.channelInfo.File = null;
            this.channelInfo = null;
              }

              if (fmodSound != null) {
            var result = fmodSound.release();
            result.ERRCHECK();
            fmodSound = null;
              }

              this.timer.Stop();

              this.currentPositionMs = 0;
              this.OnPropertyChanged("CurrentPositionMs");
              this.LengthMs = 0;
        }
 private void CleanUpSystem(ref FMOD.System fmodSystem)
 {
     if (fmodSystem != null) {
     var result = fmodSystem.close();
     result.ERRCHECK();
     result = fmodSystem.release();
     result.ERRCHECK();
     fmodSystem = null;
       }
 }
        private void CleanUpSound(ref FMOD.Sound fmodSound)
        {
            this.timer.Stop();

            this.State = PlayerState.Stop;
            this.CurrentMediaFile = null;

            if (this.channelInfo != null)
            {
                this.channelInfo.CleanUp();
                this.channelInfo = null;
                this.system.update().ERRCHECK();
            }

            if (fmodSound != null)
            {
                fmodSound.release().ERRCHECK();
                fmodSound = null;
                this.system.update().ERRCHECK();
            }

            this.LengthMs = 0;
            this.CurrentPositionMs = 0;
        }