Beispiel #1
0
    public void UpdateSelectedSongOption(SongOption newOption)
    {
        if (selectedSongOption != null && selectedSongOption != newOption)
        {
            selectedSongOption.UnSelectOption();
        }

        selectedSongOption = newOption;
    }
        public void Build(SongOption songOption)
        {
            Task.Run(() =>
            {
                BildSong(songOption);
                IsFinished = true;
                builder    = null;

                Console.WriteLine("Finished build: " + ID);
            });
        }
Beispiel #3
0
        public int Build(SongOption songOption)
        {
            AllowCORS();

            lastID++;
            BuilderTask task = new BuilderTask()
            {
                ID = lastID, FilePath = FilePath
            };

            task.Build(songOption);
            taskList.Add(task);
            return(task.ID);
        }
        private void BildSong(SongOption songOption)
        {
            //Generate the melody
            AutogenratedSong song = new AutogenratedSong(songOption);

            song.Generate();

            //Create wave file builder and register event for progressbar
            builder = new WaveFileBuilder();

            //Dependency Injection (Setter Injection)
            song.SetBuilder(builder);

            //Generate the wave file
            song.Build(Path.Combine(FilePath, ID.ToString() + ".wav"));
        }
Beispiel #5
0
    private void populateSongOptions()
    {
        foreach (var songPath in Directory.GetDirectories(songsPath))
        {
            string songName      = findSongName(songPath);
            string songId        = findSongId(songPath);
            string thumbnailPath = Directory.GetFiles(songPath, "*.jpg")[0];

            SongOption newOption = Instantiate(songOption_p);
            newOption.Title = songName;
            newOption.SetImage(thumbnailPath);
            newOption.transform.SetParent(songOptionsParent);
            newOption.SongId = songId;

            newOption.GetComponent <RectTransform>().localScale = Vector3.one;

            activeSongOptions.Add(newOption);
        }
    }