getPlaybackState() public method

public getPlaybackState ( PLAYBACK_STATE &state ) : RESULT
state PLAYBACK_STATE
return RESULT
    // Update is called once per frame
    void Update()
    {
        var feet3DPosition = FMODUnity.RuntimeUtils.To3DAttributes(gameObject.transform.position);

        Footsteps.set3DAttributes(feet3DPosition);
        if (Input.GetKeyDown("w") || Input.GetKeyDown("a") || Input.GetKeyDown("s") || Input.GetKeyDown("d"))
        {
            PlayerIsWalking = true;
        }
        if (Input.GetKeyUp("w") || Input.GetKeyUp("a") || Input.GetKeyUp("s") || Input.GetKeyUp("d"))
        {
            PlayerIsWalking = false;
        }

        Footsteps.getPlaybackState(out FootstepsPlaybackState);

        if (PlayerIsWalking && FootstepsPlaybackState != FMOD.Studio.PLAYBACK_STATE.PLAYING && FootstepsPlaybackState != FMOD.Studio.PLAYBACK_STATE.STARTING)
        {
            Footsteps.start();
        }
        else if (!PlayerIsWalking)
        {
            Footsteps.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
        }
    }
    //Turns music on and off
    public void ToggleMusic(bool setMusic)
    {
        musicActive = setMusic;

        if (musicActive)
        {
            FMOD.Studio.PLAYBACK_STATE play_state;
            musicEvent.getPlaybackState(out play_state);
            if (play_state != FMOD.Studio.PLAYBACK_STATE.PLAYING)
            {
                musicEvent.start();
                ConfigureAudio();
                musicEvent.setTimelinePosition(timelinePosition);
            }
        }
        else
        {
            FMOD.Studio.PLAYBACK_STATE play_state;
            musicEvent.getPlaybackState(out play_state);
            if (play_state == FMOD.Studio.PLAYBACK_STATE.PLAYING)
            {
                musicEvent.getTimelinePosition(out timelinePosition);
                musicEvent.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
            }
        }
    }
Beispiel #3
0
 public void PlayGameMusic()
 {
     gameMusic.getPlaybackState(out gameMusicPlaybackState);
     if (gameMusicPlaybackState != FMOD.Studio.PLAYBACK_STATE.PLAYING)
     {
         gameMusic.start();
     }
 }
Beispiel #4
0
 public void PlaygameMusic3()
 {
     gameMusic3.getPlaybackState(out gameMusic3PlaybackState);
     if (gameMusic3PlaybackState != FMOD.Studio.PLAYBACK_STATE.PLAYING)
     {
         Debug.Log("Play game music 3");
         gameMusic3.start();
     }
 }
Beispiel #5
0
 public void PlayJoejoeMusic()
 {
     //Debug.Log ("Play game music");
     joejoeMusic.getPlaybackState(out joejoeMusicPlaybackState);
     if (joejoeMusicPlaybackState != FMOD.Studio.PLAYBACK_STATE.PLAYING)
     {
         joejoeMusic.start();
     }
 }
Beispiel #6
0
 public void PlayFleakMusic()
 {
     //Debug.Log ("Play game music");
     fleakMusic.getPlaybackState(out fleakMusicPlaybackState);
     if (fleakMusicPlaybackState != FMOD.Studio.PLAYBACK_STATE.PLAYING)
     {
         fleakMusic.start();
     }
 }
Beispiel #7
0
 public void PlayMorphyMusic()
 {
     //Debug.Log ("Play game music");
     morphyMusic.getPlaybackState(out morphyMusicPlaybackState);
     if (morphyMusicPlaybackState != FMOD.Studio.PLAYBACK_STATE.PLAYING)
     {
         morphyMusic.start();
     }
 }
Beispiel #8
0
 public void PlayMenuMusic()
 {
     //Debug.Log ("Play menu music");
     menuMusic.getPlaybackState(out menuMusicPlaybackState);
     if (menuMusicPlaybackState != FMOD.Studio.PLAYBACK_STATE.PLAYING)
     {
         menuMusic.start();
     }
 }
Beispiel #9
0
 public void StopMusic()
 {
     if (currentMusic.isValid())
     {
         FMOD.Studio.PLAYBACK_STATE state;
         FMOD.RESULT res = currentMusic.getPlaybackState(out state);
         if (res == FMOD.RESULT.OK && state == FMOD.Studio.PLAYBACK_STATE.PLAYING)
         {
             currentMusic.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
         }
     }
 }
Beispiel #10
0
 void Update()
 {
     if (musicEvent.isValid())
     {
         musicEvent.getPlaybackState(out play_state);
     }
 }
Beispiel #11
0
    void Update()
    {
        if (shake != null)
        {
            if (!shake.IsPlaying())
            {
                if (mainCam.transform.localPosition != camPos)
                {
                    mainCam.transform.localPosition = camPos;
                }
            }
        }

        // Checks playing track to see if it is finished playing
        if (playingTrack.isValid())
        {
            FMOD.Studio.PLAYBACK_STATE playbackState;
            playingTrack.getPlaybackState(out playbackState);
            if (playbackState == FMOD.Studio.PLAYBACK_STATE.STOPPED)
            {
                //Debug.Log("DEBUG: Releasing stopped track.");
                playingTrack.release();



                playing = null;
                notifier.Stop();
            }
        }
        else
        {
            IsStopping = false;
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (!GameManager.Instance.gameHasEnded())
        {
            FMOD.Studio.PLAYBACK_STATE playbackState;
            soloEventInstance.getPlaybackState(out playbackState);


            // if (playbackState == FMOD.Studio.PLAYBACK_STATE.STOPPED && !GameManager.Instance.gameHasEnded())
            // {
            //     GameManager.Instance.endGame();
            // }
            // if (Input.GetMouseButtonDown(0))
            // {
            //     playGuitar();
            //     time = 0;
            // }


            time += Time.deltaTime;
            if (time > fadeTime)
            {
                shouldPlay.setValue(0);
                time = 0;
            }
        }
    }
Beispiel #13
0
    private void ClearFinishedSongs()
    {
        if (activeSongs.Count > 0)
        {
            ListPool <string, MusicManager> .PooledList pooledList = ListPool <string, MusicManager> .Allocate();

            foreach (KeyValuePair <string, SongInfo> activeSong in activeSongs)
            {
                SongInfo value = activeSong.Value;
                FMOD.Studio.EventInstance ev = value.ev;
                ev.getPlaybackState(out value.musicPlaybackState);
                if (value.musicPlaybackState == PLAYBACK_STATE.STOPPED || value.musicPlaybackState == PLAYBACK_STATE.STOPPING)
                {
                    pooledList.Add(activeSong.Key);
                    foreach (string item in value.songsOnHold)
                    {
                        SetSongParameter(item, "interrupted_dimmed", 0f, true);
                    }
                    value.songsOnHold.Clear();
                }
            }
            foreach (string item2 in pooledList)
            {
                activeSongs.Remove(item2);
            }
            pooledList.Recycle();
        }
    }
Beispiel #14
0
    public void releaseAllReverb()
    {
        FMOD.Studio.PLAYBACK_STATE state;

        lr.getPlaybackState(out state);

        if (state == FMOD.Studio.PLAYBACK_STATE.PLAYING)
        {
            lr.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
        }

        mr.getPlaybackState(out state);

        if (state == FMOD.Studio.PLAYBACK_STATE.PLAYING)
        {
            mr.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
        }

        hr.getPlaybackState(out state);

        if (state == FMOD.Studio.PLAYBACK_STATE.PLAYING)
        {
            hr.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
        }
    }
        public bool IsPlaying()
        {
            PLAYBACK_STATE state;

            _audio.getPlaybackState(out state);
            return(state == PLAYBACK_STATE.PLAYING);
        }
Beispiel #16
0
    void Update()
    {
        //--------------------------------------------------------------------
        // 8: This shows how to manually update the instance of a 3D event so
        //    it has the position and velocity of it's game object. (5) Show
        //    how this can be done automatically.
        //--------------------------------------------------------------------
        playerState.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject, cachedRigidBody));

        //--------------------------------------------------------------------
        // 9: This shows how to update a parameter of an instance every frame
        //--------------------------------------------------------------------
        playerState.setParameterByID(healthParameterId, (float)health);

        //--------------------------------------------------------------------
        // 10: This shows how to query the playback state of an event instance.
        //     This can be useful when playing a one shot to take action
        //     when it finishes. Other playback states can be checked including
        //     Sustaining and Fading-Out.
        //--------------------------------------------------------------------
        if (playerIntro.isValid())
        {
            FMOD.Studio.PLAYBACK_STATE playbackState;
            playerIntro.getPlaybackState(out playbackState);
            if (playbackState == FMOD.Studio.PLAYBACK_STATE.STOPPED)
            {
                playerIntro.release();
                playerIntro.clearHandle();
                SendMessage("PlayerIntroFinished");
            }
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        //Minus health if hit by a bullet and calculate accuracy from the agent - Jak
        if (other.gameObject.tag == "Bullet" && Camera.main.GetComponent <GameManager>().isPaused == false)
        {
            //Get the gun accuracy from the bullet - I store the gameobject that spawns the bullet in AgentReference - which is attached to the instantiated bullet
            float acc = other.gameObject.GetComponent <AgentReference>().spawner.GetComponent <AgentController>().gunAccuracy;
            acc = acc / 100; //Convert to decimal based - easier for range Random.Range

            //If the range is LESS than the acc then shoot - so if the Accuracy is 5 percent(0.05), that means Random.Range has to return 0.05 or less for it to shoot
            if (Random.Range(0.0f, 1.0f) < acc) //Process if hit or not
            {
                GetEctoplasm--;

                if (m_Anim.GetBool("Damaged") == false)
                {
                    m_Anim.SetBool("Damaged", true);
                }

                //Sound Effect ----------------------------------
                FMOD.Studio.PLAYBACK_STATE stateDamaged;
                damageSound.getPlaybackState(out stateDamaged); //Poll the audio events to see if playback is happening

                //Check if any audio is still playing and stop it to prevent overlap - Then play the required clip
                if (stateDamaged == FMOD.Studio.PLAYBACK_STATE.STOPPED)
                {
                    damageSound.start();                                                                                                      // Starts the event
                    FMODUnity.RuntimeManager.AttachInstanceToGameObject(damageSound, GetComponent <Transform>(), GetComponent <Rigidbody>()); //Setup the 3D audio attributes
                }
                //End Sound Effect ----------------------------
            }
        }
    }
Beispiel #18
0
 void playsound()
 {
     stomping.getPlaybackState(out pbs);
     if (pbs == FMOD.Studio.PLAYBACK_STATE.STOPPED)
     {
         stomping.start();
     }
 }
Beispiel #19
0
    public bool IsEventInstancePlaying(FMOD.Studio.EventInstance eventInstance)
    {
        FMOD.Studio.PLAYBACK_STATE playbackState;
        eventInstance.getPlaybackState(out playbackState);
        bool isPlaying = playbackState != FMOD.Studio.PLAYBACK_STATE.STOPPED;

        return(isPlaying);
    }
Beispiel #20
0
    // Update is called once per frame
    void Update()
    {
        CurrentScene = SceneManager.GetActiveScene();


        if (ShouldFadeInTitleTrack && BackgroundMusicLayersFadeValue < 1)
        {
            BackgroundMusicLayersFadeValue += 0.005f;
            TitleScreenMusic.setParameterValue("BackgroundMusicLayerManageValue", BackgroundMusicLayersFadeValue);
        }
        if (ShouldFadeInSopranos && BackgroundMusicLayersFadeValue < 2)
        {
            BackgroundMusicLayersFadeValue += 0.005f;
            TitleScreenMusic.setParameterValue("BackgroundMusicLayerManageValue", BackgroundMusicLayersFadeValue);
        }
        if (ShouldFadeInGlock && BackgroundMusicLayersFadeValue < 3)
        {
            BackgroundMusicLayersFadeValue += 0.01f;
            TitleScreenMusic.setParameterValue("BackgroundMusicLayerManageValue", BackgroundMusicLayersFadeValue);
        }
        if (TriggerLayerChangeScript.ShouldTransitionToBassoonPart && BackgroundMusicLayersFadeValue < 4)
        {
            BackgroundMusicLayersFadeValue += 0.005f;
            TitleScreenMusic.setParameterValue("BackgroundMusicLayerManageValue", BackgroundMusicLayersFadeValue);
        }
        if (ShouldFadeInPostFirstLevelTrack && PostFirstPuzzleLayersFadeValue < 1)
        {
            PostFirstPuzzleMusic.getPlaybackState(out PostFirstPuzzleMusicPlaybackState);
            if (PostFirstPuzzleMusicPlaybackState != FMOD.Studio.PLAYBACK_STATE.PLAYING)
            {
                PostFirstPuzzleMusic.start();
            }
            PostFirstPuzzleLayersFadeValue += 0.01f;
            PostFirstPuzzleMusic.setParameterValue("PostFirstPuzzleLayersFadeValue", PostFirstPuzzleLayersFadeValue);
        }
        if (ShouldFadeInPostFirstLevelTrack && BackgroundMusicLayersFadeValue < 5)
        {
            BackgroundMusicLayersFadeValue += 0.01f;
            TitleScreenMusic.setParameterValue("BackgroundMusicLayerManageValue", BackgroundMusicLayersFadeValue);
        }
        if (ShouldFadeInPostBathroomMusic)
        {
            PostBathroomMusic.getPlaybackState(out PostBathroomMusicPlaybackState);
            if (PostBathroomMusicPlaybackState != FMOD.Studio.PLAYBACK_STATE.PLAYING)
            {
                PostBathroomMusic.start();
            }
            if (PostFirstPuzzleLayersFadeValue < 2)
            {
                PostFirstPuzzleLayersFadeValue += 0.01f;
                PostFirstPuzzleMusic.setParameterValue("PostFirstPuzzleLayersFadeValue", PostFirstPuzzleLayersFadeValue);
            }
            if (PostFirstPuzzleLayersFadeValue > 1.98f)
            {
                PostFirstPuzzleMusic.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
            }
        }
    }
Beispiel #21
0
    void Update()
    {
        if (GameManager.instance)
        {
            FMOD.Studio.PLAYBACK_STATE state;
            if (GameManager.instance.getPause())
            {
                p.getPlaybackState(out state);

                if (state == FMOD.Studio.PLAYBACK_STATE.STOPPED)
                {
                    p.start();
                }
            }
            else
            {
                p.getPlaybackState(out state);

                if (state == FMOD.Studio.PLAYBACK_STATE.PLAYING)
                {
                    p.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
                }
            }

            if (GameManager.instance.getCurrentRoom() && type != GameManager.instance.getCurrentRoom().GetComponent <GamasutraRoom>().heigh *GameManager.instance.getCurrentRoom().GetComponent <GamasutraRoom>().width)
            {
                type = GameManager.instance.getCurrentRoom().GetComponent <GamasutraRoom>().heigh *GameManager.instance.getCurrentRoom().GetComponent <GamasutraRoom>().width;
                if (type == 1)
                {
                    releaseAllReverb();
                    lr.start();
                }
                else if (type == 2)
                {
                    releaseAllReverb();
                    mr.start();
                }
                else if (type == 4)
                {
                    releaseAllReverb();
                    hr.start();
                }
            }
        }
    }
 public void Click()
 {
     FMOD.Studio.PLAYBACK_STATE pbState;
     click.getPlaybackState(out pbState);
     if (pbState != FMOD.Studio.PLAYBACK_STATE.PLAYING)
     {
         click.start();
     }
 }
 public void Hover()
 {
     FMOD.Studio.PLAYBACK_STATE pbState;
     hover.getPlaybackState(out pbState);
     if (pbState != FMOD.Studio.PLAYBACK_STATE.PLAYING)
     {
         hover.start();
     }
 }
Beispiel #24
0
 public void PlayAmbience()
 {
     FMOD.Studio.PLAYBACK_STATE _playingAmbience;
     ambienceInstance.getPlaybackState(out _playingAmbience);
     if (_playingAmbience != FMOD.Studio.PLAYBACK_STATE.PLAYING)
     {
         ambienceInstance.start();
     }
 }
Beispiel #25
0
 public void PlayMusic()
 {
     FMOD.Studio.PLAYBACK_STATE _playingMusic;
     musicInstance.getPlaybackState(out _playingMusic);
     if (_playingMusic != FMOD.Studio.PLAYBACK_STATE.PLAYING)
     {
         musicInstance.start();
     }
 }
Beispiel #26
0
 public void PlayJetPackEmpty()
 {
     FMOD.Studio.PLAYBACK_STATE state;
     jetpack_Empty.getPlaybackState(out state);
     if (state != FMOD.Studio.PLAYBACK_STATE.PLAYING)
     {
         jetpack_Empty.start();
     }
 }
 public void Play()
 {
     FMODEvent.getPlaybackState(out playbackState);
     if (playbackState != FMOD.Studio.PLAYBACK_STATE.STOPPED)
     {
         return;
     }
     FMODEvent.start();
 }
Beispiel #28
0
    protected void Playing()
    {
        FMOD.Studio.PLAYBACK_STATE buf;
        _sound.getPlaybackState(out buf);

        if (buf == FMOD.Studio.PLAYBACK_STATE.STOPPED)
        {
            Finish();
        }
    }
Beispiel #29
0
 public bool IsPlaying()
 {
     if (instance.isValid())
     {
         FMOD.Studio.PLAYBACK_STATE playbackState;
         instance.getPlaybackState(out playbackState);
         return(playbackState != FMOD.Studio.PLAYBACK_STATE.STOPPED);
     }
     return(false);
 }
Beispiel #30
0
 public void SFXTest()
 {
     FMOD.Studio.PLAYBACK_STATE state;
     FMOD.RESULT res = SFXVolumeTest.getPlaybackState(out state);
     if (res == FMOD.RESULT.OK && state == FMOD.Studio.PLAYBACK_STATE.PLAYING)
     {
         SFXVolumeTest.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
     }
     SFXVolumeTest.start();
 }
Beispiel #31
0
    protected bool IsSoundPlaying(EventInstance instance)
    {
        if (instance == null) {
            Debug.LogError ("Null event instance");
            return false;
        }

        var playbackState = PLAYBACK_STATE.STOPPED;

        instance.getPlaybackState (out playbackState);

        return playbackState == PLAYBACK_STATE.PLAYING;
    }