Пример #1
0
 void Play()
 {
     StopStream();
     if (!isCDplaying)
     {
         if (audioFiles.Length > 0)
         {
             CDempty     = false;
             isCDplaying = true;
             if (GameObject.Find("SATSUMA(557kg, 248)/Electricity/SpeakerDash/CDPlayer") != null)
             {
                 audioPlayer.audioSource = GameObject.Find("SATSUMA(557kg, 248)/Electricity/SpeakerDash/CDPlayer").GetComponent <AudioSource>();
             }
             else
             {
                 CDPlayer.FilterChange();
                 audioPlayer.audioSource = GameObject.Find("SATSUMA(557kg, 248)/Electricity/SpeakerBass/CDPlayer").GetComponent <AudioSource>();
             }
             audioPlayer.LoadAudioFromFile(Path.GetFullPath(audioFiles[currentSong]), true, true);
             audioPlayer.Play();
         }
         else
         {
             CDempty = true;
         }
     }
 }
Пример #2
0
        void PlayStream(int channel)
        {
            string url = null;

            switch (channel)
            {
            case 1:
                url = (string)cdplayer.channel3url.GetValue();
                break;

            case 2:
                url = (string)cdplayer.channel4url.GetValue();
                break;
            }
            PlayMakerFSM radioCh;

            if (GameObject.Find("SATSUMA(557kg, 248)/Electricity/SpeakerDash/CDPlayer") != null)
            {
                audioStreamPlayer.audioSource = GameObject.Find("SATSUMA(557kg, 248)/Electricity/SpeakerDash/CDPlayer").GetComponent <AudioSource>();
                radioCh = GameObject.Find("SATSUMA(557kg, 248)/Electricity/SpeakerDash/RadioChannels").GetComponent <PlayMakerFSM>();
            }
            else
            {
                CDPlayer.FilterChange();
                audioStreamPlayer.audioSource = GameObject.Find("SATSUMA(557kg, 248)/Electricity/SpeakerBass/CDPlayer").GetComponent <AudioSource>();
                radioCh = GameObject.Find("SATSUMA(557kg, 248)/Electricity/SpeakerBass/RadioChannels").GetComponent <PlayMakerFSM>();
            }
            radioCh.FsmVariables.FindFsmBool("OnMuteChannel1").Value = true;
            radioCh.FsmVariables.FindFsmBool("OnMuteFolk").Value     = true;
            radioCh.FsmVariables.FindFsmBool("OnStatic").Value       = true;
            noAntenna = radioCh.FsmVariables.FindFsmBool("OnStaticAntenna1").Value;

            if (url != null && url != string.Empty)
            {
                //transform.FindChild("ButtonsCD/RadioVolume").GetComponent<PlayMakerFSM>().FsmVariables.FindFsmString("Channel").Value = string.Format("Channel ", streamingChannel + 2);
                if ((bool)cdplayer.debugInfo.GetValue())
                {
                    audioStreamPlayer.showDebug = true;
                }
                audioStreamPlayer.PlayStream(url);
                radioCh.GetComponent <PlayMakerFSM>().FsmVariables.FindFsmBool("OnStatic").Value = false;

                isStreamPlaying         = true;
                isEmptyStreamingChannel = false;
                scrollDone = true;
            }
            else
            {
                isEmptyStreamingChannel = true;
                radioCh.GetComponent <PlayMakerFSM>().FsmVariables.FindFsmBool("OnStatic").Value = true;
            }
        }