Exemple #1
0
 void Start()
 {
     foreach (string device in Microphone.devices)
     {
         Debug.Log("Name: " + device);
     }
     SongMetaManager.ScanFiles();
 }
Exemple #2
0
    private void SendLoadedSongs(EndpointRequestData requestData)
    {
        SongMetaManager songMetaManager = SongMetaManager.Instance;

        requestData.Context.Response.SendResponse(new LoadedSongsDto
        {
            IsSongScanFinished = SongMetaManager.IsSongScanFinished,
            SongCount          = songMetaManager.GetSongMetas().Count,
            SongList           = songMetaManager.GetSongMetas()
                                 .Select(songMeta => new SongDto
            {
                Artist = songMeta.Artist,
                Title  = songMeta.Title,
                Hash   = songMeta.SongHash,
            })
                                 .ToList()
        }.ToJson());
    }
Exemple #3
0
    private Voice LoadVoice(SongMeta songMeta, string voiceIdentifier)
    {
        Dictionary <string, Voice> voices = SongMetaManager.GetVoices(songMeta);

        if (string.IsNullOrEmpty(voiceIdentifier))
        {
            Voice mergedVoice = CreateMergedVoice(voices);
            return(mergedVoice);
        }
        else
        {
            if (voices.TryGetValue(voiceIdentifier, out Voice loadedVoice))
            {
                return(loadedVoice);
            }
            else
            {
                throw new Exception($"The song does not contain a voice for {voiceIdentifier}");
            }
        }
    }
Exemple #4
0
    void Update()
    {
        if (m_labelStatus != null)
        {
            int found   = SongMetaManager.GetNumberOfSongsFound();
            int success = SongMetaManager.GetNumberOfSongsSuccess();
            int failed  = SongMetaManager.GetNumberOfSongsFailed();

            m_labelStatus.text =
                System.DateTime.Now.ToLongTimeString()
                + Environment.NewLine
                + "Scanned " + (success + failed) + " out of " + found + " possible songs,"
                + Environment.NewLine
                + "of which " + success + " successful and " + failed + " failed."
                + Environment.NewLine;
        }

        if (Input.GetKeyDown(KeyCode.Return))
        {
            SceneManager.LoadScene("src/view/base/SMainView");
            m_labelStatus.text = "ooooo";
        }
    }
    private IEnumerator TrackUnpackAsync(PoolHandle handle, string tarPath, string songsPath)
    {
        if (downloadRequest == null)
        {
            yield break;
        }

        string progress1 = "Unpacking file.  ";
        string progress2 = "Unpacking file.. ";
        string progress3 = "Unpacking file...";

        while (handle != null && !handle.done)
        {
            statusLabel.text = progress1;
            yield return new WaitForSeconds(0.5f);
            if (handle == null || handle.done)
            {
                break;
            }
            statusLabel.text = progress2;
            yield return new WaitForSeconds(0.5f);
            if (handle == null || handle.done)
            {
                break;
            }
            statusLabel.text = progress3;
            yield return new WaitForSeconds(0.5f);
        }

        if (handle == null)
        {
            AddToDebugAndUiLog($"Unpacking the song package failed. Handle was null for {tarPath}.", true);
            statusLabel.text = "Failed. Handle was null";

        }
        else if (handle.done)
        {
            AddToDebugAndUiLog($"Finished unpacking the song package to {songsPath}");
            SetFinishedStatus();
            downloadPath.text = "";
            List<string> songDirs = settings.GameSettings.songDirs;
            if (!songDirs.Contains(songsPath))
            {
                songDirs.Add(songsPath);
                settingsManager.Save();
            }
            // Reload SongMetas if they had been loaded already.
            if (SongMetaManager.IsSongScanFinished)
            {
                Debug.Log("Rescan songs after successful download.");
                SongMetaManager.ResetSongMetas();
                songMetaManager.ScanFilesIfNotDoneYet();
            }
        }
        else
        {
            AddToDebugAndUiLog($"Unpacking the song package failed with an unknown error. Please check the log. File: {tarPath}", true);
            statusLabel.text = "Failed";
        }
        if (File.Exists(tarPath))
        {
            File.Delete(tarPath);
        }
    }