public void TransitionToPause()
    {
        Debug.Log("transition to pause");

        StartCoroutine(CrossFadeTo(_currentMusicAudio, pauseMusicSource, _fadeTime));
        _currentMusicAudio = pauseMusicSource;
    }
예제 #2
0
        /// <summary>
        /// Callback called when a face is detected or recognized
        /// </summary>
        /// <param name="faceRecEvent"></param>
        private void FaceRecCallback(IFaceRecognitionEvent faceRecEvent)
        {
            if (faceRecEvent.Label == "unknown person")
            {
                AudioDetails randomAudio = _audioList[_randomGenerator.Next(0, _audioList.Count - 1)];
                ImageDetails randomImage = _imageList[_randomGenerator.Next(0, _imageList.Count - 1)];
                _misty.DisplayImage(randomImage.Name, 1, null);
                _misty.PlayAudio(randomAudio.Name, 100, null);
            }
            else
            {
                _misty.DisplayImage("e_EcstacyStarryEyed.jpg", 1, null);
                _misty.PlayAudio("sEcstacy.wav", 100, null);
            }

            if (!_misty.Wait(5000))
            {
                return;
            }
            _misty.DisplayImage("e_ContentLeft.jpg", 1, null);
            if (!_misty.Wait(5000))
            {
                return;
            }
            _misty.RegisterFaceRecognitionEvent(FaceRecCallback, 0, false, null, null, null);
        }
 private void CrossFade(AudioDetails source, AudioDetails destination, float duration)
 {
     if (_fadeRoutine != null)
     {
         StopCoroutine(_fadeRoutine);
     }
     _fadeRoutine = StartCoroutine(CrossFadeTo(source, destination, duration));
 }
    /// <summary>
    /// Fades primary theme with secondary theme
    /// </summary>
    /// <param name="hash"></param>
    //public void PlaySecondaryMusic(string hash, bool loop = true, bool startsMuted = false, Vector3 position = default(Vector3))
    //{
    //    //if (activeSecondaryMusicAudioSource.Source == null)
    //    //    BuildSecondaryMusicSource();

    //    //if (activeSecondaryMusicAudioSource.clip == musicList[hash])
    //    //    return;

    //    //get music object, set the audio clip to it and save reference
    //    AudioSerial audioToPlay = musicList[hash];
    //    activeSecondaryMusicAudioSource.Source.Stop();
    //    activeSecondaryMusicAudioSource.Source.clip = audioToPlay.source;
    //    activeSecondaryMusicAudioSource.Source.priority = 0;
    //    activeSecondaryMusicAudioSource.Source.volume = startsMuted ? 0 : musicVolume * audioToPlay._relativeVolume;
    //    activeSecondaryMusicAudioSource.Source.loop = loop;
    //    activeSecondaryMusicAudioSource.Source.maxDistance = maxHearingDistance;
    //    activeSecondaryMusicAudioSource.Source.Play();
    //    //Debug.Log("Playing secondary");
    //    activeSecondaryMusicAudioHash = hash;

    //    activeSecondaryMusicAudioSource.Serial = audioToPlay;
    //    _currentMusicAudio = activeSecondaryMusicAudioSource;
    //    if (_isLoggingAudio)
    //    {
    //        if (OnLogAudio != null)
    //            OnLogAudio(hash, 2, loop, Time.time);
    //    }

    //    //_secondarySnap.TransitionTo(_toSecondaryTransitionTime);
    //}

    //public void TransitionToMainSnapshot()
    //{
    //    _mainSnap.TransitionTo(_toMainTransitionTime);
    //    //StopCoroutine("StopSecondaryMusicIn");
    //    //StartCoroutine("StopSecondaryMusicIn", _toMainTransitionTime);
    //}

    //public void TransitionToSlomoSnapshot()
    //{
    //    _slowMotionSnapShot.TransitionTo(_toSlomoTime);
    //}

    //IEnumerator StopSecondaryMusicIn(float time)
    //{
    //    yield return new WaitForSeconds(time);
    //    if (activeSecondaryMusicAudioSource.Source != null)
    //    {
    //        activeSecondaryMusicAudioSource.Source.Stop();
    //        Debug.Log("SEcondary music stopped");
    //    }

    //}

    public AudioSource PlaySFX(string hash, bool loop, Transform parent, bool singleInstance = false, float addedRandomPitch = 0, float addedPitch = 0)
    {
        if (hash == "")
        {
            return(null);
        }

        if (singleInstance)
        {
            StopSFX(hash, true);
        }

        if (!sfxList.ContainsKey(hash))
        {
            return(null);
        }

        AudioDetails audioDetail = new AudioDetails();

        //get new audiosource object, set the clip and properties and save reference
        AudioSerial audioToPlay = sfxList[hash];

        GameObject sfxObj = new GameObject(hash); //TODO: once a pool is made, get gameobject from pool instead of creating new

        sfxObj.transform.parent        = parent;
        sfxObj.transform.localPosition = Vector3.zero;
        AudioSource source = sfxObj.AddComponent <AudioSource>();

        source.GetComponent <AudioSource>().clip = audioToPlay.source;
        source.volume                = audioToPlay._relativeVolume * sfxVolume;
        source.loop                  = loop;
        source.minDistance           = maxHearingDistance;
        source.maxDistance           = maxHearingDistance;
        source.pitch                += (Random.value - 0.5f) * 2 * addedRandomPitch + addedPitch;
        source.dopplerLevel          = 0f; //sets doppler to 0 to cancel pitch distortions on movement
        source.outputAudioMixerGroup = _sfxMixerGroup;
        if (parent == null)
        {
            DontDestroyOnLoad(source.gameObject);
        }
        source.Play();

        if (_isLoggingAudio)
        {
            if (OnLogAudio != null)
            {
                OnLogAudio(hash, 1, loop, Time.time);
            }
        }

        audioDetail.Source = source;
        audioDetail.Serial = audioToPlay;
        activeSFXAudioSources.Add(audioDetail);
        return(source);
    }
    public void TransitionToLow()
    {
        Debug.Log("transition to low");

        if (_currentMusicAudio == activeMusicAudioSource)
        {
            return;
        }
        CrossFade(_currentMusicAudio, activeMusicAudioSource, _fadeTime);
        _currentMusicAudio = activeMusicAudioSource;
    }
 /// <summary>
 /// Audio file validation
 /// </summary>
 /// <param name="AudioFilename"></param>
 private bool AudioFileExist(string AudioFilename)
 {
     for (int i = 0; i < _audioList.Count; i++)
     {
         AudioDetails inspectingAudio = _audioList[i];
         if (AudioFilename.Equals(inspectingAudio.Name))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #7
0
        //Open the selected file with the corresponding program
        private void Row_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                FileDetails  fl = FileList.SelectedItem as FileDetails;
                ImageDetails Il = FileList.SelectedItem as ImageDetails;
                WordDetails  Wl = FileList.SelectedItem as WordDetails;
                PDFdetails   Pl = FileList.SelectedItem as PDFdetails;
                VideoDetails Vl = FileList.SelectedItem as VideoDetails;
                AudioDetails Al = FileList.SelectedItem as AudioDetails;
                OtherDetails Ol = FileList.SelectedItem as OtherDetails;
                try
                {
                    if (fl != null)
                    {
                        System.Diagnostics.Process.Start(fl.path.ToString());
                    }
                    if (Il != null)
                    {
                        System.Diagnostics.Process.Start(Il.Path.ToString());
                    }

                    if (Wl != null)
                    {
                        System.Diagnostics.Process.Start(Wl.path.ToString());
                    }

                    if (Pl != null)
                    {
                        System.Diagnostics.Process.Start(Wl.path.ToString());
                    }
                    if (Vl != null)
                    {
                        System.Diagnostics.Process.Start(Vl.path.ToString());
                    }
                    if (Al != null)
                    {
                        System.Diagnostics.Process.Start(Al.path.ToString());
                    }
                    if (Ol != null)
                    {
                        System.Diagnostics.Process.Start(Ol.path.ToString());
                    }
                }
                catch (Exception ex)
                {
                    System.Windows.MessageBox.Show("Imposible d'ouvir le fichier" + ex.Message);
                }
            }
        }
    private void BuildPauseMusicSource()
    {
        GameObject    source   = new GameObject("PauseMusicSource");                             //create new object
        AudioListener listener = GameObject.FindObjectOfType <AudioListener>() as AudioListener; //gets listener

        pauseMusicSource = new AudioDetails();
        //source.transform.parent = listener.gameObject.transform; //set the audiolistener object as parent
        source.transform.localPosition = Vector3.zero;                        //set position to middle of object
        pauseMusicSource.Source        = source.AddComponent <AudioSource>(); //adds an audiosource & saves reference
        //pauseMusicSource.Source.outputAudioMixerGroup = _pauseMixerGroup;
        pauseMusicSource.Source.outputAudioMixerGroup = _musicMixerGroup;
        DontDestroyOnLoad(source);
        //SetMusicVolume(musicVolume);
    }
    IEnumerator CrossFadeTo(AudioDetails source, AudioDetails destination, float duration)
    {
        //Debug.Log("fading to " + destination.Source.clip.name);
        var timer = Time.time + duration;

        while (Time.unscaledTime < timer)
        {
            var t = (timer - Time.unscaledTime) / duration;
            //Debug.Log(destination.Source + " " + destination.Serial);
            destination.Source.volume = Mathf.Sqrt(1 - t) * musicVolume * destination.Serial._relativeVolume;
            source.Source.volume     *= Mathf.Sqrt(t);
            yield return(null);
        }
        _currentMusicAudio        = destination;
        destination.Source.volume = musicVolume * destination.Serial._relativeVolume;
        source.Source.volume      = 0;
        _fadeRoutine = null;
    }
예제 #10
0
        //Open the directory of the selected file
        private void Row_RightClick(object sender, RoutedEventArgs e)
        {
            FileDetails  fl = FileList.SelectedItem as FileDetails;
            ImageDetails Il = FileList.SelectedItem as ImageDetails;
            WordDetails  Wl = FileList.SelectedItem as WordDetails;
            PDFdetails   Pl = FileList.SelectedItem as PDFdetails;
            VideoDetails Vl = FileList.SelectedItem as VideoDetails;
            AudioDetails Al = FileList.SelectedItem as AudioDetails;
            OtherDetails Ol = FileList.SelectedItem as OtherDetails;


            if (fl != null)
            {
                var test = fl.folderPath;
                Process.Start("explorer.exe", fl.folderPath.ToString());
            }
            if (Il != null)
            {
                Process.Start("explorer.exe", Il.folderPath.ToString());
            }

            if (Wl != null)
            {
                Process.Start("explorer.exe", Wl.folderPath.ToString());
            }

            if (Pl != null)
            {
                Process.Start("explorer.exe", Pl.folderPath.ToString());
            }
            if (Vl != null)
            {
                Process.Start("explorer.exe", Vl.folderPath.ToString());
            }
            if (Al != null)
            {
                Process.Start("explorer.exe", Al.folderPath.ToString());
            }
            if (Ol != null)
            {
                Process.Start("explorer.exe", Ol.folderPath.ToString());
            }
        }
예제 #11
0
        /// <summary>
        /// Get the audio details.
        /// </summary>
        /// <param name="section">The config section group and section name.</param>
        /// <returns>The audio details.</returns>
        public AudioDetails GetAudio(string section = "NequeoMediaGroup/MediaSection")
        {
            AudioDetails audioDetails = new AudioDetails();

            try
            {
                // Refreshes the named section so the next time that it is retrieved it will be re-read from disk.
                System.Configuration.ConfigurationManager.RefreshSection(section);

                // Create a new default host type
                // an load the values from the configuration
                // file into the default host type.
                MediaSection mediaSection =
                    (MediaSection)System.Configuration.ConfigurationManager.GetSection(section);

                // Make sure the section is defined.
                if (mediaSection == null)
                {
                    throw new Exception("Configuration section has not been defined.");
                }

                // Get the audio element.
                AudioElement audioElement = mediaSection.AudioSection;
                if (audioElement == null)
                {
                    throw new Exception("Configuration element Audio has not been defined.");
                }

                // Assign the audio.
                audioDetails.Channels     = audioElement.Channels;
                audioDetails.SampleSize   = audioElement.SampleSize;
                audioDetails.SamplingRate = audioElement.SamplingRate;
                audioDetails.UseDefault   = audioElement.UseDefault;
            }
            catch (Exception)
            {
                throw;
            }

            // Return the details.
            return(audioDetails);
        }
예제 #12
0
		/// <summary>
		/// Callback called when a face is detected or recognized
		/// </summary>
		/// <param name="faceRecEvent"></param>
		private void FaceRecCallback(IFaceRecognitionEvent faceRecEvent)
		{
			if (faceRecEvent.Label == "unknown person")
			{
				AudioDetails randomAudio = _audioList[_randomGenerator.Next(0, _audioList.Count - 1)];
				ImageDetails randomImage = _imageList[_randomGenerator.Next(0, _imageList.Count - 1)];
				_misty.DisplayImage(randomImage.Name, 1, null);
				_misty.PlayAudio(randomAudio.Name, 100, null);
			}
			else
			{
				if (faceRecEvent.Label == "Adrian")
				{
					_misty.DisplayImage("e_EcstacyStarryEyed.jpg", 1, null);
					//_misty.PlayAudio("s_Ecstacy.wav", 100, null);
					_misty.Speak("You are awesome Adrian!", true, "1", null);
				}
				else
				{
					if (faceRecEvent.Label == "Sharina")
					{
						_misty.DisplayImage("e_Love.jpg", 1, null);
						//_misty.PlayAudio("s_Love.wav", 100, null);
						_misty.Speak("I love you Sharina", true, "1", null);
					}
					else
					{
						_misty.DisplayImage("e_Confused.jpg", 1, null);
						_misty.PlayAudio("s_Confused.wav", 100, null);
						_misty.Speak("Who are you?", true, "1", null);
					}
				}
			}
			
			if(!_misty.Wait(5000)) { return; }
			_misty.DisplayImage("e_ContentLeft.jpg", 1, null);
			if (!_misty.Wait(5000)) { return; }
			_misty.RegisterFaceRecognitionEvent(FaceRecCallback, 0, false, null, null, null);
		}
예제 #13
0
        //Creates the datalist model
        public void makeList()
        {
            listFile = RetrieveList.myList.ToList();

            if (RetrieveList.RadiobuttonKeep.Contains("Word"))
            {
                if (RetrieveList.mywordList != null)
                {
                    RetrieveList.mywordList.Clear();
                }
                wordFile.Clear();
                foreach (var list in listFile)
                {
                    if (list.filename.ToString().ToLower().Contains(".doc"))
                    {
                        WordDetails id = new WordDetails()
                        {
                            content    = GetWord(list.path.ToString()),
                            name       = list.filename,
                            path       = list.path,
                            folderPath = list.folderPath
                        };
                        wordFile.Add(id);
                    }
                }
                IEnumerable <WordDetails> sansDoublonWord = wordFile.Distinct();
                int num = wordFile.Count();
                CountElement(num);
                RetrieveList.mywordList = wordFile.ToObservableCollection();
            }

            if (RetrieveList.RadiobuttonKeep.Contains("PDF"))
            {
                if (RetrieveList.mypdfList != null)
                {
                    RetrieveList.mypdfList.Clear();
                }
                PDFFile.Clear();
                foreach (var list in listFile)
                {
                    if (list.filename.ToString().ToLower().Contains(".pdf"))
                    {
                        PDFdetails id = new PDFdetails()
                        {
                            content    = GetPDF(list.path.ToString()),
                            name       = list.filename,
                            path       = list.path,
                            folderPath = list.folderPath
                        };

                        PDFFile.Add(id);
                    }
                }
                IEnumerable <PDFdetails> sansDoublonPDF = PDFFile.Distinct();
                int num = sansDoublonPDF.Count();
                CountElement(num);
                RetrieveList.mypdfList = PDFFile.ToObservableCollection();
            }

            if (RetrieveList.RadiobuttonKeep.Contains("Images"))
            {
                if (RetrieveList.myimageList != null)
                {
                    RetrieveList.myimageList.Clear();
                }
                imageFile.Clear();
                foreach (var list in listFile)
                {
                    if (Extentions_Image.Any(list.filename.ToLower().Contains))
                    {
                        ImageDetails id = new ImageDetails()
                        {
                            FileName   = list.filename,
                            Path       = list.path,
                            folderPath = list.folderPath
                        };

                        imageFile.Add(id);
                    }
                }
                IEnumerable <ImageDetails> sansDoublonImage = imageFile.Distinct();
                int num = sansDoublonImage.Count();
                CountElement(num);
                RetrieveList.myimageList = imageFile.ToObservableCollection();
            }

            if (RetrieveList.RadiobuttonKeep.Contains("Audio"))
            {
                if (RetrieveList.myaudioList != null)
                {
                    RetrieveList.myaudioList.Clear();
                }

                audioFile.Clear();
                foreach (var list in listFile)
                {
                    if (Extentions_Audio.Any(list.filename.ToLower().Contains))
                    {
                        AudioDetails id = new AudioDetails()
                        {
                            FileName   = list.filename,
                            path       = list.path,
                            folderPath = list.folderPath
                        };

                        audioFile.Add(id);
                    }
                }
                IEnumerable <AudioDetails> sansDoublonAudio = audioFile.Distinct();
                int num = sansDoublonAudio.Count();
                CountElement(num);
                RetrieveList.myaudioList = audioFile.ToObservableCollection();
            }

            if (RetrieveList.RadiobuttonKeep.Contains("Vidéos"))
            {
                if (RetrieveList.myvideoList != null)
                {
                    RetrieveList.myvideoList.Clear();
                }
                videoFile.Clear();
                foreach (var list in listFile)
                {
                    if (Extentions_Video.Any(list.filename.ToString().ToLower().Contains))
                    {
                        VideoDetails id = new VideoDetails
                        {
                            FileName   = list.filename,
                            path       = list.path,
                            folderPath = list.folderPath
                        };

                        videoFile.Add(id);
                    }
                }
                IEnumerable <VideoDetails> sansDoublonVideo = videoFile.Distinct();
                int num = sansDoublonVideo.Count();
                CountElement(num);
                RetrieveList.myvideoList = videoFile.ToObservableCollection();
            }

            if (RetrieveList.RadiobuttonKeep.Contains("Autres"))
            {
                if (RetrieveList.myotherList != null)
                {
                    RetrieveList.myotherList.Clear();
                }
                otherFile.Clear();

                foreach (var list in listFile)
                {
                    if (!Extentions_All.Any(list.filename.ToString().ToLower().Contains))
                    {
                        OtherDetails id = new OtherDetails
                        {
                            FileName   = list.filename,
                            path       = list.path,
                            folderPath = list.folderPath
                        };

                        otherFile.Add(id);
                    }
                }
                IEnumerable <OtherDetails> sansDoublonOther = otherFile.Distinct();
                int num = sansDoublonOther.Count();
                CountElement(num);
                RetrieveList.myotherList = otherFile.ToObservableCollection();
            }
        }
예제 #14
0
        /// <summary>
        /// Get the assets and startup some timers to do random movements and other things...
        /// </summary>
        /// <param name="parameters"></param>
        public async void OnStart(object sender, IDictionary <string, object> parameters)
        {
            try
            {
                var deviceInfo = await _misty.GetDeviceInformationAsync();

                if (!_misty.Wait(0))
                {
                    return;
                }

                //Get the audio and image lists for use in the skill
                _audioList = (await _misty.GetAudioListAsync())?.Data;

                if (!_misty.Wait(0))
                {
                    return;
                }
                _imageList = (await _misty.GetImageListAsync())?.Data;


                if (!_misty.Wait(0))
                {
                    return;
                }

                if (_audioList != null && _audioList.Count > 0)
                {
                    AudioDetails randomAudio = _audioList[_randomGenerator.Next(0, _audioList.Count - 1)];
                    _misty.PlayAudio(randomAudio.Name, 100, null);
                }

                if (_imageList != null && _imageList.Count > 0)
                {
                    ImageDetails randomImage = _imageList[_randomGenerator.Next(0, _imageList.Count - 1)];
                    _misty.DisplayImage(randomImage.Name, 1, null);
                }


                if (!_misty.Wait(2000))
                {
                    return;
                }

                _misty.ChangeLED(255, 255, 255, null);

                //Register a number of events
                _misty.RegisterAudioPlayCompleteEvent(AudioPlayCallback, 0, true, null, null);
                _misty.RegisterCapTouchEvent(CapTouchCallback, 0, true, null, null, null);
                _misty.RegisterKeyPhraseRecognizedEvent(KeyPhraseRecognizedCallback, 250, true, null, null);
                _misty.StartKeyPhraseRecognition(null);
                _misty.StartFaceRecognition(null);

                //Create an event with a specific name so we can unregister it when needed using that name
                _misty.RegisterBumpSensorEvent(BumpCallback, 0, true, null, "MyBumpSensorName", null);

                //Register face rec with keepAlive = false, it will need to be reregistered after triggering if the user wants it to run again
                _misty.RegisterFaceRecognitionEvent(FaceRecCallback, 0, false, null, null, null);

                //Play audio indicator that the event registration state has changed
                if (_audioList != null && _audioList.Count > 0)
                {
                    AudioDetails randomAudio = _audioList[_randomGenerator.Next(0, _audioList.Count - 1)];
                    _misty.PlayAudio(randomAudio.Name, 100, null);
                    await Task.Delay(1000);

                    _misty.PlayAudio(randomAudio.Name, 100, null);
                }

                if (!_misty.Wait(30000))
                {
                    return;
                }


                //Unregister the bump sensor
                _misty.UnregisterEvent("MyBumpSensorName", UnregisterCallback);

                //Play audio indicator that the event registration state has changed
                if (_audioList != null && _audioList.Count > 0)
                {
                    AudioDetails randomAudio = _audioList[_randomGenerator.Next(0, _audioList.Count - 1)];
                    _misty.PlayAudio(randomAudio.Name, 100, null);
                    await Task.Delay(1000);

                    _misty.PlayAudio(randomAudio.Name, 100, null);
                }

                if (!_misty.Wait(20000))
                {
                    return;
                }

                //Unregister ALL events
                _misty.UnregisterAllEvents(UnregisterCallback);

                //Play audio indicator that the event registration state has changed
                if (_audioList != null && _audioList.Count > 0)
                {
                    AudioDetails randomAudio = _audioList[_randomGenerator.Next(0, _audioList.Count - 1)];
                    _misty.PlayAudio(randomAudio.Name, 100, null);
                    await Task.Delay(1000);

                    _misty.PlayAudio(randomAudio.Name, 100, null);
                }


                if (!_misty.Wait(20000))
                {
                    return;
                }

                //Play audio indicator that the event registration state has changed
                if (_audioList != null && _audioList.Count > 0)
                {
                    AudioDetails randomAudio = _audioList[_randomGenerator.Next(0, _audioList.Count - 1)];
                    _misty.PlayAudio(randomAudio.Name, 100, null);
                    await Task.Delay(1000);

                    _misty.PlayAudio(randomAudio.Name, 100, null);
                }

                //Re-register events
                _misty.RegisterAudioPlayCompleteEvent(AudioPlayCallback, 0, true, null, null);
                _misty.RegisterFaceRecognitionEvent(FaceRecCallback, 0, false, null, null, null);
                _misty.RegisterCapTouchEvent(CapTouchCallback, 0, true, null, null, null);
                _misty.RegisterKeyPhraseRecognizedEvent(KeyPhraseRecognizedCallback, 0, true, null, null);

                //You can also register events without callbacks, it requires a user to subscribe to that event as follows...
                //Note that this re-registers bump events to play a sound on release, not contact as they were previously handled
                _misty.RegisterBumpSensorEvent(0, true, null, null, null);
                _misty.BumpSensorEventReceived += ProcessBumpEvent;

                //Will continue to process events until timeout of cancel
            }
            catch (Exception ex)
            {
                _misty.SkillLogger.Log($"InteractiveMistySkill : OnStart: => Exception", ex);
            }
        }
    public void PlayMusic(string hash, bool loop = true, MusicMixerGroup group = MusicMixerGroup.DEFAULT_LOW, bool fadeToSnapshot = false, Vector3 position = default(Vector3))
    {
        Debug.Log("Playing song " + hash);
        if (hash == null || !musicList.ContainsKey(hash))
        {
            return;
        }

        AudioDetails musicDetail = activeMusicAudioSource;

        switch (group)
        {
        case MusicMixerGroup.DEFAULT_LOW:
            Debug.Log("set as low");
            musicDetail = activeMusicAudioSource;
            break;

        case MusicMixerGroup.DEFAULT_HIGH:
            Debug.Log("set as high");
            musicDetail = activeSecondaryMusicAudioSource;
            break;

        case MusicMixerGroup.PAUSE:
            Debug.Log("set as pause");
            musicDetail = pauseMusicSource;
            break;
        }

        if (musicDetail.Source.clip == null || musicDetail.Source.clip != musicList[hash].source)
        {
            Debug.Log("music source set to " + musicDetail.Source.name);
            //get music object, set the audio clip to it and save reference
            AudioSerial audioToPlay = musicList[hash];
            musicDetail.Source.Stop();
            musicDetail.Source.clip        = audioToPlay.source;
            musicDetail.Source.priority    = 0;
            musicDetail.Source.volume      = musicVolume * audioToPlay._relativeVolume;
            musicDetail.Source.loop        = loop;
            musicDetail.Source.maxDistance = maxHearingDistance;
            musicDetail.Source.Play();
            musicDetail.Serial   = musicList[hash];
            activeMusicAudioHash = hash;
        }


        if (_currentMusicAudio != null && fadeToSnapshot && _currentMusicAudio.Source.clip != musicDetail.Source.clip)
        {
            CrossFade(_currentMusicAudio, musicDetail, _fadeTime);
        }

        _currentMusicAudio = musicDetail;


        //_currentMusicSourceVolume = musicVolume * audioToPlay._relativeVolume;
        if (_isLoggingAudio)
        {
            if (OnLogAudio != null)
            {
                OnLogAudio(hash, 0, loop, Time.time);
            }
        }
    }
 public void TransitionToHigh()
 {
     Debug.Log("transition to high");
     CrossFade(_currentMusicAudio, activeSecondaryMusicAudioSource, _fadeTime);
     _currentMusicAudio = activeSecondaryMusicAudioSource;
 }