using System.Collections; using System.Collections.Generic; using UnityEngine; public class ChangeChannel : MonoBehaviour { private FMODUnity.StudioEventEmitter emitter; private FMOD.DSP dsp; private bool success = false; FMOD.RESULT result; // Start is called before the first frame update void Start() { emitter = GetComponent(); StartCoroutine(GetDSP()); } IEnumerator GetDSP() { yield return new WaitForSeconds(1.0f); // This will require the Transciever being on the master Channel in the Event in Studio. result = emitter.EventInstance.getChannelGroup(out FMOD.ChannelGroup master); if (result != FMOD.RESULT.OK) { Debug.Log(result.ToString()); } FMOD.DSP_TYPE type = FMOD.DSP_TYPE.UNKNOWN; int index = 0; // This will be used to find the Transceiver in the list of DSP's on the event instance. // If you can be 100% certain of this positon then this can be skipped. E.g. find it before and hard code it. while (type != FMOD.DSP_TYPE.TRANSCEIVER) { result = master.getDSP(index, out dsp); if (result != FMOD.RESULT.OK) { Debug.Log(result.ToString()); Debug.Log("Ran Out of DSP"); break; } else { result = dsp.getType(out type); if (result != FMOD.RESULT.OK) { Debug.Log(result.ToString()); Debug.Log("Failed to find the DSP Type"); break; } else if (type == FMOD.DSP_TYPE.TRANSCEIVER) { Debug.Log("Found the DSP of the right type"); } } index++; } success = true; } // Update is called once per frame void Update() { if (success) { if (Input.GetKeyDown(KeyCode.Alpha1)) { result = dsp.setParameterInt(2, 0); if (result != FMOD.RESULT.OK) Debug.Log(result); } if (Input.GetKeyDown(KeyCode.Alpha2)) { result = dsp.setParameterInt(2, 1); if (result != FMOD.RESULT.OK) Debug.Log(result); } if (Input.GetKeyDown(KeyCode.Alpha3)) { result = dsp.setParameterInt(2, 2); if (result != FMOD.RESULT.OK) Debug.Log(result); } } } }