Inheritance: HandleBase
Esempio n. 1
0
        public System(FMOD.Studio.System system)
        {
            //Load native dependencies
            Native.Load();

            _system = system;
        }
Esempio n. 2
0
        public System(FMOD.Studio.System system)
        {
            //Load native dependencies
            Native.Load();

            _system = system;
        }
Esempio n. 3
0
    /*
     * Switches the current VO bank to the new one specified by the language by
     * unloading the previous bank and loading the new one.
     */
    public static void switchBankTo(VOLanguage newVOLanguage)
    {
        if (VOLocalisation.currentLanguage == newVOLanguage)
        {
            return;
        }

        FMOD.Studio.System sys = RuntimeManager.StudioSystem;

        // Unload current bank if it exists
        if (currentBank != null)
        {
            currentBank.unload();
        }

        // Load new bank file
        switch (newVOLanguage)
        {
        case VOLanguage.ENGLISH:
            sys.loadBankFile(Application.dataPath + "/StreamingPaths/VO_ENG.bank",
                             LOAD_BANK_FLAGS.NORMAL, out currentBank);
            break;

        case VOLanguage.SWEDISH:
            sys.loadBankFile(Application.dataPath + "/StreamingPaths/VO_SWE.bank",
                             LOAD_BANK_FLAGS.NORMAL, out currentBank);
            break;
        }
        VOLocalisation.currentLanguage = newVOLanguage;
    }
 private void Update3DAttributes()
 {
     FMOD.Studio.System system = FMOD_StudioSystem.instance.System;
     if (system != null && system.isValid())
     {
         FMOD.Studio.ATTRIBUTES_3D attributes = UnityUtil.to3DAttributes(base.gameObject, this.cachedRigidBody);
         this.ERRCHECK(system.setListenerAttributes(0, attributes));
     }
 }
Esempio n. 5
0
        public static void Unload()
        {
            if (system == null)
            {
                return;
            }

            // Vanilla only calls unloadAll.
            system.unloadAll().CheckFMOD();
            system.release().CheckFMOD();
            system = null;
            ready  = false;
        }
Esempio n. 6
0
        public static void Unload()
        {
            if (system == null)
            {
                return;
            }

            // Vanilla only calls unloadAll.
            // Avoid CheckFMOD as unload can happen after failed init.
            system.unloadAll();
            system.release();
            system = null;
            ready  = false;
        }
Esempio n. 7
0
    void Start()
    {
        FMOD.Studio.System system = FMOD_StudioSystem.instance.System;

        FMOD.RESULT result = system.getBus("bus:/Music", out musicBus);
        Debug.Log("FMOD music bus: " + result);

        result = system.getBus("bus:/Game", out soundBus);
        Debug.Log("FMOD sound bus: " + result);


        music.background.instance = FMOD_StudioSystem.instance.GetEvent(music.background.song);
        music.background.instance.getParameter("Death", out music.background.param);

        StartMusic(Songs.BackgroundSong);
    }
Esempio n. 8
0
        public SoundFile(Bankfile bankFileToConvert, FMOD.Studio.System systemToLoadFrom)
        {
            systemToLoadFrom.loadBankFile(bankFileToConvert.BankName, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL,
                                          out var mainBank);
            systemToLoadFrom.loadBankFile(bankFileToConvert.BankStringName, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL,
                                          out var stringBank);
            Banks[0] = mainBank;
            Banks[1] = stringBank;

            foreach (var @event in bankFileToConvert.Events)
            {
                systemToLoadFrom.getEvent($"event:/{@event.EventName}", out var tempDescription);
                EventDescriptions.Add(@event.SongId, new EventFile(
                                          tempDescription, new EventInstance(), @event.EventName));
            }
        }
Esempio n. 9
0
 public static void Initialize()
 {
     try
     {
         FMOD.Studio.System studioSystem = RuntimeManager.StudioSystem;
         didFmodInitializeSuccessfully = RuntimeManager.IsInitialized;
     }
     catch (Exception ex)
     {
         didFmodInitializeSuccessfully = false;
         if (ex.GetType() != typeof(SystemNotInitializedException))
         {
             throw ex;
         }
         Debug.LogWarning(ex);
     }
     CollectParameterUpdaters();
     CollectSoundDescriptions();
 }
Esempio n. 10
0
 void Start()
 {
     FMOD.GUID          masterGuid;
     FMOD.Studio.System masterSystem = FMOD_StudioSystem.instance.System;
     ERRCHECK(masterSystem.lookupID("bus:/", out masterGuid));
     ERRCHECK(masterSystem.getMixerStrip(masterGuid, FMOD.Studio.LOADING_MODE.BEGIN_NOW, out masterBus));
     FMOD.GUID          musicGuid;
     FMOD.Studio.System musicSystem = FMOD_StudioSystem.instance.System;
     ERRCHECK(musicSystem.lookupID("bus:/Music", out musicGuid));
     ERRCHECK(musicSystem.getMixerStrip(musicGuid, FMOD.Studio.LOADING_MODE.BEGIN_NOW, out musicBus));
     FMOD.GUID          VOGuid;
     FMOD.Studio.System VOSystem = FMOD_StudioSystem.instance.System;
     ERRCHECK(VOSystem.lookupID("bus:/VO", out VOGuid));
     ERRCHECK(VOSystem.getMixerStrip(VOGuid, FMOD.Studio.LOADING_MODE.BEGIN_NOW, out VOBus));
     FMOD.GUID          soundGuid;
     FMOD.Studio.System soundSystem = FMOD_StudioSystem.instance.System;
     ERRCHECK(soundSystem.lookupID("bus:/Sound", out soundGuid));
     ERRCHECK(soundSystem.getMixerStrip(soundGuid, FMOD.Studio.LOADING_MODE.BEGIN_NOW, out soundBus));
 }
Esempio n. 11
0
    static void UnloadAllBanks()
    {
        if (sFMODSystem != null)
        {
            foreach (var bank in loadedBanks)
            {
                ERRCHECK(bank.unload());
            }

            loadedBanks.Clear();
            events.Clear();

            sFMODSystem.release();
            sFMODSystem = null;
        }
        else if (loadedBanks.Count != 0)
        {
            FMOD.Studio.UnityUtil.LogError("Banks not unloaded!");
        }
    }
Esempio n. 12
0
    void Start()
    {
        FMOD.Studio.System system = FMOD_StudioSystem.instance.System;
        system.getBus("bus:/", out masterBus);

        if (!PlayerPrefs.HasKey("muted"))
        {
            PlayerPrefs.SetInt("muted", 0);
        }

        if (PlayerPrefs.GetInt("muted") == 1)
        {
            masterBus.setMute(true);
            sounds.GetComponent <Image>().sprite = spriteSoundOff;
        }
        else if (PlayerPrefs.GetInt("muted") == 0)
        {
            masterBus.setMute(false);
            sounds.GetComponent <Image>().sprite = spriteSoundOn;
        }
    }
Esempio n. 13
0
    // Use this for initialization
    void Init()
    {
        if (instance == null)
        {
            instance = this;
            // Specify that the game object with this behaviour doesn't gets destroyed when reloading the scene
            DontDestroyOnLoad(gameObject);
        }


        // Get the studio and low level systems from RuntimeManager, where them have been created
        studioSystem   = FMODUnity.RuntimeManager.StudioSystem;
        lowlevelSystem = FMODUnity.RuntimeManager.LowlevelSystem;

        //studioSystem.getCPUUsage(out _cpuUsage);


        uint version;

        _result = lowlevelSystem.getVersion(out version);
        ErrorCheck(_result);

        UnityEngine.Debug.Log("FMOD version: " + version);


        //System.IntPtr extradriverdata = new System.IntPtr(0);
        // Initialize studio and low level system
        //_result = studioSystem.initialize(128, FMOD.Studio.INITFLAGS.NORMAL, FMOD.INITFLAGS.NORMAL, extradriverdata);
        //ErrorCheck(_result);
        //_result = lowlevelSystem.init(128, FMOD.INITFLAGS.NORMAL, extradriverdata);
        //ErrorCheck(_result);



        _listenerAttributes3D = RuntimeUtils.To3DAttributes(sceneListener, sceneListener.GetComponent <Rigidbody>());
        _result = studioSystem.setListenerAttributes(0, _listenerAttributes3D);
        ErrorCheck(_result);
        _result = lowlevelSystem.set3DListenerAttributes(0, ref _listenerAttributes3D.position, ref _listenerAttributes3D.velocity, ref _listenerAttributes3D.forward, ref _listenerAttributes3D.up);
        ErrorCheck(_result);
    }
Esempio n. 14
0
    // Use this for initialization
    void Start()
    {
        //gc = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();
        FMOD.Studio.System system = FMOD_StudioSystem.instance.System;
        system.getBus("bus:/", out masterBus);

        if (!PlayerPrefs.HasKey("muted"))
        {
            PlayerPrefs.SetInt("muted", 0);
        }

        if (PlayerPrefs.GetInt("muted") == 1)
        {
            masterBus.setMute(true);
            sounds.GetComponent <SpriteRenderer>().sprite = spriteSoundOff;
        }
        else if (PlayerPrefs.GetInt("muted") == 0)
        {
            masterBus.setMute(false);
            sounds.GetComponent <SpriteRenderer>().sprite = spriteSoundOn;
        }
    }
Esempio n. 15
0
    void Start()
    {
        scoretime = GameObject.Find("Text").GetComponent <Text>();
        sounds    = GameObject.Find("Mute");
        vicObj    = Resources.Load("Prefabs/effects/prtclVictory") as GameObject;
        timer     = GameObject.Find("Timer").GetComponent <GameTimer> ();
        camobj    = GameObject.FindGameObjectWithTag("MainCamera");
        camera    = camobj.GetComponent <Camera> ();
        vicObj.transform.localScale = new Vector3(1f, 1f, 1f) * (camera.orthographicSize / (5.5f));
        victory = vicObj.GetComponent <ParticleSystem> ();
        camera.nearClipPlane = 0.0f;
        vicpos = camera.transform.position + new Vector3(0f, -10f, 0f);
        Instantiate(playmat);
        StartCoroutine(WaitForPlaymatToLoad());
        timer.StartTimer();

        FMOD.Studio.System system = FMOD_StudioSystem.instance.System;
        system.getBus("bus:/", out masterBus);

        if (!PlayerPrefs.HasKey("muted"))
        {
            PlayerPrefs.SetInt("muted", 0);
        }

        if (PlayerPrefs.GetInt("muted") == 1)
        {
            masterBus.setMute(true);
            sounds.GetComponent <SpriteRenderer>().sprite = spriteSoundOff;
        }
        else if (PlayerPrefs.GetInt("muted") == 0)
        {
            masterBus.setMute(false);
            sounds.GetComponent <SpriteRenderer>().sprite = spriteSoundOn;
        }
        scoretime.text = "Score: " + playmat.GetComponent <Playmat> ().Points + "/" + playmat.GetComponent <Playmat> ().TotalPoints.ToString();
    }
Esempio n. 16
0
        // Initialization / system functions.
        public static RESULT create(out System studiosystem)
        {
            RESULT      result           = RESULT.OK;
            IntPtr      rawPtr;
            studiosystem                 = null;

            result = FMOD_Studio_System_Create(out rawPtr, VERSION.number);
            if (result != RESULT.OK)
            {
                return result;
            }

            studiosystem = new System(rawPtr);

            return result;
        }
Esempio n. 17
0
 // Information query
 public RESULT getSystem(out System system)
 {
     system = null;
     IntPtr newPtr = new IntPtr();
     RESULT result = FMOD_Studio_CommandReplay_GetSystem(rawPtr, out newPtr);
     if (result == RESULT.OK)
     {
         system = new System(newPtr);
     }
     return result;
 }
Esempio n. 18
0
 private void FmodInitialize()
 {
     _fmodSS = FMODUnity.RuntimeManager.StudioSystem; //Script enabler
     FMOD.Studio.CPU_USAGE _fmodCPU;
     _fmodSS.getCPUUsage(out _fmodCPU);               //Shows cpu usage
 }
 public static RESULT create(out System studiosystem)
 {
     return(FMOD_Studio_System_Create(out studiosystem.handle, 69637u));
 }
Esempio n. 20
0
    // Use this for initialization
    void Start()
    {
        frequency        = 800;
        amplitude        = 1.0f;
        sampleGenerator  = GenerateSineSample;
        sampleGenerator2 = GenerateTriangleSample;

        //referencja do komponentow FMOD - wysokiego poziomu (studio) i niskiego
        studioSystem   = FMODUnity.RuntimeManager.StudioSystem;
        lowlevelSystem = FMODUnity.RuntimeManager.LowlevelSystem;

        //odniesienie do glownego kanalu - do niego bedziemy przesylac nasz dzwiek
        channel = new Channel();
        channel1forInstrument = new Channel();
        channel2forInstrument = new Channel();
        channel3forSoundFile  = new Channel();
        FMODUnity.RuntimeManager.LowlevelSystem.getMasterChannelGroup(out channelGroup);
        FMODUnity.RuntimeManager.LowlevelSystem.getMasterChannelGroup(out channelGroupforInstrument);
        FMODUnity.RuntimeManager.LowlevelSystem.getMasterChannelGroup(out channelGroupforInstrument2);

        FMODUnity.RuntimeManager.LowlevelSystem.getMasterChannelGroup(out channelGroupforSoundFile);

        //inicjalizacja FFT (w FMODzie jako komponent DSP) i linerenderera do wyswietlania equalizera
        FMODUnity.RuntimeManager.LowlevelSystem.createDSPByType(FMOD.DSP_TYPE.FFT, out fft);
        fft.setParameterInt((int)FMOD.DSP_FFT.WINDOWTYPE, (int)FMOD.DSP_FFT_WINDOW.HANNING);
        fft.setParameterInt((int)FMOD.DSP_FFT.WINDOWSIZE, windowSize * 2);
        lineRendererFFT = gameObject.AddComponent <LineRenderer>();
        lineRendererFFT.positionCount = windowSize;
        lineRendererFFT.startWidth    = 0.1f;
        lineRendererFFT.endWidth      = 0.1f;
        channelGroup.addDSP(FMOD.CHANNELCONTROL_DSP_INDEX.HEAD, fft);
        //channelGroupforInstrument.addDSP(FMOD.CHANNELCONTROL_DSP_INDEX.HEAD, fft);
        //channelGroupforInstrument2.addDSP(FMOD.CHANNELCONTROL_DSP_INDEX.HEAD, fft);
        channelGroupforSoundFile.addDSP(FMOD.CHANNELCONTROL_DSP_INDEX.HEAD, fft);

        lineRendererSamples = lineRendererHolder.AddComponent <LineRenderer>();
        lineRendererSamples.positionCount = sampleRate / 100;
        lineRendererSamples.startWidth    = 0.1f;
        lineRendererSamples.endWidth      = 0.1f;

        //lowPassFilterGraphMarker = GameObject.CreatePrimitive(PrimitiveType.Cube);
        //lowPassFilterGraphMarker.transform.position = new Vector3(0, lineRendererSamples.transform.position.y, 0.0f);
        //lowPassFilterGraphMarker.transform.localScale = new Vector3(0.5f, 5.0f, 0.5f);
        //lowPassFilterGraphMarker.SetActive(false);
        //lowPassFilterGraphMarker.GetComponent<Renderer>().material.color = Color.red;

        //Debug - sprawdzamy czy dobrze udalo nam sie zlapac kanal dzwiekowy (nie mamy jeszcze
        //obslugi bledow FMOD_OK)
        uint version;

        lowlevelSystem.getVersion(out version);
        bool channelIsPlaying;

        channel.isPlaying(out channelIsPlaying);
        UnityEngine.Debug.Log(channelIsPlaying);
        uint bl;
        int  numbuf;

        lowlevelSystem.getDSPBufferSize(out bl, out numbuf);
        UnityEngine.Debug.Log("DSP buffer size is: " + bl + ", " + numbuf);

        //Wczytujemy i odtwarzamy testowy plik do obiektu 'sound'
        //Przypisujemy nasz kanal do tej samej grupy co glowny kanal dzwieku
        FMOD.Sound sound;
        string     nametest = "";

        lowlevelSystem.createSound("Assets\\Sounds\\test2.mp3", FMOD.MODE.DEFAULT, out sound);
        sound.getName(out nametest, 20);
        UnityEngine.Debug.Log(nametest);


        InitSampleGeneration();

        //debug
        // (sampleCreated)
        //{
        lowlevelSystem.playSound(generatedSound, channelGroup, true, out channel);
        channel.setLoopCount(-1);
        channel.setMode(MODE.LOOP_NORMAL);
        channel.setPosition(0, TIMEUNIT.MS);
        channel.setPaused(true);
        //}
        //else
        //{
        lowlevelSystem.playSound(sound, channelGroupforSoundFile, true, out channel3forSoundFile);
        channel3forSoundFile.setLoopCount(-1);
        channel3forSoundFile.setMode(MODE.LOOP_NORMAL);
        channel3forSoundFile.setPosition(0, TIMEUNIT.MS);
        channel3forSoundFile.setPaused(false);
        //}
        //lowPassFilterGraphMarker.SetActive(false);

        InitFilters();
        filterApplier.InitFilterApplier();
        instrument.InitFilterApplier();
    }
Esempio n. 21
0
 // This function is deprecated. Use System.create() instead.
 public static RESULT System_Create(out System studiosystem)
 {
     return System.create(out studiosystem);
 }
Esempio n. 22
0
 /// <summary>
 /// Releases this instance.
 /// </summary>
 public void Release()
 {
     System.Release();
     this.system = null;
 }