/// <summary>
 /// Stops playback.
 /// </summary>
 /// <param name="parameter"></param>
 private void Stop(object parameter)
 {
     if (_player != null)
     {
         _player.Stop();
         _player.Dispose();
         _player = null;
     }
 }
        /// <summary>
        /// Starts playback on the currently selected device with the current tracks.
        /// </summary>
        /// <param name="parameter"></param>
        private void Play(object parameter)
        {
            DeviceViewModel currentDevice = (DeviceViewModel)_devices.CurrentItem;
            if (currentDevice != null)
            {
                if (_player != null)
                {
                    _player.Stop();
                    _player.Dispose();
                    _player = null;
                }

                Device playbackDevice = new Device(currentDevice.DriverGuid);
                playbackDevice.SetCooperativeLevel(_windowHandle, CooperativeLevel.Normal);

                Track[] tracks = new Track[_tracks.Count];
                int t = 0;
                foreach (TrackViewModel track in _tracks)
                {
                    tracks[t] = new Track(WaveData.FromFile(track.FilePath), track.GetBeatArray());
                    t++;
                }

                BeatBoxMixer mixer = new BeatBoxMixer(_bpm, tracks);
                _player = new StreamPlayer(playbackDevice, tracks[0].Format, mixer);
                _player.Play();
            }
        }