Exemple #1
0
        private void OnFileSelected(string path)
        {
            //Hide the browser.
            browser.gameObject.SetActive(false);

            //Start importing the selected song.
            importer.Import(path);
        }
 public void LoadSong(string path)
 {
     if (importer.audioClip != null)
     {
         importer.ClearClip();
     }
     importer.Import(path);
 }
Exemple #3
0
    IEnumerator Import(string path)
    {
        importer.Import(path);

        while (!importer.isDone)
        {
            yield return(null);
        }

        audioSource.clip = importer.audioClip;
        audioSource.Play();
    }
Exemple #4
0
 IEnumerator Import(string path)
 {
     importer.Import(path);
     while (!importer.isDone)
     {
         yield return(null);
     }
     Debug.Log("Successfully playing MP3 from path: " + path);
     audioSource.clip = importer.audioClip;
     audioSource.Play();
     singleNotes.Play();
     doubleNotes.Play();
 }
Exemple #5
0
    private void loadCustom(SongData songData, SongReady songReady, int lanes, SongData.PatternType patternType, Settings.PlayMode playMode)// = Settings.PlayMode.PLAY)
    {
        Debug.Log("************* SONGLOADER.loadSong, path " + songData + ", " + patternType + " " + playMode);
        state             = State.PREPARING;
        this.songReady    = songReady;
        this.patternLanes = lanes;
        this.patternType  = patternType;
        this.playMode     = playMode;
        //this.recordingMode = playMode == Settings.PlayMode.RECORD_PATTERN;

        songFromFile = true;
        isLoading    = true;
        importer.Import(songData.path);
    }
Exemple #6
0
    IEnumerator Import(string path)
    {
        importer.Import(path);

        while (!importer.isInitialized && !importer.isError)
        {
            yield return(null);
        }

        if (importer.isError)
        {
            Debug.LogError(importer.error);
        }

        audioSource.clip = importer.audioClip;
        audioSource.Play();
    }
    private IEnumerator Import(string path)
    {
        m_isImporting = true;

        while (m_uiSound.isPlaying)
        {
            yield return(null);
        }

        TagLib.File tagFile = TagLib.File.Create(path);

        m_currentArtist = tagFile.Tag.JoinedPerformers;
        m_currentTitle  = tagFile.Tag.Title;

        int foundFirstImageIndex = -1;

        for (int i = 0; i < tagFile.Tag.Pictures.Length; i++)
        {
            if (tagFile.Tag.Pictures[i].MimeType == "image/png" || tagFile.Tag.Pictures[i].MimeType == "image/jpeg")
            {
                foundFirstImageIndex = i;
                break;
            }
        }

        if (foundFirstImageIndex != -1)
        {
            var       bin = (byte[])(tagFile.Tag.Pictures[foundFirstImageIndex].Data.Data);
            Texture2D tex = new Texture2D(2, 2);
            tex.LoadImage(bin);
            tex.Apply();

            m_albumArtDisplay.texture = tex;
        }
        else
        {
            m_albumArtDisplay.texture = m_defaultImage;
        }

        if (m_currentTitle != null && m_currentArtist != null)
        {
            m_nowPlayingText.text = $"{m_currentArtist} - {m_currentTitle}";
        }
        else if (m_currentTitle != null && m_currentArtist == null)
        {
            m_nowPlayingText.text = $"{m_currentTitle}";
        }
        else
        {
            m_nowPlayingText.text = $"{Path.GetFileName(m_currentFilePath)}";
        }

        m_importer.Import(path);

        while (!m_importer.isDone)
        {
            yield return(null);
        }

        m_isImporting = false;
        m_songPlayer.PlaySong(m_importer.audioClip);
    }