Example #1
0
        /// <summary>
        /// Creates a new sub-warp shuffle operation that operates
        /// on sub-groups of a warp.
        /// </summary>
        /// <param name="variable">The variable.</param>
        /// <param name="origin">The shuffle origin (depends on the operation).</param>
        /// <param name="width">The sub-warp width.</param>
        /// <param name="kind">The operation kind.</param>
        /// <returns>A node that represents the sub shuffle operation.</returns>
        public ValueReference CreateShuffle(
            Value variable,
            Value origin,
            Value width,
            ShuffleKind kind)
        {
            Debug.Assert(variable != null, "Invalid variable value");
            Debug.Assert(origin != null, "Invalid origin value");
            Debug.Assert(width != null, "Invalid width value");

            if (width is WarpSizeValue)
            {
                return(CreateShuffle(
                           variable,
                           origin,
                           kind));
            }

            return(Append(new SubWarpShuffle(
                              BasicBlock,
                              variable,
                              origin,
                              width,
                              kind)));
        }
Example #2
0
        public async Task LoadSongsFromStorage()
        {
            List <StorageFile> files = await GetStorageFolderFiles();

            List <Song> foundSongs = await GetSongsFromStorageFiles(files);

            List <Song> updatedSongs = SetCurrentSongsOrderedWithAddedSongs(new List <Song>(), foundSongs);

            if (Library.Current.CanceledLoading)
            {
                return;
            }

            songPostionMilliseconds = 0;
            songs   = updatedSongs;
            Shuffle = ShuffleKind.Off;
            GenerateShuffleList();

            songsIndex = 0;

            if (IsEmptyOrLoading)
            {
                Library.Current.Delete(this);
            }
            else
            {
                UpdateAndSendToBackground();
            }
        }
Example #3
0
 /// <summary>
 /// Creates a new shuffle operation.
 /// </summary>
 /// <param name="location">The current location.</param>
 /// <param name="variable">The variable.</param>
 /// <param name="origin">The shuffle origin (depends on the operation).</param>
 /// <param name="kind">The operation kind.</param>
 /// <returns>A node that represents the shuffle operation.</returns>
 public ValueReference CreateShuffle(
     Location location,
     Value variable,
     Value origin,
     ShuffleKind kind) =>
 Append(new WarpShuffle(
            GetInitializer(location),
            variable,
            origin,
            kind));
Example #4
0
 /// <summary>
 /// Constructs a new shuffle operation.
 /// </summary>
 /// <param name="basicBlock">The parent basic block.</param>
 /// <param name="variable">The source variable value.</param>
 /// <param name="origin">The shuffle origin.</param>
 /// <param name="kind">The operation kind.</param>
 internal WarpShuffle(
     BasicBlock basicBlock,
     ValueReference variable,
     ValueReference origin,
     ShuffleKind kind)
     : base(
         basicBlock,
         ImmutableArray.Create(variable, origin),
         kind)
 {
 }
Example #5
0
 /// <summary>
 /// Constructs a new shuffle operation.
 /// </summary>
 /// <param name="basicBlock">The parent basic block.</param>
 /// <param name="values">The values.</param>
 /// <param name="kind">The operation kind.</param>
 internal ShuffleOperation(
     BasicBlock basicBlock,
     ImmutableArray <ValueReference> values,
     ShuffleKind kind)
     : base(
         basicBlock,
         values,
         ComputeType(values[0].Type))
 {
     Kind = kind;
 }
Example #6
0
        public Playlist()
        {
            Name         = Library.IsLoaded ? "None" : "Loading";
            absolutePath = emptyOrLoadingPath;

            Loop    = LoopKind.Off;
            Shuffle = ShuffleKind.Off;

            songs       = new List <Song>();
            shuffleList = new List <int>();
        }
Example #7
0
 /// <summary>
 /// Constructs a new shuffle operation.
 /// </summary>
 /// <param name="basicBlock">The parent basic block.</param>
 /// <param name="variable">The source variable value.</param>
 /// <param name="origin">The shuffle origin.</param>
 /// <param name="width">The sub-warp width.</param>
 /// <param name="kind">The operation kind.</param>
 internal SubWarpShuffle(
     BasicBlock basicBlock,
     ValueReference variable,
     ValueReference origin,
     ValueReference width,
     ShuffleKind kind)
     : base(
         ValueKind.SubWarpShuffle,
         basicBlock,
         ImmutableArray.Create(variable, origin, width),
         kind)
 {
 }
Example #8
0
        /// <summary>
        /// Creates a new shuffle operation.
        /// </summary>
        /// <param name="variable">The variable.</param>
        /// <param name="origin">The shuffle origin (depends on the operation).</param>
        /// <param name="kind">The operation kind.</param>
        /// <returns>A node that represents the shuffle operation.</returns>
        public ValueReference CreateShuffle(
            Value variable,
            Value origin,
            ShuffleKind kind)
        {
            Debug.Assert(variable != null, "Invalid variable value");
            Debug.Assert(origin != null, "Invalid origin value");

            return(Append(new WarpShuffle(
                              BasicBlock,
                              variable,
                              origin,
                              kind)));
        }
        private static void GetSongsIndexAndShuffle(ValueSet valueSet)
        {
            int         songsIndex      = int.Parse(valueSet["SongsIndexAndShuffle"].ToString());
            double      naturalDuration = double.Parse(valueSet["NaturalDuration"].ToString());
            ShuffleKind shuffle         = XmlConverter.Deserialize <ShuffleKind>(valueSet["ShuffleKind"].ToString());
            List <int>  shuffleList     = XmlConverter.Deserialize <List <int> >(valueSet["ShuffleList"].ToString());

            ViewModel.Current.CurrentPlaylist.Shuffle = shuffle;

            ViewModel.Current.CurrentPlaylist.ShuffleList = shuffleList;
            ViewModel.Current.CurrentPlaylist.UpdateSongsAndShuffleListSongs();

            ViewModel.Current.CurrentPlaylist.SongsIndex = songsIndex;
            ViewModel.Current.CurrentPlaylist.CurrentSong.NaturalDurationMilliseconds = naturalDuration;
        }
Example #10
0
 /// <summary>
 /// Creates a new sub-warp shuffle operation that operates
 /// on sub-groups of a warp.
 /// </summary>
 /// <param name="location">The current location.</param>
 /// <param name="variable">The variable.</param>
 /// <param name="origin">The shuffle origin (depends on the operation).</param>
 /// <param name="width">The sub-warp width.</param>
 /// <param name="kind">The operation kind.</param>
 /// <returns>A node that represents the sub shuffle operation.</returns>
 public ValueReference CreateShuffle(
     Location location,
     Value variable,
     Value origin,
     Value width,
     ShuffleKind kind) =>
 width is WarpSizeValue
     ? CreateShuffle(
     location,
     variable,
     origin,
     kind)
     : Append(new SubWarpShuffle(
                  GetInitializer(location),
                  variable,
                  origin,
                  width,
                  kind));
Example #11
0
        public Playlist(CurrentSong currentSong)
        {
            Name         = Library.IsLoaded ? "None" : "Loading";
            absolutePath = emptyOrLoadingPath;

            Loop    = LoopKind.Off;
            Shuffle = ShuffleKind.Off;

            songs = new List <Song>()
            {
                currentSong.Song
            };
            shuffleList = new List <int>()
            {
                0
            };

            songsIndex = 0;
            songPostionMilliseconds = currentSong.PositionMilliseconds;
        }
Example #12
0
 public static string GetShuffleOperation(ShuffleKind kind) =>
 ShuffleOperations[(int)kind];