Example #1
0
 private void SendAudioAnaylisToParticleVisualizer(AudioAnalysisCustom audioAnalysisCustom)
 {
     if (audioAnalysisCustom != null)
     {
         particleVisualizer.SendAnalysis(audioAnalysisCustom);
     }
 }
    public void SendAnalysis(AudioAnalysisCustom audioAnalysisCustom)
    {
        if (audioAnalysisCustom != null)
        {
            Debug.Log("Analysing Custom Track");
            this.audioAnalysisCustom = audioAnalysisCustom;
            AnalyzeTrack(audioAnalysisCustom);
            //  if (!isVisualizing)
            //   {

            StartCoroutine(VisualizePitchCustom());
            //   StartCoroutine(VisualizeBPS());
            //    StartCoroutine(VisualizeColour());
            //    }
            //    else
            //    {
            //        Debug.LogError("isVisualizing is true");
            //    StopCoroutine(VisualizePitch());
            //     StartCoroutine(VisualizePitch());
            //     }
        }
        else
        {
            Debug.LogError("AudioAnalysisCustom null");
        }
    }
 public PlaylistScript(PlaylistScriptData playlistScriptData)
 {
     playlistName        = playlistScriptData.playlistName;
     playlistURI         = playlistScriptData.playlistURI;
     artistName          = playlistScriptData.artistName;
     popularity          = playlistScriptData.popularity;
     artistId            = playlistScriptData.artistId;
     playlistId          = playlistScriptData.playlistId;
     ownerId             = playlistScriptData.ownerId;
     trackId             = playlistScriptData.trackId;
     albumId             = playlistScriptData.albumId;
     audioAnalysisCustom = playlistScriptData.audioAnalysisCustom;
 }
 public PlaylistScriptData(PlaylistScript playlistScript)
 {
     playlistName        = playlistScript.playlistName;
     playlistURI         = playlistScript.playlistURI;
     artistName          = playlistScript.artistName;
     popularity          = playlistScript.popularity;
     ownerId             = playlistScript.ownerId;
     playlistId          = playlistScript.playlistId;
     albumId             = playlistScript.albumId;
     trackId             = playlistScript.trackId;
     artistId            = playlistScript.artistId;
     audioAnalysisCustom = playlistScript.audioAnalysisCustom;
     streams             = playlistScript.streams;
 }
Example #5
0
    public void PlaySongUri(string songURI, AudioAnalysisCustom audioAnalysisCustom)
    {
        ThreadStart starter = new ThreadStart(() => PlaySongURIThread(songURI));

        Thread myThread = new Thread(starter);

        myThread.Start();
        threadRunning = true;

        while (threadRunning)
        {
        }

        SendAudioAnaylisToParticleVisualizer(audioAnalysisCustom);
    }
    private void AnalyzeTrack(AudioAnalysisCustom audioAnalysisCustom)
    {
        trackLength    = audioAnalysisCustom.trackLength;
        tempo          = audioAnalysisCustom.tempo;
        beatsPerSecond = audioAnalysisCustom.beatsPerSecond;
        key            = audioAnalysisCustom.key;
        Debug.Log("key " + key);
        keyString = keys[key];
        color     = colors[key];
        var colorOverLifetime = particleSystem.colorOverLifetime;

        Debug.Log("Setting particle color to " + color.ToString());
        colorOverLifetime.color = color;
        GetComponent <ParticleSystemRenderer>().material.color = color;
        GetComponent <ParticleSystemRenderer>().trailMaterial.SetColor("_TintColor", color);
    }
Example #7
0
 public void SendAnalysis(AudioAnalysisCustom audioAnalysisCustom)
 {
     if (audioAnalysis != null)
     {
         Debug.Log("Analysing Track");
         this.audioAnalysisCustom = audioAnalysisCustom;
         AnalyzeTrack();
         if (!isVisualizing)
         {
             StartCoroutine(VisualizePitch());
             StartCoroutine(VisualizeBPS());
             StartCoroutine(VisualizeColour());
         }
         else
         {
             //    StopCoroutine(VisualizePitch());
             //     StartCoroutine(VisualizePitch());
         }
     }
     else
     {
         Debug.LogError("AudioAnalysis null");
     }
 }