public void ShutDown() { if (!Enabled) { return; } if (musicChannel != null) { musicChannel.Stop(); } if (music != null) { music.Release(); } if (sounds != null) { foreach (var s in sounds.Values) { s.Channel.Stop(); s.InnerSound.Release(); } } system.Close(); system = null; }
/// <summary> /// Stop and try to release FMOD sound resources /// </summary> void Stop_Internal() { this.GetComponent <AudioSource>().Stop(); this.isRecording = false; this.isPaused = false; /* * Shut down sound */ if (sound != null) { result = sound.release(); ERRCHECK(result, "sound.release", false); } sound = null; /* * Shut down */ if (system != null) { result = system.close(); ERRCHECK(result, "system.close", false); result = system.release(); ERRCHECK(result, "system.release", false); } system = null; }
public static void StaticLoadPlugins(List <string> pluginNames, FMOD.System coreSystem, Dictionary <string, uint> loadedPlugins, Action <FMOD.RESULT, string> reportResult) { #if USE_FMOD_NATIVE_PLUGIN_INIT FmodUnityNativePluginInit(coreSystem.handle); #endif }
public static FMOD.RESULT createSound(this FMOD.System system, IntPtr data, FMOD.MODE mode, ref FMOD.CREATESOUNDEXINFO exinfo, ref FMOD.Sound sound) { FMOD.RESULT result = FMOD.RESULT.OK; IntPtr soundraw = new IntPtr(); FMOD.Sound soundnew = null; try { result = FMOD_System_CreateSound(system.getRaw(), data, mode, ref exinfo, ref soundraw); } catch { result = FMOD.RESULT.ERR_INVALID_PARAM; } if (result != FMOD.RESULT.OK) { return(result); } if (sound == null) { soundnew = new FMOD.Sound(); soundnew.setRaw(soundraw); sound = soundnew; } else { sound.setRaw(soundraw); } return(result); }
public SoundSystem() { var ret = FMOD.Result.OK; system = null; try { FMOD.Factory.CreateSystem(ref system); } catch (DllNotFoundException) { return; } if (ret != FMOD.Result.OK) { return; } ret = system.Initialize(8, FMOD.InitFlags.Normal, IntPtr.Zero); if (ret != FMOD.Result.OK) { system = null; return; } sounds = new Dictionary <string, Sound>(); music = null; musicChannel = null; }
public static Equalizer GetEqualizer(FMOD.System system, PlayerSettings settings) { var eq = new Equalizer(system, settings); eq.Initializied = true; return(eq); }
public SoundOut(FMOD.System newsys) { system = newsys; thisLock = new Object(); readySound = new SoundProvider(this.system); soundDataBuffer = new CircularBuffer(frequency * soundDataBufferTime * channelCount); }
public RESULT getLowLevelSystem(out FMOD.System system) { RESULT result = RESULT.OK; IntPtr systemraw = new IntPtr(); system = null; try { result = FMOD_Studio_System_GetLowLevelSystem(rawPtr, out systemraw); } catch { result = RESULT.ERR_INVALID_PARAM; } if (result != RESULT.OK) { return(result); } system = new FMOD.System(); system.setRaw(systemraw); return(result); }
public SoundLib() { if (system != null) { return; } FMOD.RESULT result = FMOD.Factory.System_Create(out system); if (ERRCHECK(result, "System_Create")) { return; } uint version; result = system.getVersion(out version); ERRCHECK(result, "system.getVersion"); if (version < FMOD.VERSION.number) { Report.ReportLog("Error! Old version of FMOD " + version.ToString("X") + " detected. This program requires " + FMOD.VERSION.number.ToString("X") + "."); system.close(); system.release(); system = null; return; } result = system.init(1, FMOD.INITFLAGS.NORMAL, (IntPtr)null); if (ERRCHECK(result, "system.init")) { system.close(); system.release(); system = null; return; } }
public static Sound CreateJingle(FMOD.System newsys, string filename) { Sound sound = new Sound(newsys); sound.JingleInit(filename); return(sound); }
void OnDisable() { this.StopFMODSound(); if (this.pcmReadCallbackBuffer != null) { this.pcmReadCallbackBuffer[0].Clear(); this.pcmReadCallbackBuffer[1].Clear(); this.pcmReadCallbackBuffer[0] = null; this.pcmReadCallbackBuffer[1] = null; this.pcmReadCallbackBuffer.Clear(); this.pcmReadCallbackBuffer = null; } this.pcmreadcallback = null; this.pcmsetposcallback = null; if (system != null) { result = system.close(); // ERRCHECK(result, "system.close", false); result = system.release(); // ERRCHECK(result, "system.release", false); } system = null; }
// static constructors public static Sound CreateSound(FMOD.System newsys) { Sound sound = new Sound(newsys); // sound.SoundInit(pcmReadCallback, pcmSetPosCallback); return(sound); }
public static Sound CreateStream(FMOD.System newsys, string connectionUrl, FMOD.SOUND_PCMREADCALLBACK pcmReadCallback, FMOD.SOUND_PCMSETPOSCALLBACK pcmSetPosCallback) { Sound sound = new Sound(newsys); sound.StreamInit(connectionUrl, pcmReadCallback, pcmSetPosCallback); return(sound); }
public SoundSource(FMOD.System system, FMOD.Sound sound, int posx, int posy) { FMOD.RESULT result; mPos.x = posx; mPos.y = posy; mPos.z = 0; mVel.x = 0; mVel.y = 0; mVel.z = 0; mSystem = system; result = system.playSound(FMOD.CHANNELINDEX.FREE, sound, true, ref mChannel); VirtualVoices.ERRCHECK(result); SetPosition(mPos.x, mPos.y); Random r = new Random(posx); result = mChannel.setFrequency(r.Next(22050, 44100)); VirtualVoices.ERRCHECK(result); result = mChannel.setPaused(false); VirtualVoices.ERRCHECK(result); mBrushBlue = new SolidBrush(Color.Blue); mBrushRed = new SolidBrush(Color.Red); }
public void CleanUp() { this.DeInit(this.fmodSystem); this.Bands.Clear(); this.fmodSystem = null; this.playerSettings = null; }
public SoundSystem() { var ret = FMOD.Result.OK; system = null; Program.WriteLine("SoundSystem: _ctor"); if (!IniFile.GetValue("audio", "enabled", true)) { return; } musicVolume = IniFile.GetValue("audio", "musicvolume", 100) / 100f; soundVolume = IniFile.GetValue("audio", "soundvolume", 100) / 100f; Program.Write("SoundSystem: trying to create FMOD system..."); try { FMOD.Factory.CreateSystem(ref system); } catch (DllNotFoundException) { Program.WriteLine(" Library not found. Disabling sound."); return; } Program.WriteLine(" " + ret.ToString()); if (ret != FMOD.Result.OK) { return; } Program.Write("SoundSystem: system.init..."); ret = system.Initialize(8, FMOD.InitFlags.Normal, IntPtr.Zero); Program.WriteLine(" " + ret.ToString()); if (ret != FMOD.Result.OK) { system = null; return; } music = null; musicChannel = null; sounds = new Dictionary <string, Sound>(); Program.WriteLine("SoundSystem: loading libraries..."); musicLibrary = Mix.GetTokenTree("music.tml"); soundLibrary = Mix.GetTokenTree("sound.tml"); Program.WriteLine("SoundSystem: _ctor DONE"); Program.WriteLine("Null report:"); if (system == null) { Program.WriteLine(" * system"); } if (music == null) { Program.WriteLine(" * music"); } if (musicChannel == null) { Program.WriteLine(" * musicChannel"); } }
private void Init(FMOD.System system, bool setToDefaultValues = false) { system.lockDSP().ERRCHECK(); this.Bands.Clear(); var gainValues = !setToDefaultValues && this.playerSettings.PlayerEngine.EqualizerSettings != null ? this.playerSettings.PlayerEngine.EqualizerSettings.GainValues : null; foreach (var value in EqDefaultValues) { var band = EqualizerBand.GetEqualizerBand(system, this.IsEnabled, value[0], value[1], value[2]); if (band != null) { float savedValue; if (gainValues != null && gainValues.TryGetValue(band.BandCaption, out savedValue)) { band.Gain = savedValue; } this.Bands.Add(band); } } system.unlockDSP().ERRCHECK(); system.update().ERRCHECK(); }
// Loads dynamic FMOD plugins for this platform. public virtual void LoadDynamicPlugins(FMOD.System coreSystem, Action <FMOD.RESULT, string> reportResult) { List <string> pluginNames = Plugins; if (pluginNames == null) { return; } foreach (string pluginName in pluginNames) { if (string.IsNullOrEmpty(pluginName)) { continue; } string pluginPath = GetPluginPath(pluginName); uint handle; FMOD.RESULT result = coreSystem.loadPlugin(pluginPath, out handle); #if UNITY_64 || UNITY_EDITOR_64 // Add a "64" suffix and try again if (result == FMOD.RESULT.ERR_FILE_BAD || result == FMOD.RESULT.ERR_FILE_NOTFOUND) { string pluginPath64 = GetPluginPath(pluginName + "64"); result = coreSystem.loadPlugin(pluginPath64, out handle); } #endif reportResult(result, string.Format("Loading plugin '{0}' from '{1}'", pluginName, pluginPath)); } }
///<summary> /// Return an array of strings which are the driver names for the "microphone" devices. ///</summary> public string[] GetAllMicrophoneDevices(FMOD.System fmod) { FMOD.RESULT result; int numSoundSources = 0; StringBuilder drivername = new StringBuilder(256); // result = system.setDriver(selected); // ERRCHECK(result); // Get Record drivers result = fmod.getRecordNumDrivers(ref numSoundSources); CheckRetCode(result); string[] soundSourceNames = new string[numSoundSources]; for (int count = 0; count < numSoundSources; count++) { FMOD.GUID guid = new FMOD.GUID(); result = fmod.getRecordDriverInfo(count, drivername, drivername.Capacity, ref guid); // result = fmod.getRecordDriverName(count, drivername, drivername.Capacity); CheckRetCode(result); soundSourceNames[count] = drivername.ToString(); } return(soundSourceNames); }
public void Dispose() { if (_fmodEngine != null) { _fmodEngine.release(); _fmodEngine = null; } }
public FMOD_SoundBuffer(FMOD_Audio audio, string filename) { mAudio = audio; mSystem = mAudio.FMODSystem; FMOD_Audio.CheckFMODResult(mSystem.createSound(filename, FMOD.MODE.DEFAULT, ref mSound)); }
// Loads static FMOD plugins for this platform. #if ENABLE_IL2CPP public virtual void LoadStaticPlugins(FMOD.System coreSystem, Action <FMOD.RESULT, string> reportResult) { if (StaticPlugins.Count > 0) { FMOD.RESULT result = FMOD_Unity_RegisterStaticPlugins(FMOD.VERSION.dll, coreSystem.handle); reportResult(result, "Registering static plugins"); } }
public virtual void LoadStaticPlugins(FMOD.System coreSystem, Action <FMOD.RESULT, string> reportResult) { if (StaticPlugins.Count > 0) { Debug.LogWarningFormat( "{0} static plugins specified, but static plugins are only supported on the IL2CPP scripting backend", StaticPlugins.Count); } }
public override void Dispose() { if (mSystem != null) { mSystem.release(); mSystem = null; } mIsDisposed = true; }
public static void StaticLoadPlugins(Platform platform, FMOD.System coreSystem, Action <FMOD.RESULT, string> reportResult) { platform.LoadStaticPlugins(coreSystem, reportResult); #if USE_FMOD_NATIVE_PLUGIN_INIT // Legacy static plugin system FmodUnityNativePluginInit(coreSystem.handle); #endif }
public FMOD_Music(FMOD_Audio audio, string filename) { mAudio = audio; mSystem = mAudio.FMODSystem; FMOD.RESULT result = mSystem.createStream(filename, FMOD.MODE.LOOP_NORMAL | FMOD.MODE.ACCURATETIME, ref mSound); CreateChannel(); }
public void ShutDown() { if (!Enabled) { return; } StopEverything(); system.Close(); system = null; }
public void Dispose() { if (_system != null) { _system.close(); _system.release(); _system = null; } }
static GmfSound() { sys = new FMOD.System(); FMOD.Factory.System_Create(ref sys); sys.init(64, FMOD.INITFLAGS.NORMAL, IntPtr.Zero); for (int i = 0; i < sounds.Length; ++i) { sys.createStream(string.Format("Sound/{0}.wav", i), FMOD.MODE.DEFAULT, ref sounds[i]); } }
public SoundIn(FMOD.System newsys, string connectionUrl) { newsys.CheckNull("SoundIn newsys"); system = newsys; ads = new AdKillingThread(); ads.ThreadReady += this.HandleThreadReady; SoundDataBuffer = new CircularBuffer(pumpedBuffer); streamSound = new SoundProvider(this.system, connectionUrl); this.SoundSource = streamSound; streamSound.Sounds.PlaySound(); }
public Listener(FMOD.System system, float posx, float posy) { mUp.x = 0; mUp.y = 0; mUp.z = 1; mForward.x = 1; mForward.y = 0; mForward.z = 0; mVel.x = 0; mVel.y = 0; mVel.z = 0; mSystem = system; SetPosition(posx, posy); mBrush = new SolidBrush(Color.Black); }
private Equalizer(FMOD.System system, PlayerSettings settings) { this.playerSettings = settings; this.Name = "DefaultEqualizer"; this.fmodSystem = system; this.Initializied = false; this.Bands = new ObservableCollection<EqualizerBand>(); this.IsEnabled = settings.PlayerEngine.EqualizerSettings == null || settings.PlayerEngine.EqualizerSettings.IsEnabled; this.WhenAnyValue(x => x.IsEnabled) .Subscribe(enabled => { if (!this.Initializied || enabled) { this.Init(this.fmodSystem); } else if (this.Initializied) { this.SaveEqualizerSettings(); this.DeInit(this.fmodSystem); } }); }
public FMODSystem(FMOD.System system) { this.system = system; }
public RESULT getLowLevelSystem(out FMOD.System system) { system = null; IntPtr systemraw = new IntPtr(); RESULT result = FMOD_Studio_System_GetLowLevelSystem(rawPtr, out systemraw); if (result != RESULT.OK) { return result; } system = new FMOD.System(systemraw); return result; }
private void ResetEverything() { // Stopping Music if(fmodChannel != null) fmodChannel.stop(); fmodSystem = null; fmodChannel = null; theSong = null; szSongName = ""; nCurrentPositionMS = 0; nLengthMS = 0; bPlaying = false; bIsFastforwarding = false; bIsRewinding = false; bPaused = false; //bFreq = false; bRunning = true; bListChanged = false; listBeats = new List<Beat>(); MouseAddBeat = new Beat(); szClickedEventEdit = ""; nMouseScroll = 0; MouseSelectStartPoint = new Point(); MouseSelectRect = Rectangle.Empty; SelectedBeats.Clear(); CopiedBeats.Clear(); TimeCurrentLabel.Text = "0(s)"; TimeLengthLabel.Text = "0(s)"; BeatCountLabel.Text = "0"; BPMCurrentLabel.Text = "0"; // Clean shit up RIGHT NAO!!! GC.Collect(); }
public RESULT getLowLevelSystem(out FMOD.System system) { RESULT result = RESULT.OK; IntPtr systemraw = new IntPtr(); system = null; try { result = FMOD_Studio_System_GetLowLevelSystem(rawPtr, out systemraw); } catch { result = RESULT.ERR_INVALID_PARAM; } if (result != RESULT.OK) { return result; } system = new FMOD.System(); system.setRaw(systemraw); return result; }
///<summary> /// The constructor creates the channels, and the null /// sound, but doesn't make any of the channels active. /// /// It should take name/value pair command-line args in an /// string[] container, like main args ///</summary> private VoiceManager(FMOD.System fmod, Object[] parmArray, ConnectToServerEvent connectEvent, LoginStatusEvent loginStatusEvent, bool runningVoiceBot, string[] playbackFiles) { log.Info(null, "VoiceManager constructor: " + StringifyParms(parmArray)); if (connectEvent != null) onConnectedToServer += connectEvent; if (loginStatusEvent != null) onLoginStatusReceived += loginStatusEvent; this.parameters = parmArray; this.runningVoiceBot = runningVoiceBot; this.playbackFiles = playbackFiles; currentVoiceParms = new VoiceParmSet(parmArray); string MyDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string ClientAppDataFolder = Path.Combine(MyDocumentsFolder, "Multiverse World Browser"); logFolder = Path.Combine(ClientAppDataFolder, "Logs"); log.Debug(null, "VoiceManager constructor: Applying parms"); playerListenerProperties = new ListenerProperties(); playerListenerProperties.Init(); ApplyConstructorParms(currentVoiceParms); ApplyPlaybackSettings(currentVoiceParms, false); log.Debug(this, "VoiceManager constructor: Encaching sound sources"); voiceChannels = new Dictionary<Byte, VoiceChannel>(); micChannels = new MicrophoneChannel[1]; if (!runningVoiceBot) { if (fmod != null) { log.Debug(this, "VoiceManager constructor: Using fmod instance passed in: " + fmod); this.fmod = fmod; } else { log.Debug(this, "VoiceManager constructor: Creating new fmod instance"); InitFmod(); } } log.Debug(this, "VoiceManager constructor: Creating mic channel"); micChannels[0] = new MicrophoneChannel(this, playerOid, micDeviceNumber, micRecordWAV, micRecordSpeex); recentSpeakers = new List<VoiceChannel>(); noSoundShorts = new short[defaultSamplesPerFrame * 8]; MaybeDeleteRecordedFile(micRecordWAV, LogFolderPath("RecordMic.wav")); MaybeDeleteRecordedFile(micRecordSpeex, LogFolderPath("RecordMic.speex")); ApplyGroupParms(currentVoiceParms, false); if (runningVoiceBot) log.DebugFormat(this, "VoiceManager constructor: Running voice bot oid {0}", playerOid); if (connectToServer) { log.Debug(this, "VoiceManager constructor: Initializing connection to server at " + voiceServerHost + ", port " + voiceServerPort); receiveBuffer = new byte[receiveBufferSize]; connectedToServer = true; InitializeVoiceServerConnection(); } else micChannels[0].InitMicrophone(currentVoiceParms, false); }
public void Dispose() { if (this.tokenSource != null) { this.tokenSource.Cancel(); } this.StopMusic(); if(this.fmodSystem != null) { this.fmodSystem.release(); this.fmodSystem = null; } }