MediaPortal.MusicPlayer.BASS.BassAudioEngine.PlayInternal C# (CSharp) Method

PlayInternal() private method

Called to start playback of next files internally, without makinbg use of g_player. This gives us the capability to achieve gapless playback.
private PlayInternal ( string filePath ) : bool
filePath string
return bool
    private bool PlayInternal(string filePath)
    {
      if (filePath == string.Empty)
      {
        return false;
      }

      // Cue support
      if (HandleCueFile(ref filePath, true))
      {
        return true;
      }

      _filePath = filePath;

      MusicStream stream = new MusicStream(filePath);

      if (stream.BassStream == 0)
      {
        return false;
      }

      _streams.Add(stream);

      if (stream.Filetype.FileMainType == FileMainType.CDTrack)
      {
        _isCDDAFile = true;
      }
      else
      {
        _isCDDAFile = false;
      }

      if (_mixer == null)
      {
        _mixer = new MixerStream(this);
        _mixer.MusicStreamMessage += OnMusicStreamMessage;
        if (!_mixer.CreateMixer(stream))
        {
          Log.Error("BASS: Could not create Mixer. Aborting playback.");
          return false;
        }
      }
      else
      {
        if (NewMixerNeeded(stream))
        {
          Log.Debug("BASS: New stream has different number of channels or sample rate. Need a new mixer.");
          // Free Mixer
          _mixer.Dispose();
          _mixer = null;
          _mixer = new MixerStream(this);
          _mixer.MusicStreamMessage += OnMusicStreamMessage;
          if (!_mixer.CreateMixer(stream))
          {
            Log.Error("BASS: Could not create Mixer. Aborting playback.");
            return false;
          }
        }
      }

      // Enable events, for various Playback Actions to be handled
      stream.MusicStreamMessage += new MusicStream.MusicStreamMessageHandler(OnMusicStreamMessage);

      SetCueTrackEndPosition(stream, false);

      // Plug in the stream into the Mixer
      if (!_mixer.AttachStream(stream))
      {
        return false;
      }

      return true;
    }