void Start() { myAnimation = GetComponent <Animator>(); beatCallback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallback); musicInstance = FMODUnity.RuntimeManager.CreateInstance("event:/INTRO"); musicInstance.setCallback(beatCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER); }
void Start() { markerOnEvent = new UnityEvent(); barEvent = new UnityEvent(); markerOnEvent.AddListener(fireNote); instance = this; marker = ""; //FMOD shit timelineInfo = new TimelineInfo(); // Explicitly create the delegate object and assign it to a member so it doesn't get freed // by the garbage collected while it's being used beatCallback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallback); musicInstance = FMODUnity.RuntimeManager.CreateInstance(LevelStateEvent); // Pin the class that will store the data modified during the callback timelineHandle = GCHandle.Alloc(timelineInfo, GCHandleType.Pinned); // Pass the object through the userdata of the instance musicInstance.setUserData(GCHandle.ToIntPtr(timelineHandle)); musicInstance.setCallback(beatCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER); //Debug.Log("CALLBACK"); musicInstance.start(); //missInstance = FMODUnity.RuntimeManager.CreateInstance("event:/NoteMiss"); // }
void Start() { // Explicitly create the delegate object and assign it to a // member so it doesn't get freed by the garbage collected // while it's being used dialogueCallback = new FMOD.Studio.EVENT_CALLBACK(DialogueEventCallback); }
public FMODSyncEvent(string eventPath) { eventInstance = FMODUnity.RuntimeManager.CreateInstance(eventPath); eventCallback = new FMOD.Studio.EVENT_CALLBACK(StudioEventCallback); eventInstance.setCallback(eventCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT); eventInstance.start(); }
void Start() { instance = FMODUnity.RuntimeManager.CreateInstance(drums); cb = new FMOD.Studio.EVENT_CALLBACK(StudioEventCallback); instance.setCallback(cb, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT); instance.start(); }
public void AssignBeatEvent(FMOD.Studio.EventInstance instance) { timelineInfo = new TimelineInfo(); timelineHandle = GCHandle.Alloc(timelineInfo, GCHandleType.Pinned); beatCallback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallback); instance.setUserData(GCHandle.ToIntPtr(timelineHandle)); instance.setCallback(beatCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER); }
void Start() { _soundContainer = SoundContainer.Instance; _soundSource = _soundContainer.GetComponent <AudioSource>(); _enemyGameManager = EnemyGameManager.Instance; _languageManager = LanguageManager.Instance; _hudCanvas = GameObject.FindWithTag("HUD").GetComponent <PopUpManager>(); _player = GameObject.FindWithTag("Player"); dialogueCallback = DialogueEventCallback; StartCoroutine(Cooldown()); }
private void Start() { camera = GetComponent <Camera>(); beatCallback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallback); eventInstance = FMODUnity.RuntimeManager.CreateInstance(eventName); eventInstance.setCallback(beatCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER); eventInstance.start(); }
// Start is called before the first frame update void Start() { //portal.SetActive(false); _soundContainer = SoundContainer.Instance; _soundSource = _soundContainer.GetComponent <AudioSource>(); _languageManager = LanguageManager.Instance; _hudCanvas = GameObject.FindWithTag("HUD").GetComponent <PopUpManager>(); dialogueCallback = DialogueEventCallback; Invoke("EstellaAppears", 2); }
// Start is called before the first frame update public override void OnStart() { timelineInfo = new TimelineInfo(); beatCallback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallback); // Pin the class that will store the data modified during the callback timelineHandle = GCHandle.Alloc(timelineInfo, GCHandleType.Pinned); if (startMusicOnAwake) { StartCoroutine(DelayedMusicStart()); } }
// Start is called before the first frame update void Start() { secondPuzzleLayerTriggerScript = secondPuzzleLayerTriggerObject.GetComponent <TriggerPostSecondPuzzleLayers>(); postBathroomMusic = secondPuzzleLayerTriggerScript.PostBathroomMusic; //postBathroomMusic = SceneManagement.PostBathroomMusic; callback = new FMOD.Studio.EVENT_CALLBACK(CallBackTriggered); postBathroomMusic.setCallback(callback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER); //audioTrack.EventInstance.setCallback(callback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER); mausoleumShakeAnimation = mausoleum.GetComponent <Animator>(); flickerScript = ghostLight.GetComponent <Flicker>(); }
private void Awake() { _instance = this; //本地加载 _soundDictionary = new Dictionary <string, AudioClip>(); AudioClip[] audioArray = Resources.LoadAll <AudioClip>("Audio/SE"); audioSources = GetComponents <AudioSource>(); audioSourceEffect = audioSources[1]; audioSourceBgMusic = audioSources[0]; audioSourceEffect_Z = audioSources[2]; audioSourceEffect_X = audioSources[3]; audioSourceEffect_M = audioSources[4]; //存放到字典 foreach (AudioClip item in audioArray) { _soundDictionary.Add(item.name, item); } audioSourceEffect_Z.clip = _soundDictionary["Bassdrum"]; audioSourceEffect_X.clip = _soundDictionary["Snare"]; audioSourceEffect_M.clip = _soundDictionary["Hihat"]; //fmod init samplerate = 44100; // RuntimeManager.LowlevelSystem.getSoftwareFormat(out samplerate,out sPEAKERMODE,out rawspeaker); //fmod callback相关 timelineInfo = new TimelineInfo(); // Explicitly create the delegate object and assign it to a member so it doesn't get freed // by the garbage collected while it's being used beatCallback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallback); // Pin the class that will store the data modified during the callback timelineHandle = GCHandle.Alloc(timelineInfo, GCHandleType.Pinned); // Pass the object through the userdata of the instance //callback }
public void PlayMusic() { EventDescription = RuntimeManager.GetEventDescription(Event); //this assigns the EventDescription from the Event string variable that we set in the editor EventDescription.createInstance(out EventInstance); //this creates an EventInstance from the EventDescription EventInstance.start(); //this starts the event FMOD.Studio.EVENT_CALLBACK callback; //special type of variable defined by FMOD.studio called EVENT_CALLBACK callback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallBack); //pointer to the function that we're going to callback which is MusicEventCallBack EventInstance.setCallback(callback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT); // sets a callback on the event that is created with the flag to call this on every Timeline beat FMOD.Studio.PARAMETER_DESCRIPTION distanceToClue_fmodParam; EventDescription.getParameter("DistanceToClue", out distanceToClue_fmodParam); maxClueDistance = distanceToClue_fmodParam.maximum; // sets maxClueDistance to the maximum value of the game parameter in the fmod parameter (30) print("Max Distance to Clue = " + maxClueDistance); }
void Start() { EventManager.StartListening("OnBeatZagal", zagal.GetComponent <ZagalBehaviour>().Beat); EventManager.StartListening("OnBeatPlayer", player.GetComponent <PlayerBehaviour>().Beat); currentBeat = 0 - startBeatOffset; BeatDuration = Time.time; beatCallback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallback); musicInstance = FMODUnity.RuntimeManager.CreateInstance("event:/MUSIC"); musicInstance.setCallback(beatCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER); musicInstance.start(); }
// Use this for initialization void Start () { musicEv = FMODUnity.RuntimeManager.CreateInstance (Catalogue.getMusic()); musicEv.getParameter (enemyCount, out enemyCountPa); musicEv.getParameter (speed, out speedPa); musicEv.getParameter (state, out statePa); previousFrameTime = Time.time; lastReportedPlayPosition = 0; musicEv.start (); enemyCountChange (3); statePa.setValue (1); speedPa.setValue (3); beatExecutor = GetComponent<BeatExecutor> (); cb = new FMOD.Studio.EVENT_CALLBACK(onBeatWrapper); musicEv.setCallback (cb, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER); }
// Start is called before the first frame update void Start() { timelineInfo = new TimelineInfo(); // Explicitly create the delegate object and assign it to a member so it doesn't get freed // by the garbage collected while it's being used beatCallback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallback); musicEvent = FMODUnity.RuntimeManager.CreateInstance(musicPath); // Pin the class that will store the data modified during the callback timelineHandle = GCHandle.Alloc(timelineInfo, GCHandleType.Pinned); // Pass the object through the userdata of the instance musicEvent.setUserData(GCHandle.ToIntPtr(timelineHandle)); musicEvent.setCallback(beatCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER); musicEvent.start(); gm = GameObject.Find("GameManager").GetComponent <GameManager>(); }
/// <summary> /// Plays the passed in fmod event as a one shot event, meaning it is set to release the event automatically as soon as it stops playing. /// This allows for instanced fmod events without letting them infinitely build up. /// </summary> /// <param name="fmodEvent"> The name of the event we want to play as a one shot event </param> /// <param name="volume"> The volume of the event we want to play as a one shot event </param> /// <param name="paramData"> An array of param data that should be passed to our fmod event before playing it </param> public void PlayOneShotFmodEvent(FMOD.Studio.EventInstance fmodEvent, float volume = 1.0f, FmodParamData[] paramData = null) { if (paramData != null) { for (int i = 0; i < paramData.Length; i++) { SetFmodParameterValue(fmodEvent, paramData[i].paramName, paramData[i].paramValue); } } fmodEvent.setVolume(volume); if (debugOneShotEvents) { Debug.Log("1. START ONE SHOT EVENT"); FMOD.Studio.EVENT_CALLBACK stoppedOneShotEventCallback; stoppedOneShotEventCallback = new FMOD.Studio.EVENT_CALLBACK(StoppedOneShotEventCallback); fmodEvent.setCallback(stoppedOneShotEventCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.STOPPED); } fmodEvent.start(); fmodEvent.release(); }
//THE SINGLETON HAS APPEARED: This allows for everything to access this SINGLE INSTANCE of the script and access its variables //The drawback is that if this script ever gets destroyed, it's gonna mean everything that relies on the information provided //by this script is gonna break. //public static FMODVibeTracker vt; /* * void Awake() * { * vt = this; * } */ // Start is called before the first frame update void Start() { timelineInfo = new TimelineInfo(); //Explicitly create the delegate object and assign it to a member so it doesn't get freed //by the garbage collected while it's being used beatCallback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallback); musicInstance = FMODUnity.RuntimeManager.CreateInstance(music); //Pin the class that will store the data modified during the callback timelineHandle = GCHandle.Alloc(timelineInfo, GCHandleType.Pinned); //Pass the object through the userdata of the instance musicInstance.setUserData(GCHandle.ToIntPtr(timelineHandle)); musicInstance.setCallback(beatCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER); musicInstance.start(); musicInstance.getDescription(out descriptionCallback); descriptionCallback.getLength(out int length); timelineInfo.songLength = length; }
public AudioEventFXInstance(Transform transform, string path) { this.transform = transform; this.path = path; this.callback = OnEventInstanceStopped; stackPtr = GCHandle.ToIntPtr(GCHandle.Alloc(stoppedInstances)); AddInstance(); FMOD.Studio.EventDescription description; int count; instances[0].getDescription(out description); description.getParameterDescriptionCount(out count); for (int i = 0; i < count; i++) { FMOD.Studio.PARAMETER_DESCRIPTION paramDescription; description.getParameterDescriptionByIndex(i, out paramDescription); parameters.Add(paramDescription.name, new Parameter(paramDescription.id, paramDescription.defaultvalue)); Debug.Log(paramDescription.name); } }
public bool Initialize(VoiceoverManager manager) { if (manager == null) { return(false); } else { voiceoverManager = manager; } if (!string.IsNullOrEmpty(masterVoiceoverEvent)) { eventDescription = FMODUnity.RuntimeManager.GetEventDescription(masterVoiceoverEvent); if (eventDescription.isValid()) { eventDescription.is3D(out is3D); eventDescription.getMaximumDistance(out maxDistance); } else { Debug.LogError("The master voiceover event is invalid for '" + speaker.ToString() + "'."); return(false); } } else { Debug.LogError("The master voiceover event is missing for '" + speaker.ToString() + "'."); return(false); } voiceoverCallback = new FMOD.Studio.EVENT_CALLBACK(VoiceEventCallback); initializationSuccesfull = true; return(true); }
/// <summary> /// Assigns a user callback for every subsequent instance of this event. /// </summary> public void SetCallback(FMOD.Studio.EVENT_CALLBACK callback, FMOD.Studio.EVENT_CALLBACK_TYPE callbackMask) => Native.setCallback(callback, callbackMask);
// Use this for initialization void Start() { //distToGround = GetComponent<Collider> ().bounds.size.y - GetComponent<Collider>(); //start music Track4Event = FMODUnity.RuntimeManager.CreateInstance(track4); Track4Event.start(); Track1Event = FMODUnity.RuntimeManager.CreateInstance(drums); cb = new FMOD.Studio.EVENT_CALLBACK(StudioEventCallback); Track1Event.setCallback(cb, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT); Track1Event.start(); Track2Event = FMODUnity.RuntimeManager.CreateInstance(chords); Track2Event.start(); Track3Event = FMODUnity.RuntimeManager.CreateInstance(track3); Track3Event.start(); myOneShot = FMODUnity.RuntimeManager.CreateInstance(oneShot); //setup parameters /*Track1Event.getParameter("Track1Vol", out track1VolParam); track1VolParam.setValue (0); Track2Event.getParameter("Track1Vol", out track2VolParam); track2VolParam.setValue (0); Track3Event.getParameter("Track1Vol", out track3VolParam); track3VolParam.setValue (0); Track4Event.getParameter("Track1Vol", out track4VolParam); track4VolParam.setValue (0); soundSystem.getParameter("Track5Vol", out track5VolParam); track5VolParam.setValue (0); soundSystem.getParameter("Track6Vol", out track6VolParam); track6VolParam.setValue (0); soundSystem.getParameter("Track7Vol", out track7VolParam); track7VolParam.setValue (0); soundSystem.getParameter("Track8Vol", out track8VolParam); track8VolParam.setValue (0); soundSystem.getParameter("Track9Vol", out track9VolParam); track9VolParam.setValue (0);*/ beatOn = false; }
// Use this for initialization void Start() { //distToGround = GetComponent<Collider> ().bounds.size.y - GetComponent<Collider>(); //start music Track4Event = FMODUnity.RuntimeManager.CreateInstance(track4); //Track4Event.start(); Track1Event = FMODUnity.RuntimeManager.CreateInstance(drums); cb = new FMOD.Studio.EVENT_CALLBACK(StudioEventCallback); Track1Event.setCallback(cb, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT); //Track1Event.start(); Track2Event = FMODUnity.RuntimeManager.CreateInstance(chords); //Track2Event.start(); Track3Event = FMODUnity.RuntimeManager.CreateInstance(track3); //Track3Event.start(); myOneShot = FMODUnity.RuntimeManager.CreateInstance(BreatheIn1); beatOn = false; }