Exemplo n.º 1
0
    public void StartAudio(OIMSPhrase whichPhrase = default(OIMSPhrase), float whenToPlay = 0.0f, float currrentVolume = 1.0f)
    {
        //Debug.Log("StartAudioLayer - whenToPlay: " + whenToPlay);
        alternateSource = false;
        parentPhrase    = whichPhrase;
        fadingIn        = false;
        if (currrentVolume == 1.0f)
        {
            fadingOut = false;
        }


        //if there already is a game object, then destroy it
        // if(theGameObject != null){
        //  Object.DestroyImmediate(theGameObject);

        //  //Destroy(theGameObject);
        //  //theGameObject.Destroy();
        // }

        CreateLayer(whenToPlay, currrentVolume);

        // if(alternateSource){
        //  theAudioSourceMonitor.StartAudio(whenToPlay);
        // } else {
        //  altAudioSourceMonitor.StartAudio(whenToPlay);
        // }
        //myAudioSourceMonitor.StartAudio(numberOfLoops, 2.0f);

        return;
    }
Exemplo n.º 2
0
    private void ExamineLayers(OIMSPhrase musicPhrase)
    {
        //first get the longest pickup time
        float longestPickupTime = 0.0f;

        foreach (OIMSLayer musicLayer in musicPhrase.musicLayers)
        {
            if (musicLayer.pickUpTime > longestPickupTime)
            {
                longestPickupTime = musicLayer.pickUpTime;
            }
        }


        //if the layers are synchronized
        if (musicPhrase.synchronizedLayerLoops)
        {
            float longestLoopDuration = 0.0f;
            foreach (OIMSLayer musicLayer in musicPhrase.musicLayers)
            {
                if ((musicLayer.theAudioClip.length - musicLayer.pickUpTime - musicLayer.tailTime) > longestLoopDuration)
                {
                    longestLoopDuration = musicLayer.theAudioClip.length - musicLayer.pickUpTime - musicLayer.tailTime;
                }
            }
        }
        else
        {
            foreach (OIMSLayer musicLayer in musicPhrase.musicLayers)
            {
                OIMSEvent tempEvent = new OIMSEvent();
                //tempEvent.startTime = generatePlaylistCurrentTime +
            }
        }
    }