public void Initialize() { result = FMOD.Event_Factory.EventSystem_Create(ref eventsystem); ERRCHECK(result); result = eventsystem.init(64, FMOD.INITFLAGS.NORMAL, (IntPtr)null, FMOD.EVENT_INITFLAGS.NORMAL); ERRCHECK(result); ERRCHECK(eventsystem.setMediaPath("./Media/")); ERRCHECK(result); ERRCHECK(eventsystem.load("BulletRebound.fev")); ERRCHECK(result); result = eventsystem.getMusicSystem(ref musicsystem); ERRCHECK(result); result = musicsystem.setVolume(1.0f); ERRCHECK(result); result = musicsystem.setMute(false); ERRCHECK(result); result = musicsystem.setPaused(false); ERRCHECK(result); result = musicsystem.prepareCue(MUSICCUE_BULLETREBOUND_TITLESCREEN, ref cue_titleScreen); ERRCHECK(result); result = musicsystem.prepareCue(MUSICCUE_BULLETREBOUND_MAIN, ref cue_main); ERRCHECK(result); result = musicsystem.prepareCue(MUSICCUE_BULLETREBOUND_GAMEOVER, ref cue_gameOver); ERRCHECK(result); }
float _volume = 1.0f; // Główna głośność dźwięków i muzyki zmieniana przez Volume, wartości: <0, 1.0f> #endregion Fields #region Constructors public SoundManager() { Result = FMOD.Factory.System_Create(ref System); Result = System.init(4, FMOD.INITFLAGS.NORMAL, IntPtr.Zero); // 4 oznacza maksymalną ilość dźwięków naraz // 1-bgm, 2-odgłosy chodzenia, 3-dźwięki otoczenia, 4-głosy postaci. Może coś jeszcze? BGMPlaylist = new List<string>(); ChannelBGM = new FMOD.Channel(); ChannelDialog = new FMOD.Channel(); ChannelSound = new FMOD.Channel(); }
public static void StopSound(int channelID) { if (channelID < 0) { return; } FMOD.RESULT r1 = RuntimeManager.CoreSystem.getChannel(channelID, out FMOD.Channel channel); if (r1 == FMOD.RESULT.OK) { channel.stop(); channel.clearHandle(); } }
public void setReverbImmediate(FMOD.REVERB_PROPERTIES targetProps) { FMOD.RESULT result = FMOD.RESULT.OK; FMOD.EventSystem evtSystem = getEventSystem(); if (m_eventSystemWasInit == false) { init(); } result = evtSystem.setReverbProperties(ref targetProps); ERRCHECK(result); result = m_system.setReverbProperties(ref targetProps); ERRCHECK(result); }
private void SetPaused(bool paused) { if (!this.isDisposed) { lock (this.p_Lock) { FMOD.RESULT result = this.Channel.setPaused(paused); if (result != FMOD.RESULT.OK && result != FMOD.RESULT.ERR_INVALID_HANDLE) { throw new FMODException("Unable to pause the channel", result); } } } }
public void PlaySound(int soundId) { if (soundId >= 0 && soundId < NUM_SFX && SoundFX[soundId] != null) { FMOD.RESULT r = FMODSystem.playSound(SoundFX[soundId], null, false, out SoundChannel); //UpdateVolume(1.0f); SoundChannel.setMode(FMOD.MODE.LOOP_OFF); SoundChannel.setLoopCount(-1); Console.WriteLine("Playing sound " + soundId + ", got result " + r); m_iCurrentSongID = soundId; } }
public static void SetThreadAffinity(Action <FMOD.RESULT, string> reportResult) { FMOD.RESULT result = FMOD.Thread.SetAttributes(FMOD.THREAD_TYPE.MIXER, FMOD.THREAD_AFFINITY.CORE_2); reportResult(result, "FMOD.Thread.SetAttributes(Mixer)"); result = FMOD.Thread.SetAttributes(FMOD.THREAD_TYPE.STUDIO_UPDATE, FMOD.THREAD_AFFINITY.CORE_4); reportResult(result, "FMOD.Thread.SetAttributes(Update)"); result = FMOD.Thread.SetAttributes(FMOD.THREAD_TYPE.STUDIO_LOAD_BANK, FMOD.THREAD_AFFINITY.CORE_4); reportResult(result, "FMOD.Thread.SetAttributes(Load_Bank)"); result = FMOD.Thread.SetAttributes(FMOD.THREAD_TYPE.STUDIO_LOAD_SAMPLE, FMOD.THREAD_AFFINITY.CORE_4); reportResult(result, "FMOD.Thread.SetAttributes(Load_Sample)"); }
private bool InitErrorCheck(FMOD.RESULT result) { bool isInitialized = FMOD.ERROR.ERRCHECK(result); if (!isInitialized) { isInitialized = false; music = new Music(); sound = new Sound(); InfoLog.WriteInfo("No audio: " + FMOD.ERROR.String(result), EPrefix.AudioEngine); MessageBox.Show(FMOD.ERROR.String(result), "FMOD Error"); } return(isInitialized); }
public FmodMusicSystem getMusicSystem() { if (m_musicSystem == null) { if (m_eventSystem == null) { } FMOD.MusicSystem musicSystem = null; FMOD.RESULT result = m_eventSystem.getMusicSystem(ref musicSystem); ERRCHECK(result); m_musicSystem = new FmodMusicSystem(musicSystem); } return(m_musicSystem); }
public void loadMusicCue(FmodMusicCue cue) { if (m_musicSystem != null && !cue.isLoaded()) { FMOD.RESULT result = FMOD.RESULT.OK; FMOD.MusicPrompt prompt = new FMOD.MusicPrompt(); result = m_musicSystem.prepareCue((uint)cue.Id, ref prompt); if (result == FMOD.RESULT.OK) { cue.setMusicPrompt(prompt); } } }
FMOD.RESULT BeatEventCallback(FMOD.Studio.EVENT_CALLBACK_TYPE type, FMOD.Studio.EventInstance instance, IntPtr parameterPtr) { IntPtr timelineInfoPtr; FMOD.RESULT result = instance.getUserData(out timelineInfoPtr); if (result != FMOD.RESULT.OK) { Debug.LogError("Timeline Callback error: " + result); } else if (timelineInfoPtr != IntPtr.Zero) { GCHandle timelineHandle = GCHandle.FromIntPtr(timelineInfoPtr); TimelineInfo timelineInfo = (TimelineInfo)timelineHandle.Target; switch (type) { case FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT: { var parameter = (FMOD.Studio.TIMELINE_BEAT_PROPERTIES)Marshal.PtrToStructure(parameterPtr, typeof(FMOD.Studio.TIMELINE_BEAT_PROPERTIES)); timelineInfo.currentBeat = parameter.beat; timelineInfo.bpm = parameter.tempo; if (OnBeat != null) { OnBeat(); } } break; case FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER: { var parameter = (FMOD.Studio.TIMELINE_MARKER_PROPERTIES)Marshal.PtrToStructure(parameterPtr, typeof(FMOD.Studio.TIMELINE_MARKER_PROPERTIES)); if (OnMarker != null) { OnMarker(); } timelineInfo.lastMarker = parameter.name; timelineInfo.lastMarkerPosition = parameter.position / 1000f; } break; case FMOD.Studio.EVENT_CALLBACK_TYPE.STOPPED: { print("stopped"); } break; } } return(FMOD.RESULT.OK); }
public void CheckRetCode(FMOD.RESULT result) { if (result != FMOD.RESULT.OK) { if (result == FMOD.RESULT.ERR_INVALID_HANDLE) { log.WarnFormat("Invalid Sound Handle\n{0}", new StackTrace(true).ToString()); } else { log.ErrorFormat("FMOD result: {0}\n{1}", FMOD.Error.String(result), new StackTrace(true).ToString()); //throw new FMODException("Fmod error: ", result); } } }
public RESULT release() { IntPtr oldRaw = rawPtr; invalidateHandle(); // clear callback before releasing FMOD.RESULT result = FMOD_Studio_EventInstance_Release(oldRaw); if (result == FMOD.RESULT.ERR_EVENT_WONT_STOP) { setRaw(oldRaw); } return(result); }
private void CheckChannel() { bool p = false; FMOD.RESULT result = mChannel.isPlaying(ref p); if (result == FMOD.RESULT.ERR_INVALID_HANDLE || p == false) { CreateChannel(); } else { FMOD_Audio.CheckFMODResult(result); } }
protected virtual void OnDisable() { this.Stop(); if (system != null && !this.unstableShutdown) { result = system.close(); // ERRCHECK(result, "system.close", false); result = system.release(); // ERRCHECK(result, "system.release", false); } system = null; }
public void Initialize() { if (system == null) { result = FMOD.Factory.System_Create(out system); result = system.init(512, FMOD.INITFLAGS.NORMAL, IntPtr.Zero); } PlayList = new List <string>(); ChannelGroup = new FMOD.ChannelGroup(IntPtr.Zero); Channel = new FMOD.Channel(IntPtr.Zero); spectrum = new float[512]; previousSpectrum = spectrum; EnableFFT(); }
//FMOD Error checking from return codes void ERRCHECK(FMOD.RESULT result) { if (result == FMOD.RESULT.ERR_INVALID_HANDLE) { Debug.LogError("FMOD_Unity: Event error: " + result + ": have you set the MaxCallback on the event '" + m_source.getName() + "' high enough ? (original FMOD message : " + FMOD.Error.String(result) + ")"); cleanInvalidHandle(); } else if (result != FMOD.RESULT.OK) { Debug.LogError("FMOD_Unity: Event error: " + result + " - " + FMOD.Error.String(result)); } }
void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } if (string.IsNullOrEmpty(pauseMenuSnaphot)) { Debug.LogError("Pause menu snapshot is null or empty"); return; } FMOD.RESULT result = FMODUnity.RuntimeManager.StudioSystem.getEvent(pauseMenuSnaphot, out eventDescription); if (result != FMOD.RESULT.OK) { Debug.LogError("Path for pause menu snapshot is not valid. Fmod error: " + result); return; } for (int i = 0; i < bussesToPause.Count; i++) { string busPath = bussesToPause[i]; if (!string.IsNullOrEmpty(busPath)) { Bus bus; result = FMODUnity.RuntimeManager.StudioSystem.getBus(busPath, out bus); if (result == FMOD.RESULT.OK) { _bussesToPause.Add(bus); } else { Debug.LogError("Bus path '" + busPath + "' is invalid. Fmod error: " + result); } } } initializationSuccesfull = true; }
IEnumerator Start() { this.gameObjectName = this.gameObject.name; // setup the AudioSource var audiosrc = this.GetComponent <AudioSource>(); audiosrc.playOnAwake = false; audiosrc.Stop(); audiosrc.clip = null; /* * Create a System object and initialize. */ result = FMOD.Factory.System_Create(out system); ERRCHECK(result, "Factory.System_Create"); result = system.getVersion(out version); ERRCHECK(result, "system.getVersion"); if (version < FMOD.VERSION.number) { var msg = string.Format("FMOD lib version {0} doesn't match header version {1}", version, FMOD.VERSION.number); if (this.OnError != null) { this.OnError.Invoke(this.gameObjectName, msg); } throw new System.Exception(msg); } /* * System initialization */ result = system.init(100, FMOD.INITFLAGS.NORMAL, System.IntPtr.Zero); ERRCHECK(result, "system.init"); // wait for FMDO to catch up and pause - recordDrivers are not populated if called immediately [e.g. from Start] yield return(new WaitForSeconds(1f)); if (this.recordOnStart) { StartCoroutine(this.Record()); } this.ready = true; }
private void SetThreadAffinity() { #if (UNITY_PS4 || UNITY_XBOXONE) && !UNITY_EDITOR FMOD.RESULT result = FMOD.Thread.SetAttributes(FMOD.THREAD_TYPE.MIXER, FMOD.THREAD_AFFINITY.CORE_2); CheckInitResult(result, "FMOD.Thread.SetAttributes(Mixer)"); result = FMOD.Thread.SetAttributes(FMOD.THREAD_TYPE.STUDIO_UPDATE, FMOD.THREAD_AFFINITY.CORE_4); CheckInitResult(result, "FMOD.Thread.SetAttributes(Update)"); result = FMOD.Thread.SetAttributes(FMOD.THREAD_TYPE.STUDIO_LOAD_BANK, FMOD.THREAD_AFFINITY.CORE_4); CheckInitResult(result, "FMOD.Thread.SetAttributes(Load_Bank)"); result = FMOD.Thread.SetAttributes(FMOD.THREAD_TYPE.STUDIO_LOAD_SAMPLE, FMOD.THREAD_AFFINITY.CORE_4); CheckInitResult(result, "FMOD.Thread.SetAttributes(Load_Sample)"); #endif }
private bool ERRCHECK(FMOD.RESULT result, string function, bool release = true) { if (result != FMOD.RESULT.OK) { if (release) { FMODrelease(); } Report.ReportLog("FMOD error! function=" + function + " returned=" + result + " - " + FMOD.Error.String(result)); return(true); } else { return(false); } }
public static int GetLengthOfSoundfile(string filename) { FMOD.Sound sound = null; FMOD.RESULT res = SoundEngine.Instance.system.createStream(filename, FMOD.MODE.OPENONLY, ref sound); uint length = 0; if (sound != null) { sound.getLength(ref length, FMOD.TIMEUNIT.MS); sound.release(); return((int)length); } return(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); }
public void updateSystem(bool force3DSet) { FMOD.RESULT result = FMOD.RESULT.OK; if (m_eventSystem != null && m_eventSystemWasInit) { if (getAudioListener() != null && (force3DSet || (Time.timeSinceLevelLoad - m_previousListenerUpdateTime) > 0.001f)) { FMOD.VECTOR pos = new FMOD.VECTOR(); FMOD.VECTOR vel = new FMOD.VECTOR(); FMOD.VECTOR forward = new FMOD.VECTOR(); FMOD.VECTOR up = new FMOD.VECTOR(); pos.x = m_audioListener.transform.position.x; pos.y = m_audioListener.transform.position.y; pos.z = m_audioListener.transform.position.z; if (Time.timeSinceLevelLoad - m_previousListenerUpdateTime > 0) { vel.x = (pos.x - m_previousListenerPos.x) / (Time.timeSinceLevelLoad - m_previousListenerUpdateTime); vel.y = (pos.y - m_previousListenerPos.y) / (Time.timeSinceLevelLoad - m_previousListenerUpdateTime); vel.z = (pos.z - m_previousListenerPos.z) / (Time.timeSinceLevelLoad - m_previousListenerUpdateTime); } forward.x = m_audioListener.transform.forward.x; forward.y = m_audioListener.transform.forward.y; forward.z = m_audioListener.transform.forward.z; up.x = m_audioListener.transform.up.x; up.y = m_audioListener.transform.up.y; up.z = m_audioListener.transform.up.z; result = m_eventSystem.set3DListenerAttributes(0, ref pos, ref vel, ref forward, ref up); ERRCHECK(result); result = m_system.set3DListenerAttributes(0, ref pos, ref vel, ref forward, ref up); ERRCHECK(result); m_previousListenerPos = m_audioListener.transform.position; // m_previousListenerForward = m_audioListener.transform.forward; // m_previousListenerUp = m_audioListener.transform.up; m_previousListenerUpdateTime = Time.timeSinceLevelLoad; } result = m_eventSystem.update(); ERRCHECK(result); result = m_system.update(); ERRCHECK(result); } }
private bool GetIsPlaying() { bool ret = false; if (!this.isDisposed) { lock (this.p_Lock) { FMOD.RESULT result = this.Channel.isPlaying(ref ret); if (result != FMOD.RESULT.OK) { throw new FMODException("Unable to get state", result); } } } return(ret); }
private uint GetLength() { uint length = 0; if (!this.isDisposed) { lock (this.p_Lock) { FMOD.RESULT result = this.sound.getLength(ref length, FMOD.TIMEUNIT.MS); if (result != FMOD.RESULT.OK) { throw new FMODException("Unable to get sound length", result); } } } return(length); }
private bool PlaySound(FMOD.Sound sound) { try { FMOD.Channel channel = null; FMOD.RESULT result = system.playSound(FMOD.CHANNELINDEX.FREE, sound, true, ref channel); if (result == FMOD.RESULT.OK && channel != null) { channel.setVolume(volume); channel.setPaused(false); } return(FMOD.ERROR.ERRCHECK(result)); } catch { return(false); } }
void loadBank(string fileName) { string bankPath = getStreamingAsset(fileName); FMOD.Studio.Bank bank = null; FMOD.RESULT result = FMOD_StudioSystem.instance.System.loadBankFile(bankPath, LOAD_BANK_FLAGS.NORMAL, out bank); if (result == FMOD.RESULT.ERR_VERSION) { FMOD.Studio.UnityUtil.LogError(String.Format("Bank {0} built with an incompatible version of FMOD Studio.", fileName)); } else if (result != FMOD.RESULT.OK) { FMOD.Studio.UnityUtil.LogError(String.Format("Bank {0} encountered a loading error {1}", fileName, result.ToString())); } FMOD.Studio.UnityUtil.Log("bank load: " + (bank != null ? "suceeded" : "failed!!")); }
// ======================================================================================================================================== #region User support /// <summary> /// Enumerates available audio inputs in the system and returns their names. /// </summary> /// <returns></returns> public List <string> AvailableInputs() { List <string> availableDriversNames = new List <string>(); /* * Enumerate record devices */ int numAllDrivers = 0; int numConnectedDrivers = 0; result = system.getRecordNumDrivers(out numAllDrivers, out numConnectedDrivers); ERRCHECK(result, "system.getRecordNumDrivers"); for (int i = 0; i < numConnectedDrivers; ++i) { int recChannels = 0; int recRate = 0; int namelen = 255; System.Text.StringBuilder name = new System.Text.StringBuilder(namelen); System.Guid guid; FMOD.SPEAKERMODE speakermode; FMOD.DRIVER_STATE driverstate; result = system.getRecordDriverInfo(i, name, namelen, out guid, out recRate, out speakermode, out recChannels, out driverstate); ERRCHECK(result, "system.getRecordDriverInfo"); var description = string.Format("{0} rate: {1} speaker mode: {2} channels: {3}", name, recRate, speakermode, recChannels); availableDriversNames.Add(description); LOG(LogLevel.DEBUG, "{0}{1}guid: {2}{3}systemrate: {4}{5}speaker mode: {6}{7}channels: {8}{9}state: {10}" , name , System.Environment.NewLine , guid , System.Environment.NewLine , recRate , System.Environment.NewLine , speakermode , System.Environment.NewLine , recChannels , System.Environment.NewLine , driverstate ); } return(availableDriversNames); }
void Update() { timer += Time.deltaTime; scoreCurr = ScoreManager.score; ScoreValue = scoreCurr / ScoreDelta; FMOD.RESULT res = SND_Reload.getPlaybackState(out _state); if (Input.GetButton("Fire1") && timer >= timeBetweenBullets && Time.timeScale != 0 && res == FMOD.RESULT.OK && _state != PLAYBACK_STATE.PLAYING) { Shoot(); } if (timer >= timeBetweenBullets * effectsDisplayTime) { DisableEffects(); } }
void Init() { FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: Initialize"); if (isInitialized) { return; } DontDestroyOnLoad(gameObject); FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: System_Create"); ERRCHECK(FMOD.Studio.System.create(out system)); FMOD.Studio.INITFLAGS flags = FMOD.Studio.INITFLAGS.NORMAL; #if FMOD_LIVEUPDATE flags |= FMOD.Studio.INITFLAGS.LIVEUPDATE; #endif FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: system.init"); FMOD.RESULT result = FMOD.RESULT.OK; result = system.initialize(1024, flags, FMOD.INITFLAGS.NORMAL, global::System.IntPtr.Zero); if (result == FMOD.RESULT.ERR_NET_SOCKET_ERROR) { #if false && FMOD_LIVEUPDATE FMOD.Studio.UnityUtil.LogWarning("LiveUpdate disabled: socket in already in use"); flags &= ~FMOD.Studio.INITFLAGS.LIVEUPDATE; result = system.init(1024, flags, FMOD.INITFLAGS.NORMAL, (System.IntPtr)null); #else FMOD.Studio.UnityUtil.LogError("Unable to initalize with LiveUpdate: socket is already in use"); #endif } else if (result == FMOD.RESULT.ERR_HEADER_MISMATCH) { FMOD.Studio.UnityUtil.LogError("Version mismatch between C# script and FMOD binary, restart Unity and reimport the integration package to resolve this issue."); } else { ERRCHECK(result); } isInitialized = true; }
private FMOD.RESULT _loadEvent(FmodEvent evt, ref FMOD.Event fmodEvent) { string guidString = evt.getGUIDString(); FMOD.RESULT result = FMOD.RESULT.OK; if (guidString != FmodEvent.EMPTY_GUIDSTRING) { result = getEventSystem().getEventByGUIDString(guidString, FMOD.EVENT_MODE.DEFAULT | FMOD.EVENT_MODE.ERROR_ON_DISKACCESS, ref fmodEvent); } else { string fullName = evt.getFullName(); result = getEventSystem().getEvent(fullName, FMOD.EVENT_MODE.DEFAULT | FMOD.EVENT_MODE.ERROR_ON_DISKACCESS, ref fmodEvent); } return(result); }
public FMODException(string msg, FMOD.RESULT errcode) : base(msg) { this.errcode = errcode; }
public void StopDialog() { Result = ChannelDialog.stop(); }
public BankLoadException(string path, string error) : base(String.Format("FMOD Studio could not load bank '{0}' : ", path, error)) { Path = path; Result = FMOD.RESULT.ERR_INTERNAL; }
private void timer1_Tick(object sender, System.EventArgs e) { if (!initialised) { ERRCHECK(result = FMOD.Event_Factory.EventSystem_Create(ref eventsystem)); ERRCHECK(result = eventsystem.init(64, FMOD.INITFLAGS.NORMAL, (IntPtr)null, FMOD.EVENT_INITFLAGS.NORMAL)); ERRCHECK(result = eventsystem.setMediaPath("../../../../examples/media/")); ERRCHECK(result = eventsystem.load("examples.fev")); ERRCHECK(result = eventsystem.getEvent("examples/FeatureDemonstration/Basics/SimpleEvent", FMOD.EVENT_MODE.DEFAULT, ref evt)); initialised = true; } /* "Main Loop" */ ERRCHECK(result = eventsystem.update()); if (eventstart) { ERRCHECK(evt.start()); } /* Clean up and exit */ if (exit) { ERRCHECK(result = eventsystem.release()); Application.Exit(); } }
public void PlaySound(string path) { if (path != null) { string play; play = "Media/Sounds/" + path; Result = System.createStream(play, FMOD.MODE.DEFAULT, ref SoundSound); Result = System.playSound(FMOD.CHANNELINDEX.REUSE, SoundSound, false, ref ChannelSound); Volume = _volume; } }
public void PlayDialog(string path) { if (path != null) { string play; play = "Media/Sounds/Dialogs/" + path; LastDialog = play; Result = System.createStream(play, FMOD.MODE.DEFAULT, ref SoundDialog); Result = System.playSound(FMOD.CHANNELINDEX.REUSE, SoundDialog, false, ref ChannelDialog); Volume = _volume; } else { Result = ChannelDialog.setPaused(false); } }
public void StopBGM() { IsBGMPlaying = false; Result = ChannelBGM.stop(); }
public void TogglePauseBGM() { if (IsBGMPlaying) IsBGMPlaying = false; else IsBGMPlaying = true; Result = ChannelBGM.setPaused(!IsBGMPlaying); Volume = _volume; }
private bool InitAudioEngine() { uint version = 0; FMOD.RESULT result ; try { result = FMOD.Factory.System_Create(ref _fmodEngine); if (ERRCHECK(result)) return false; } catch (DllNotFoundException) { errResult = FMOD.RESULT.ERR_PLUGIN_MISSING; errMsg = "fmodex.dll not found"; return false; } result = _fmodEngine.getVersion(ref version); if (ERRCHECK(result)) return false; if (version < FMOD.VERSION.number) { errMsg += "You are using an old version of FMOD " + version.ToString("X") + ". This program requires " + FMOD.VERSION.number.ToString("X") + "."; return false; } // init the FMOD engine result = _fmodEngine.init(32, FMOD.INITFLAGS.NORMAL, (IntPtr)null); if (ERRCHECK(result)) return false; return true; }
internal bool ERRCHECK(FMOD.RESULT result) { if (result != FMOD.RESULT.OK) { errResult = result; errMsg += "FMOD ERR: " + result + " - " + FMOD.Error.String(result) + ". "; return true; } return false; }
private void timer1_Tick(object sender, System.EventArgs e) { if (!initialised) { ERRCHECK(result = FMOD.Event_Factory.EventSystem_Create(ref eventsystem)); ERRCHECK(result = eventsystem.init(64, FMOD.INITFLAGS.NORMAL, (IntPtr)null, FMOD.EVENT_INITFLAGS.NORMAL)); ERRCHECK(result = eventsystem.setMediaPath("../../../../examples/media/")); ERRCHECK(result = eventsystem.load("examples.fev")); ERRCHECK(result = eventsystem.getGroup("examples/AdvancedTechniques", false, ref eventgroup)); ERRCHECK(result = eventgroup.getEvent("car", FMOD.EVENT_MODE.DEFAULT, ref car)); ERRCHECK(result = eventsystem.getCategory("master", ref mastercategory)); ERRCHECK(result = car.getParameter("load", ref load)); ERRCHECK(result = load.getRange(ref load_min, ref load_max)); ERRCHECK(result = load.setValue(load_max)); ERRCHECK(result = car.getParameterByIndex(0, ref rpm)); ERRCHECK(result = rpm.getRange(ref rpm_min, ref rpm_max)); ERRCHECK(result = rpm.setValue(1000.0f)); trackBarRPM.Minimum = (int)rpm_min; trackBarRPM.Maximum = (int)rpm_max; trackBarLoad.Minimum = (int)load_min; trackBarLoad.Maximum = (int)load_max; trackBarRPM.Value = 1000; trackBarLoad.Value = (int)load_max; ERRCHECK(result = car.start()); initialised = true; } /* "Main Loop" */ if (trackbarscroll) { ERRCHECK(result = rpm.setValue((float)trackBarRPM.Value)); ERRCHECK(result = load.setValue((float)trackBarLoad.Value)); trackbarscroll = false; } float rpmvalue = 0.0f; ERRCHECK(result = rpm.getValue(ref rpmvalue)); statusBar.Text = "RPM Value = " + rpmvalue; ERRCHECK(result = eventsystem.update()); /* Clean up and exit */ if (exit) { ERRCHECK(result = eventgroup.freeEventData()); ERRCHECK(result = eventsystem.release()); Application.Exit(); } }
public BankLoadException(string path, FMOD.RESULT result) : base(String.Format("FMOD Studio could not load bank '{0}' : {1} : {2}", path, result.ToString(), FMOD.Error.String(result))) { Path = path; Result = result; }
public void PauseDialog() { Result = ChannelDialog.setPaused(true); }
public SystemNotInitializedException(FMOD.RESULT result, string location) : base(String.Format("FMOD Studio initialization failed : {2} : {0} : {1}", result.ToString(), FMOD.Error.String(result), location)) { Result = result; Location = location; }
public void PlayBGM(string path = null) { string play; if (path == null) { path = BGMPlaylist[BGMId]; } play = "Media/Music/" + path; Result = System.createStream(play, FMOD.MODE.DEFAULT, ref SoundBGM); Result = System.playSound(0, SoundBGM, false, ref ChannelBGM); IsBGMPlaying = true; Volume = _volume; }