Inheritance: HandleBase
Beispiel #1
0
    // função para controlar volume do SFX no jogo (volume min=0 max=1)
    void VolumeUI_MUSIC(float volume)
    {
        string vcaPath = "vca:/ui music";

        FMOD.Studio.VCA vca = FMODUnity.RuntimeManager.GetVCA(vcaPath);
        vca.setVolume(volume);
    }
Beispiel #2
0
    void Start()
    {
        instance = FMODUnity.RuntimeManager.CreateInstance(fmodEvent);
        instance.start();

        vca = FMODUnity.RuntimeManager.GetVCA("vca:/MusicVCA");
    }
Beispiel #3
0
    // função para controlar volume da UI (volume min=0 max=1)
    void VolumeSFX(float volume)
    {
        string vcaPath = "vca:/sfx";

        FMOD.Studio.VCA vca = FMODUnity.RuntimeManager.GetVCA(vcaPath);
        vca.setVolume(volume);
    }
Beispiel #4
0
        public RESULT getVCAList(out VCA[] array)
        {
            array = null;
            int    num;
            RESULT rESULT = Bank.FMOD_Studio_Bank_GetVCACount(this.rawPtr, out num);

            if (rESULT != RESULT.OK)
            {
                return(rESULT);
            }
            if (num == 0)
            {
                array = new VCA[0];
                return(rESULT);
            }
            IntPtr[] array2 = new IntPtr[num];
            int      num2;

            rESULT = Bank.FMOD_Studio_Bank_GetVCAList(this.rawPtr, array2, num, out num2);
            if (rESULT != RESULT.OK)
            {
                return(rESULT);
            }
            if (num2 > num)
            {
                num2 = num;
            }
            array = new VCA[num2];
            for (int i = 0; i < num2; i++)
            {
                array[i] = new VCA(array2[i]);
            }
            return(RESULT.OK);
        }
Beispiel #5
0
    private float vcaVolume;                 // в эту переменную записывается значение громкости из VCA



    void Start()
    {
        ourSlider     = gameObject.GetComponent <UnityEngine.UI.Slider> (); // переменной слайдера добавляем доступ к компоненту слайдера
        vcaController = FMODUnity.RuntimeManager.GetVCA("vca:/" + vcaName); // даем доступ к VCA по имени, которое мы пишем в компоненте
        vcaController.getVolume(out vcaVolume);                             //  передаем значение громкости шины VCA в переменную vcaVolume
        ourSlider.value = vcaVolume;                                        //
    }
        public RESULT getVCAList(out VCA[] array)
        {
            array = null;
            RESULT rESULT = FMOD_Studio_Bank_GetVCACount(handle, out int count);

            if (rESULT != 0)
            {
                return(rESULT);
            }
            if (count == 0)
            {
                array = new VCA[0];
                return(rESULT);
            }
            IntPtr[] array2 = new IntPtr[count];
            rESULT = FMOD_Studio_Bank_GetVCAList(handle, array2, count, out int count2);
            if (rESULT != 0)
            {
                return(rESULT);
            }
            if (count2 > count)
            {
                count2 = count;
            }
            array = new VCA[count2];
            for (int i = 0; i < count2; i++)
            {
                array[i].handle = array2[i];
            }
            return(RESULT.OK);
        }
Beispiel #7
0
    public void SetVolumeMusic(float vol)
    {
        string vcaPath = "vca:/MusicVCA";

        FMOD.Studio.VCA vca = FMODUnity.RuntimeManager.GetVCA(vcaPath);
        vca.setVolume(vol);
    }
 public RESULT getVCA(string path, out VCA vca)
 {
     using (StringHelper.ThreadSafeEncoding threadSafeEncoding = StringHelper.GetFreeHelper())
     {
         return(FMOD_Studio_System_GetVCA(handle, threadSafeEncoding.byteFromStringUTF8(path), out vca.handle));
     }
 }
Beispiel #9
0
    //---------------------------------------
    // good to know: linear-> db conversion
    // float db = linear > 0 ? 20.0f * Mathf.Log10(linear * Mathf.Sqrt(2.0f)) : -80.0f;
    //
    public void SetVolumeFx(float vol)
    {
        //  Debug.Log("vol: " + vol);
        string vcaPath = "vca:/FXVCA";

        FMOD.Studio.VCA vca = FMODUnity.RuntimeManager.GetVCA(vcaPath);
        vca.setVolume(vol);
    }
Beispiel #10
0
 // Start is called before the first frame update
 void Start()
 {
     mainVca = FMODUnity.RuntimeManager.GetVCA("vca:/Main");
     muVca   = FMODUnity.RuntimeManager.GetVCA("vca:/Mu");
     sxVca   = FMODUnity.RuntimeManager.GetVCA("vca:/Sx");
     atVca   = FMODUnity.RuntimeManager.GetVCA("vca:/At");
     voVca   = FMODUnity.RuntimeManager.GetVCA("vca:/Vo");
 }
Beispiel #11
0
        public RESULT getID(out Guid id)
        {
            byte[] array  = new byte[16];
            RESULT result = VCA.FMOD_Studio_VCA_GetID(this.rawPtr, array);

            id = new Guid(array);
            return(result);
        }
Beispiel #12
0
        public RESULT getVCAByID(Guid guid, out VCA vca)
        {
            vca = null;
            IntPtr raw    = 0;
            RESULT rESULT = System.FMOD_Studio_System_GetVCAByID(this.rawPtr, guid.ToByteArray(), out raw);

            if (rESULT != RESULT.OK)
            {
                return(rESULT);
            }
            vca = new VCA(raw);
            return(rESULT);
        }
Beispiel #13
0
        public RESULT getVCA(string path, out VCA vca)
        {
            vca = null;
            IntPtr raw    = 0;
            RESULT rESULT = System.FMOD_Studio_System_GetVCA(this.rawPtr, Encoding.UTF8.GetBytes(path + '\0'), out raw);

            if (rESULT != RESULT.OK)
            {
                return(rESULT);
            }
            vca = new VCA(raw);
            return(rESULT);
        }
Beispiel #14
0
        public RESULT getPath(out string path)
        {
            path = null;
            byte[] array  = new byte[256];
            int    num    = 0;
            RESULT rESULT = VCA.FMOD_Studio_VCA_GetPath(this.rawPtr, array, array.Length, out num);

            if (rESULT == RESULT.ERR_TRUNCATED)
            {
                array  = new byte[num];
                rESULT = VCA.FMOD_Studio_VCA_GetPath(this.rawPtr, array, array.Length, out num);
            }
            if (rESULT == RESULT.OK)
            {
                path = Encoding.UTF8.GetString(array, 0, num - 1);
            }
            return(rESULT);
        }
    private void Awake()
    {
        MusicVCA = FMODUnity.RuntimeManager.GetVCA("vca:/" + MusicVCAName);

        FXVCA = FMODUnity.RuntimeManager.GetVCA("vca:/" + FXVCAName);

        /*
         * if (PlayerPrefs.HasKey("FXVolume"))
         * {
         *
         *  volumeFX = PlayerPrefs.GetFloat("FXVolume");
         *  SetFXVolume(volumeFX);
         *
         *  volumeMusik = PlayerPrefs.GetFloat("MusicVolume");
         *  SetMusicVolume(volumeMusik);
         *
         * }
         */
    }
Beispiel #16
0
    private void GetVCAs()
    {
        musicVCA = RuntimeManager.GetVCA("vca:/Music");

        if (!musicVCA.isValid())
        {
            if (Debug.isDebugBuild)
            {
                Debug.Log("Could not get music vca. Path wrong?");
            }
        }

        sfxVCA = RuntimeManager.GetVCA("vca:/SFX");

        if (!sfxVCA.isValid())
        {
            if (Debug.isDebugBuild)
            {
                Debug.Log("Could not get sfx vca. Path wrong?");
            }
        }
    }
        public RESULT getVCA(string path, out VCA vca)
        {
            vca = null;

            IntPtr newPtr = new IntPtr();
            RESULT result = FMOD_Studio_System_GetVCA(rawPtr, Encoding.UTF8.GetBytes(path + Char.MinValue), out newPtr);
            if (result != RESULT.OK)
            {
                return result;
            }

            vca = new VCA(newPtr);
            return result;
        }
        public RESULT getVCAList(out VCA[] array)
        {
            array = null;

            RESULT result;
            int capacity;
            result = FMOD_Studio_Bank_GetVCACount(rawPtr, out capacity);
            if (result != RESULT.OK)
            {
                return result;
            }
            if (capacity == 0)
            {
                array = new VCA[0];
                return result;
            }

            IntPtr[] rawArray = new IntPtr[capacity];
            int actualCount;
            result = FMOD_Studio_Bank_GetVCAList(rawPtr, rawArray, capacity, out actualCount);
            if (result != RESULT.OK)
            {
                return result;
            }
            if (actualCount > capacity) // More items added since we queried just now?
            {
                actualCount = capacity;
            }
            array = new VCA[actualCount];
            for (int i = 0; i < actualCount; ++i)
            {
                array[i] = new VCA(rawArray[i]);
            }
            return RESULT.OK;
        }
Beispiel #19
0
 // Start is called before the first frame update
 void Start()
 {
     VCA_SFX   = FMODUnity.RuntimeManager.GetVCA(VCA_SFX_Path);
     VCA_Music = FMODUnity.RuntimeManager.GetVCA(VCA_Music_Path);
 }
Beispiel #20
0
    string FMODBankList(string param)
    {
        if (FMOD_StudioSystem.instance == null)
        {
            return("No FMOD system found");
        }
        if (FMOD_StudioSystem.instance.System == null)
        {
            return("No FMOD system found");
        }
        FMOD.Studio.Bank[] banks = new FMOD.Studio.Bank[0];
        FMOD_StudioSystem.instance.System.getBankList(out banks);
        string retval = "Bank Count: " + banks.Length.ToString() + "\r\n";

        foreach (FMOD.Studio.Bank bank in banks)
        {
            string bank_path = "";
            bank.getPath(out bank_path);
            retval += "    Bank [" + bank_path + "]\r\n";
            if (param.IndexOf("-event") >= 0 || param.IndexOf("-all") >= 0)
            {
                FMOD.Studio.EventDescription[] eventdescs = new FMOD.Studio.EventDescription[0];
                bank.getEventList(out eventdescs);
                //if (eventdescs.Length > 0)
                {
                    retval += "        Events: (" + eventdescs.Length + ")\r\n";
                    foreach (FMOD.Studio.EventDescription eventdesc in eventdescs)
                    {
                        string event_path = "";
                        eventdesc.getPath(out event_path);
                        retval += "            Event [" + event_path + "]\r\n";
                    }
                }
            }
            if (param.IndexOf("-vca") >= 0 || param.IndexOf("-all") >= 0)
            {
                FMOD.Studio.VCA[] vcas = new FMOD.Studio.VCA[0];
                bank.getVCAList(out vcas);
                //if (vcas.Length > 0)
                {
                    retval += "        VCAs: (" + vcas.Length + ")\r\n";
                    foreach (FMOD.Studio.VCA vca in vcas)
                    {
                        string vca_path = "";
                        vca.getPath(out vca_path);
                        retval += "            VCA [" + vca_path + "]\r\n";
                    }
                }
            }
            if (param.IndexOf("-bus") >= 0 || param.IndexOf("-all") >= 0)
            {
                FMOD.Studio.Bus[] buses = new FMOD.Studio.Bus[0];
                bank.getBusList(out buses);
                //if (buses.Length > 0)
                {
                    retval += "        Buses: (" + buses.Length + ")\r\n";
                    foreach (FMOD.Studio.Bus bus in buses)
                    {
                        string bus_path = "";
                        bus.getPath(out bus_path);
                        retval += "            Bus [" + bus_path + "]\r\n";
                    }
                }
            }
            if (param.IndexOf("-string") >= 0 || param.IndexOf("-all") >= 0)
            {
                int strcnt = 0;
                bank.getStringCount(out strcnt);
                if (strcnt > 0)
                {
                    retval += "        Strings: (" + strcnt + ")\r\n";
                    for (int i = 0; i < strcnt; ++i)
                    {
                        Guid   _guid;
                        string _path;
                        bank.getStringInfo(i, out _guid, out _path);
                        retval += "            GUID {" + _guid.ToString() + "}    Path [" + _path + "]\r\n";
                    }
                }
            }
        }
        Debug.Log(retval);
        return(retval);
    }
Beispiel #21
0
 protected override bool isValidInternal()
 {
     return(VCA.FMOD_Studio_VCA_IsValid(this.rawPtr));
 }
Beispiel #22
0
 public RESULT setFaderLevel(float volume)
 {
     return(VCA.FMOD_Studio_VCA_SetFaderLevel(this.rawPtr, volume));
 }
Beispiel #23
0
 public RESULT getID(out Guid id)
 {
     return(VCA.FMOD_Studio_VCA_GetID(this.rawPtr, out id));
 }
 public RESULT getVCAByID(Guid guid, out VCA vca)
 {
     return(FMOD_Studio_System_GetVCAByID(handle, ref guid, out vca.handle));
 }
        public RESULT getVCAByID(Guid guid, out VCA vca)
        {
            vca = null;

            IntPtr newPtr = new IntPtr();
			RESULT result = FMOD_Studio_System_GetVCAByID(rawPtr, guid.ToByteArray(), out newPtr);
            if (result != RESULT.OK)
            {
                return result;
            }

            vca = new VCA(newPtr);
            return result;
        }
Beispiel #26
0
    // Start is called before the first frame update
    void Start()
    {
        vca_mus = FMODUnity.RuntimeManager.GetVCA("vca:/Music");
        vca_sfx = FMODUnity.RuntimeManager.GetVCA("vca:/SFX");

        //Load volume settings
        if (PlayerPrefs.HasKey("MusicVolume"))
        {
            vca_mus.setVolume(PlayerPrefs.GetFloat("MusicVolume"));
        }
        else
        {
            vca_mus.setVolume(1.0f);
        }
        if (PlayerPrefs.HasKey("SFXVolume"))
        {
            vca_sfx.setVolume(PlayerPrefs.GetFloat("SFXVolume"));
        }
        else
        {
            vca_sfx.setVolume(1.0f);
        }

        //Load Mouse settings
        if (PlayerPrefs.HasKey("MouseAcceleration"))
        {
            PlayerCameraController.SetMouseAccel(PlayerPrefs.GetInt("MouseAcceleration") == 1);
        }
        if (PlayerPrefs.HasKey("MouseSensitivity"))
        {
            PlayerCameraController.SetMouseSens(PlayerPrefs.GetFloat("MouseSensitivity"));
        }

        GameObject pausePanelObj = GameObject.Find("PauseMenu");

        if (pausePanelObj != null)
        {
            pausePanel = pausePanelObj.GetComponent <CanvasGroup>();
        }

        GameObject hudObj = GameObject.Find("HUD");

        if (hudObj != null)
        {
            hud = hudObj.GetComponent <CanvasGroup>();
        }

        pauseOpen = false;

        curMenu = hud;

        if (!isMainMenu)
        {
            Cursor.visible   = false;
            Cursor.lockState = CursorLockMode.Locked;
        }
        else
        {
            Cursor.visible   = true;
            Cursor.lockState = CursorLockMode.None;
        }
    }
Beispiel #27
0
 public RESULT getFaderLevel(out float volume)
 {
     return(VCA.FMOD_Studio_VCA_GetFaderLevel(this.rawPtr, out volume));
 }