void HandleGroupingChanges(List <ObjectInput> changedObjects) { foreach (ObjectInput changedObject in changedObjects) { ObjectInstrument objectInstrument = instrumentStates[changedObject.tagValue]; if (DistanceEffectsController.Instance.objectsGrouped[objectInstrument.id] == true) { if (!objectInstrument.isTriggered) { objectInstrument.Trigger(); eventInstance.setParameterByName("Volume" + objectInstrument.instrument, 1f + (raiseVolumeWhenTriggered?0.5f:0f)); eventInstance.setParameterByName(objectInstrument.instrument, 5); // if this instrument is changed, we should try to change all other instruments } } else { if (objectInstrument.isTriggered) { objectInstrument.UnTrigger(); eventInstance.setParameterByName("Volume" + objectInstrument.instrument, objectInstrument.volume); eventInstance.setParameterByName(objectInstrument.instrument, objectInstrument.trackValue); } } } }
private void OnObjectRemoveReceive(List <ObjectInput> objects) { foreach (ObjectInput tableObject in objects) { ObjectInstrument objectInstrument = instrumentStates[tableObject.tagValue]; UpdateTrackValue(tableObject.tagValue, null); numberOfActiveObjects -= 1; } if (numberOfActiveObjects == 0) { eventInstance.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); } }
private void UpdateVolume() { for (int i = 0; i < trackVolumes.Length; i++) { if (trackVolumes[i] != prevTrackVolumes[i]) { Debug.Log("Updating track " + i); ObjectInstrument objectInstrument = instrumentStates[i]; objectInstrument.UpdateVolume(trackVolumes[i]); eventInstance.setParameterByName("Volume" + objectInstrument.instrument, trackVolumes[i]); prevTrackVolumes[i] = trackVolumes[i]; } } }