커뮤니티 Q&A

Audiokinetic의 커뮤니티 Q&A 포럼에 오신 것을 환영합니다. 이 포럼은 Wwise와 Strata 사용자들이 서로 도움을 주는 곳입니다. Audiokinetic의 직접적인 도움을 얻으려면 지원 티켓 페이지를 사용하세요. 버그를 보고하려면 Audiokinetic 런처에서 Bug Report 옵션을 사용하세요. (Q&A 포럼에 제출된 버그 보고는 거절됩니다. 전용 Bug Report 시스템을 사용하면 보고 내용이 담당자에게 정확히 전달되어 문제 해결 가능성이 크게 높아집니다.)<segment 6493>

빠르고 정확한 답변을 얻으려면 질문을 올릴 때 다음 팁을 참고하세요.

  • 구체적인 내용을 적어주세요: 무엇을 하려는지, 혹은 어떤 특정 문제에 부딪혔는지 설명하세요.
  • 핵심 정보를 포함하세요: Wwise와 게임 엔진 버전, 운영체제 등 관련 정보를 함께 제공하세요.
  • 시도한 방법들을 알려주세요: 문제 해결을 위해 이미 어떤 단계를 시도해봤는지 설명해주세요.
  • 객관적인 사실에 초점을 맞추세요: 문제의 기술적 사실을 중심으로 설명하세요. 문제에 집중할수록 다른 사람들이 더 빠르게 해결책을 찾을 수 있습니다.

0 투표

Original question posted on Wwise Wwizards and Wwitches

Posted by Benedict S.
Hey everyone, got what might be a really simple Unity integration question. I'm trying to toggle between engine states "on" and "off" using one key, and I'm trying to check what the current state is before setting it to the other. I'm struggling to work out what do here – I've tried using akSoundEngine.GetState(), but I have no idea how to use it.
The first parameter is the state group as a string, but the second is "out uint out_rState" according to VS Code. I'm not great with Unity, so I'm wondering what on earth this integer might be that I need to feed in – does anyone have any ideas?
Here's the one page I've found so far which even mentions akSoundEngine.GetState(). Cheers

General Discussion Mads Maretty S. (Audiokinetic) (40.2k 포인트) 로 부터

1 답변

0 투표

Hello Benedict, 

Originally, I advised you to use Wwise-Types, but that was a mistake. Wwise-type States are just specific State values and so there's no GetValue or GetState function on it. That said, you can still create two Wwise-type States, which would give you the pickers in the Inspector, and then get the Group ID from it. Something like this... 


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SomeScript : MonoBehaviour
{
    public AK.Wwise.State State01;
    public AK.Wwise.State State02;
    private void Start()
    {
        // If not set, the initial State will be "None".
        State01.SetValue();
    }

    void Update()
    {
        // Button input check
        if (Input.GetKeyDown(KeyCode.Space)) {            

            uint currentState = 0; // variable to store the ID in.
            // Since the Wwise-types only refer to specific state values,
            // you will need to AkSoundEngine.GetState() to get the global one.
            // That said, you can still use the ID from the Wwise-Types.
            AkSoundEngine.GetState(State01.GroupId, out currentState);
            print(currentState); // just delete if you've tested it out.

            if (currentState == State01.Id)
            {
                State02.SetValue();
                print("Set State02"); // just delete if you've tested it out.
            }
            else if (currentState == State02.Id)
            {
                State01.SetValue();
                print("Set State01"); // just delete if you've tested it out.
            }
        }
    }
}


As for the 'out uint out_rState' you just need to declare a uint property first, so you can store the value you get back. That value will be the ID of that State, and you can e.g. use it to search in your SoundBank.txt file and see what specific State it is. 

Mads Maretty S. (Audiokinetic) (40.2k 포인트) 로 부터
...