public static void PostEvent(uint e, Vector3 pos) { AkAuxSendArray array = new AkAuxSendArray(Zone.MaxAuxSend); Zone.AuxSend(pos, array); AkSoundEngine.PostEvent(e, pos, array); }
public static uint AuxSend(Vector3 pos, AkAuxSendArray array) { array.Reset(); Zone z = Zone.Get(pos); if (z == null) { return(0); } else { uint count; switch (z.Reverb.Value) { case ReverbMode.Room: array.Add(AK.AUX_BUSSES.REVERB, 1.0f); count = 1; break; case ReverbMode.Subtle: array.Add(AK.AUX_BUSSES.REVERB_SUBTLE, 1.0f); count = 1; break; default: count = 0; break; } return(count); } }
public static uint RegisterTemp(Vector3 pos) { AkAuxSendArray array = new AkAuxSendArray(Zone.MaxAuxSend); Zone.AuxSend(pos, array); return(AkSoundEngine.RegisterTemp(pos, array)); }
//When exiting an AuxSendironment, remove it from active AuxSendironments void OnTriggerExit(Collider other) { AkAuxSend AuxSend = (AkAuxSend)other.gameObject.GetComponent("AkAuxSend"); if(AuxSend != null) { m_activeAuxSends.Remove(AuxSend); m_auxSendValues = null; UpdateAuxSend(); } }
void AddAuxSend(GameObject in_AuxSendObject) { AkAuxSend AuxSend = (AkAuxSend)in_AuxSendObject.GetComponent("AkAuxSend"); if (AuxSend != null) { m_activeAuxSends.Add(AuxSend); m_auxSendValues = null; UpdateAuxSend(); } }
void AddAuxSend(Entity in_AuxSendObject) { AkAuxSend AuxSend = in_AuxSendObject.Get <AkAuxSend>(); if (AuxSend != null) { m_activeAuxSends.Add(AuxSend); m_auxSendValues = null; UpdateAuxSend(); } }
//When exiting an AuxSendironment, remove it from active AuxSendironments void OnTriggerExit(Collider other) { AkAuxSend AuxSend = (AkAuxSend)other.gameObject.GetComponent("AkAuxSend"); if (AuxSend != null) { m_activeAuxSends.Remove(AuxSend); m_auxSendValues = null; UpdateAuxSend(); } }
void UpdateAuxSend() { if (m_auxSendValues == null) m_auxSendValues = new AkAuxSendArray((uint)m_activeAuxSends.Count); else m_auxSendValues.Reset(); foreach(AkAuxSend AuxSend in m_activeAuxSends) m_auxSendValues.Add(AuxSend.GetAuxBusID(), AuxSend.GetAuxSendValueForPosition(gameObject.transform.position)); AkSoundEngine.SetGameObjectAuxSendValues(gameObject, m_auxSendValues, (uint)m_activeAuxSends.Count); }
public static void AttachTracker(Entity entity, Property <Vector3> property) { AkGameObjectTracker tracker = entity.Get <AkGameObjectTracker>(); if (tracker == null) { tracker = new AkGameObjectTracker(); entity.Add(tracker); tracker.Add(new Binding <Matrix, Vector3>(tracker.Matrix, x => Microsoft.Xna.Framework.Matrix.CreateTranslation(x), property)); AkAuxSendArray aux = new AkAuxSendArray(Zone.MaxAuxSend); tracker.Add(new NotifyBinding(delegate() { tracker.AuxSend(aux, Zone.AuxSend(property, aux)); }, property)); } }
public void SetEnvironmentBasedOnFloor(int floor) { AkAuxSendArray aEnvs = new AkAuxSendArray(); int floorAuxIndex = floorAuxMap[floor]; for (int i = 0; i < auxCount; i++) { float value = (floorAuxIndex == i) ? 1.0f : 0.0f; auxValues[i] = value; aEnvs.Add(AkSoundEngine.GetIDFromString(floorAux[i]), value); } AkSoundEngine.SetGameObjectAuxSendValues(gameObject, aEnvs, (uint)auxCount); }
public static void AttachTracker(Entity entity, Property <Matrix> property = null) { AkGameObjectTracker tracker = entity.Get <AkGameObjectTracker>(); if (tracker == null) { tracker = new AkGameObjectTracker(); entity.Add(tracker); if (property == null) { property = entity.Get <Transform>().Matrix; } tracker.Add(new Binding <Matrix>(tracker.Matrix, property)); AkAuxSendArray aux = new AkAuxSendArray(Zone.MaxAuxSend); tracker.Add(new NotifyBinding(delegate() { tracker.AuxSend(aux, Zone.AuxSend(property.Value.Translation, aux)); }, property)); } }
void UpdateAuxSend() { if (m_auxSendValues == null) { m_auxSendValues = new AkAuxSendArray((uint)m_activeAuxSends.Count); } else { m_auxSendValues.Reset(); } foreach (AkAuxSend AuxSend in m_activeAuxSends) { m_auxSendValues.Add(AuxSend.GetAuxBusID(), AuxSend.GetAuxSendValueForPosition(this.transform.Position)); } AkSoundEngine.SetGameObjectAuxSendValues(this.Entity, m_auxSendValues, (uint)m_activeAuxSends.Count); }
public static void PrintAUXChannelInfo(List <GameObject> G) { String finalString = ""; for (int i = 0; i < G.Count; i++) { AkAuxSendArray AuxArray = new AkAuxSendArray(); uint AuxNum = 99; AkSoundEngine.GetGameObjectAuxSendValues(G[i].gameObject, AuxArray, ref AuxNum); if (AuxNum != 99) { finalString = finalString + G[i].name + ": " + AuxNum + ", "; } else { Debug.Log("No AUX info on " + G[i].name); } } Debug.Log(finalString); // AkSoundEngine.SetGameObjectAuxSendValues(transform.parent.gameObject, asdas, sendval); }
//When starting, check if any of our parent objects have the AkAuxSend component. //We'll assume that this object is then affected by the same AuxSendironment setting. public override void Awake() { base.Awake(); this.Serialize = false; this.transform = this.Entity.Get <Transform>(); //When entering an AuxSendironment, add it to the list of active AuxSendironments this.OnEnter.Action = this.AddAuxSend; //When exiting an AuxSendironment, remove it from active AuxSendironments this.OnExit.Action = delegate(Entity other) { AkAuxSend AuxSend = other.Get <AkAuxSend>(); if (AuxSend != null) { m_activeAuxSends.Remove(AuxSend); m_auxSendValues = null; UpdateAuxSend(); } }; this.AddAuxSend(this.Entity); }
public static AKRESULT GetGameObjectAuxSendValues(UnityEngine.GameObject in_gameObjectID, AkAuxSendArray out_paAuxSendValues, ref uint io_ruNumSendValues) { uint tempin_gameObjectID; if ( in_gameObjectID != null ) { tempin_gameObjectID = (uint)in_gameObjectID.GetInstanceID(); // Note: if AkGameObjectTracker is already attached, the following code will be bypassed. if (in_gameObjectID.GetComponent<AkGameObject>() == null) { in_gameObjectID.AddComponent<AkGameObject>(); // Note: We have missed AkGameObject.Awake() of this run to register. // So we take over its work by inlining it here. AkSoundEngine.RegisterGameObj(in_gameObjectID, in_gameObjectID.name); //Set the original position AkSoundEngine.SetObjectPosition( in_gameObjectID, in_gameObjectID.transform.position.x, in_gameObjectID.transform.position.y, in_gameObjectID.transform.position.z, in_gameObjectID.transform.forward.x, in_gameObjectID.transform.forward.y, in_gameObjectID.transform.forward.z ); } } else { tempin_gameObjectID = unchecked((uint)-1); } { AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_GetGameObjectAuxSendValues(tempin_gameObjectID, out_paAuxSendValues.m_Buffer, ref io_ruNumSendValues); return ret; } }
public void AuxSend(AkAuxSendArray aux, uint count) { AkSoundEngine.SetGameObjectAuxSendValues(this.Entity, aux, count); }
public static uint RegisterTemp(Vector3 pos, AkAuxSendArray aux) { uint id = (uint)(ComponentBind.Entity.CurrentGUID & 0xffffffff); ComponentBind.Entity.CurrentGUID++; AkSoundEnginePINVOKE.CSharp_RegisterGameObj__SWIG_1(id); AkSoundEnginePINVOKE.CSharp_SetObjectPosition(id, pos.X, pos.Y, pos.Z, 0.0f, 0.0f, 1.0f); AkSoundEnginePINVOKE.CSharp_SetGameObjectAuxSendValues(id, aux.m_Buffer, aux.m_Count); return id; }
public static AKRESULT GetGameObjectAuxSendValues(UnityEngine.GameObject in_gameObjectID, AkAuxSendArray out_paAuxSendValues, ref uint io_ruNumSendValues) { uint tempin_gameObjectID; if ( in_gameObjectID != null ) { tempin_gameObjectID = (uint)in_gameObjectID.GetInstanceID(); // Note: if AkGameObjectTracker is already attached, the following code will be bypassed. if (in_gameObjectID.GetComponent<AkGameObject>() == null) { in_gameObjectID.AddComponent<AkGameObject>(); } } else { tempin_gameObjectID = unchecked((uint)-1); } { AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_GetGameObjectAuxSendValues(tempin_gameObjectID, out_paAuxSendValues.m_Buffer, ref io_ruNumSendValues); return ret; } }
public static AKRESULT SetGameObjectAuxSendValues(ComponentBind.Entity in_gameObjectID, AkAuxSendArray in_aAuxSendValues, uint in_uNumSendValues) { uint tempin_gameObjectID; if ( in_gameObjectID != null ) { tempin_gameObjectID = getGameObjectID(in_gameObjectID); // Note: if AkGameObjectTracker is already attached, the following code will be bypassed. if (in_gameObjectID.Get<AkGameObject>() == null) { in_gameObjectID.Add(new AkGameObject()); } } else { tempin_gameObjectID = unchecked((uint)-1); } { AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_SetGameObjectAuxSendValues(tempin_gameObjectID, in_aAuxSendValues.m_Buffer, in_uNumSendValues); return ret; } }
public static AKRESULT SetGameObjectAuxSendValues(UnityEngine.GameObject in_gameObjectID, AkAuxSendArray in_aAuxSendValues, uint in_uNumSendValues) { AkAutoObject tempObj = null; uint tempin_gameObjectID; if ( in_gameObjectID != null ) { tempin_gameObjectID = (uint)in_gameObjectID.GetInstanceID(); if (in_gameObjectID.activeInHierarchy) { if (in_gameObjectID.GetComponent<AkGameObj>() == null) { in_gameObjectID.AddComponent<AkGameObj>(); } } else { //Object not active. AkGameObj will not work. Use a temporary game object. //This will automatically unregister at the end of this scope. tempObj = new AkAutoObject(in_gameObjectID); tempin_gameObjectID = (uint)tempObj.m_id; //Silence warning } } else { tempin_gameObjectID = unchecked((uint)-1); } { AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_SetGameObjectAuxSendValues(tempin_gameObjectID, in_aAuxSendValues.m_Buffer, in_uNumSendValues); return ret; } }
public static AKRESULT GetGameObjectAuxSendValues(UnityEngine.GameObject in_gameObjectID, AkAuxSendArray out_paAuxSendValues, ref uint io_ruNumSendValues) { AkAutoObject tempObj = null; uint tempin_gameObjectID = (uint)AutoRegisterAkGameObj(in_gameObjectID, ref tempObj); { AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_GetGameObjectAuxSendValues(tempin_gameObjectID, out_paAuxSendValues.m_Buffer, ref io_ruNumSendValues); return ret; } }