public bool LoadStream(string FileName, bool b3D = false) { FMOD.RESULT result; FMOD.System sys = m_system.System; is3d = b3D; if (sys != null) { result = sys.createStream(FileName, (b3D) ? FMOD.MODE._3D : FMOD.MODE._2D, ref m_sound); if (!m_system.ERRCHECK(result, "LoadStream")) { return(false); } m_status = StreamStatus.Loaded; Console.WriteLine("[FMOD] SoundStream file: " + FileName + " file loaded"); } else { return(false); } return(true); }
private void OnDestroy() { if (instance != this) { return; } if (system == null) { return; } int n = 0, m = 0; Memory.GetStats(out n, out m); FmodAudioManager.Release(); //DOAll(fam => fam.Release()); FmodSoundCreater.ReleaseInstance(); system.close(); system.release(); system = null; Memory.GetStats(out n, out m); if (n > 0) { Debug.LogError("FmodAudioSystem Memory Leak:Current " + n + " Maximum " + m); } }
public void CleanUp() { this.DeInit(this.fmodSystem); this.Bands.Clear(); this.fmodSystem = null; this.smpSettings = null; }
public static void Initialize() { player = Factory.CreateSystem(); player.Initialize(16, InitalisationFlags.Normal, IntPtr.Zero); randomizer = new Random(); }
static void AboutIntegration() { PrepareIntegration(); if (sFMODSystem == null || !sFMODSystem.isValid()) { CreateSystem(); if (sFMODSystem == null || !sFMODSystem.isValid()) { EditorUtility.DisplayDialog("FMOD Studio Unity Integration", "Unable to retrieve version, check the version number in fmod.cs", "OK"); } } FMOD.System sys = null; sFMODSystem.getLowLevelSystem(out sys); uint version = 0; if (!ERRCHECK(sys.getVersion(ref version))) { return; } EditorUtility.DisplayDialog("FMOD Studio Unity Integration", "Version: " + getVersionString(version), "OK"); }
void LoadPlugins() { FMOD.System sys = null; ERRCHECK(FMOD_StudioSystem.instance.System.getLowLevelSystem(out sys)); if (Application.platform == RuntimePlatform.IPhonePlayer && pluginPaths.Length != 0) { FMOD.Studio.UnityUtil.LogError("DSP Plugins not currently supported on iOS, contact [email protected] for more information"); return; } foreach (var name in pluginPaths) { var path = pluginPath + "/" + GetPluginFileName(name); FMOD.Studio.UnityUtil.Log("Loading plugin: " + path); #if !UNITY_METRO if (!System.IO.File.Exists(path)) { FMOD.Studio.UnityUtil.LogWarning("plugin not found: " + path); } #endif uint handle; ERRCHECK(sys.loadPlugin(path, out handle)); } }
// ---------------------------------------------------------------------------------------------------- #endregion #region Loading Plugins // ---------------------------------------------------------------------------------------------------- /// <summary> /// Loads the plugins. /// </summary> private void LoadPlugins() { if (pluginPaths == null || pluginPaths.Length == 0) { return; } Logger.LogMessage("Loading Plugins."); FMOD.System fmodSystem = null; Logger.ErrorCheck(FMODStudioSystem.Instance.System.GetLowLevelSystem(out fmodSystem)); string dir = PluginPath; foreach (var name in pluginPaths) { string path = dir + "/" + GetPluginFileName(name); Logger.LogMessage("Loading plugin: " + path); if (!CSystem.IO.File.Exists(path)) { Logger.LogWarning("Plugin not found: " + path); } uint handle; Logger.ErrorCheck(fmodSystem.LoadPlugin(path, out handle)); } }
private EqualizerBand(FMOD.System system, DSP dspParamEq, float centerValue, float gainValue, bool active) { this.fmodSystem = system; this.dspEQ = dspParamEq; if (centerValue >= 1000) { this.BandCaption = string.Format("{0}K", (centerValue / 1000)); } else { this.BandCaption = centerValue.ToString(CultureInfo.InvariantCulture); } this.WhenAnyValue(x => x.Gain) .Subscribe(newGain => { if (this.IsActive && this.dspEQ != null) { System.Diagnostics.Debug.WriteLine(">> Gain value: " + newGain); this.dspEQ.setActive(false).ERRCHECK(); this.dspEQ.setParameterFloat((int)FMOD.DSP_PARAMEQ.GAIN, newGain).ERRCHECK(); this.dspEQ.setActive(true).ERRCHECK(); this.fmodSystem.update().ERRCHECK(); } }); this.Gain = gainValue; this.IsActive = active; }
private void Init(FMOD.System system, bool setToDefaultValues = false) { var result = system.lockDSP(); result.ERRCHECK(); this.Bands.Clear(); var gainValues = !setToDefaultValues && this.smpSettings.PlayerSettings.EqualizerSettings != null ? this.smpSettings.PlayerSettings.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); } } result = system.unlockDSP(); result.ERRCHECK(); }
public Reverb_Area(ref FMOD.System system, Reverb_Attributes attribs, ref REVERB_PROPERTIES prop, Image image, int Layer, bool HasCollision, PointF pt, bool DrawAsSprite) : base(image, Layer, HasCollision, pt, DrawAsSprite, false) { Reverb3D = null; system.createReverb3D(out reverb); SetReverbProperties(ref prop); Set3DAttributes(ref attribs.Position, attribs.MinDistance, attribs.MaxDistance); }
/* TODO: * highlight when box is being played * visualise how the data is loaded and parsed */ void Start() { SequencerObject = GameObject.FindGameObjectWithTag("sequencer"); // read files and receive lists FileLoaderObject = GameObject.FindGameObjectWithTag("fileloader"); var autoFileLoaderComponent = FileLoaderObject.GetComponent <AutoFileLoader>(); autoFileLoaderComponent.ReadFiles(); layerAmount = autoFileLoaderComponent.layerAmount; transitionValues = autoFileLoaderComponent.transitionValues; entryList2 = autoFileLoaderComponent.entryList2; // FMOD corSystem = FMODUnity.RuntimeManager.CoreSystem; uint version; corSystem.getVersion(out version); corSystem.createChannelGroup("master", out channelgroup); // create channel group // UI listeners playButton.onClick.AddListener(playButtonPressed); pauseButton.onClick.AddListener(pauseButtonPressed); // spawn boxes SpawnerObject = GameObject.FindGameObjectWithTag("spawncomponent"); SpawnerObject.GetComponent <SpawnerSystem>().SpawnBoxes(); }
public static Equalizer GetEqualizer(FMOD.System system, SMPSettings settings) { var eq = new Equalizer(system, settings); eq.Init(system); return(eq); }
private Equalizer(FMOD.System system, SMPSettings settings) { this.smpSettings = settings; this.Name = "DefaultEqualizer"; this.fmodSystem = system; this.Bands = new ObservableCollection<EqualizerBand>(); this.isEnabled = settings.PlayerSettings.EqualizerSettings == null || settings.PlayerSettings.EqualizerSettings.IsEnabled; }
/* TODO: * highlight when box is being played * visualise how the data is loaded and parsed */ void Start() { // spawner object reference spawnerObject = GameObject.FindGameObjectWithTag("Spawner"); // acces FMOD corSystem = FMODUnity.RuntimeManager.CoreSystem; uint version; corSystem.getVersion(out version); // create channel group corSystem.createChannelGroup("master", out channelgroup); // load all files ReadFiles(); // UI listeners playPauseButton.onClick.AddListener(buttonPressed); // create boxes for (int i = 0; i < layerAmount; i++) { spawnerObject.GetComponent <spawner>().SpawnBox(); } }
// Use this for initialization void Start () { lowLevelSystem = RuntimeManager.LowlevelSystem; channel = new FMOD.Channel(); lowLevelSystem.getMasterChannelGroup(out channelGroup); soundInfo = new FMOD.CREATESOUNDEXINFO(); soundInfo.cbsize = Marshal.SizeOf(soundInfo); soundInfo.decodebuffersize = (uint)sampleRate / 10; soundInfo.length = (uint)(sampleRate * numberOfChannels * sizeof(short)); soundInfo.numchannels = numberOfChannels; soundInfo.defaultfrequency = sampleRate; soundInfo.format = FMOD.SOUND_FORMAT.PCM16; soundInfo.pcmreadcallback = PCMReadCallback; soundInfo.pcmsetposcallback = PCMSetPositionCallback; lowLevelSystem.setStreamBufferSize(65536, FMOD.TIMEUNIT.RAWBYTES); lowLevelSystem.createStream("SoundGeneratorStream", FMOD.MODE.OPENUSER, ref soundInfo, out generatedSound); generatedSound.setMode(FMOD.MODE.OPENUSER | FMOD.MODE._3D | FMOD.MODE._3D_LINEARSQUAREROLLOFF); lowLevelSystem.playSound(generatedSound, channelGroup, true, out channel); channel.setLoopCount(-1); channel.setMode(FMOD.MODE.LOOP_NORMAL); channel.setPosition(0, FMOD.TIMEUNIT.MS); channel.set3DMinMaxDistance(minDistance, maxDistance); Update(); channel.setPaused(false); }
private void LimitSoftChannels(int num) { UnityEngine.Debug.Log("<color=yellow>------------------------- LimitSoftChannels -------------------------</color>"); UnityEngine.Debug.Log("Limit Channel to " + num); FMOD.System system = null; this.ERRCHECK(FMOD_StudioSystem.instance.System.getLowLevelSystem(out system)); this.ERRCHECK(system.setSoftwareChannels(num)); }
private Equalizer(FMOD.System system, SMPSettings settings) { this.smpSettings = settings; this.Name = "DefaultEqualizer"; this.fmodSystem = system; this.Bands = new ObservableCollection <EqualizerBand>(); this.isEnabled = settings.PlayerSettings.EqualizerSettings == null || settings.PlayerSettings.EqualizerSettings.IsEnabled; }
private void CleanUpSystem(ref FMOD.System fmodSystem) { if (fmodSystem.hasHandle()) { fmodSystem.close().ERRCHECK(); fmodSystem.release().ERRCHECK(); fmodSystem.clearHandle(); } }
internal LowLevelSystem(FMOD.System system) { _listenerCollection = new ListenerCollection(this); _disposed = false; _system = system; _reverbController = new ReverbPropertiesController(_system); }
private void CleanUpSystem(ref FMOD.System fmodSystem) { if (fmodSystem != null) { fmodSystem.close().ERRCHECK(); fmodSystem.release().ERRCHECK(); fmodSystem = null; } }
void OnApplicationQuit() { PlayingMusic.release(); channel.stop(); system.close(); system.release(); channel = null; PlayingMusic = null; system = null; }
internal SoundManager(FMOD.System system, bool hardware = true) { _log = Logging.LogManager.GetLogger(this); _log.Info("Initializing SoundManager..."); _system = system; _sounds = new List<Sound>(); _soundMode = hardware ? MODE.HARDWARE : MODE.SOFTWARE; _log.DebugFormat("Sound Mode == {0}", _soundMode); _log.Debug("SoundManager initialized!"); }
public void StopMusic() { PlayingMusic.release(); channel.stop(); system.close(); system.release(); channel = null; PlayingMusic = null; system = null; }
public WavEffect(FMOD.System system, string path, bool loop, float baseVol) { this.system = system; callback = new CHANNEL_CALLBACK(SyncCallback); baseVolume = baseVol; volume = 1; system.createSound(path, MODE.SOFTWARE | (loop ? MODE.LOOP_NORMAL : MODE.LOOP_OFF), ref sound); channel = new Channel(); playCount = 0; }
public static EqualizerBand GetEqualizerBand(FMOD.System system, bool isActive, float centerValue, float bandwithValue, float gainValue) { FMOD.DSP dspParamEq = null; if (isActive) { if (!system.createDSPByType(FMOD.DSP_TYPE.PARAMEQ, out dspParamEq).ERRCHECK()) { return(null); } FMOD.ChannelGroup masterChannelGroup; if (!system.getMasterChannelGroup(out masterChannelGroup).ERRCHECK()) { return(null); } int numDSPs; if (!masterChannelGroup.getNumDSPs(out numDSPs).ERRCHECK()) { return(null); } if (!masterChannelGroup.addDSP(numDSPs, dspParamEq).ERRCHECK()) { return(null); } if (!dspParamEq.setParameterFloat((int)FMOD.DSP_PARAMEQ.CENTER, centerValue).ERRCHECK()) { return(null); } if (!dspParamEq.setParameterFloat((int)FMOD.DSP_PARAMEQ.BANDWIDTH, bandwithValue).ERRCHECK()) { return(null); } if (!dspParamEq.setParameterFloat((int)FMOD.DSP_PARAMEQ.GAIN, gainValue).ERRCHECK()) { return(null); } if (!dspParamEq.setActive(true).ERRCHECK()) { return(null); } } var band = new EqualizerBand(system, dspParamEq, centerValue, gainValue, isActive); return(band); }
private void DeInit(FMOD.System system) { var result = system.lockDSP(); result.ERRCHECK(); foreach (var band in this.Bands) { band.Remove(); } result = system.unlockDSP(); result.ERRCHECK(); }
protected internal override void BeginRecording(RecordingSession session) { var dspName = "RecordSessionVideo(Audio)".ToCharArray(); Array.Resize(ref dspName, 32); dspCallback = DspReadCallback; var dspDescription = new DSP_DESCRIPTION { version = 0x00010000, name = dspName, numinputbuffers = 1, numoutputbuffers = 1, read = dspCallback, numparameters = 0 }; FMOD.System system = RuntimeManager.CoreSystem; CheckError(system.getMasterChannelGroup(out ChannelGroup masterGroup)); CheckError(masterGroup.getDSP(CHANNELCONTROL_DSP_INDEX.TAIL, out DSP masterDspTail)); CheckError(masterDspTail.getChannelFormat(out CHANNELMASK channelMask, out int numChannels, out SPEAKERMODE sourceSpeakerMode)); if (RecorderOptions.VerboseMode) { Debug.Log( $"(UnityRecorder) Listening to FMOD Audio. Setting DSP to [{channelMask}] [{numChannels}] [{sourceSpeakerMode}]"); } // Create a new DSP with the format of the existing master group. CheckError(system.createDSP(ref dspDescription, out dsp)); CheckError(dsp.setChannelFormat(channelMask, numChannels, sourceSpeakerMode)); CheckError(masterGroup.addDSP(CHANNELCONTROL_DSP_INDEX.TAIL, dsp)); // Fill in some basic information for the Unity audio encoder. mChannelCount = (ushort)numChannels; CheckError(system.getDriver(out int driverId)); CheckError(system.getDriverInfo(driverId, out Guid _, out int systemRate, out SPEAKERMODE _, out int _)); mSampleRate = systemRate; if (RecorderOptions.VerboseMode) { Debug.Log($"FmodAudioInput.BeginRecording for capture frame rate {Time.captureFramerate}"); } if (audioSettings.PreserveAudio) { AudioRenderer.Start(); } }
public void CleanUp() { if (this.Channel != null) { this.Channel.setVolume(0f).ERRCHECK(RESULT.ERR_INVALID_HANDLE); this.Channel.setPaused(true).ERRCHECK(RESULT.ERR_INVALID_HANDLE); this.Channel.setCallback(null).ERRCHECK(RESULT.ERR_INVALID_HANDLE); this.Channel = null; } this.channelEndCallback = null; this.File.State = PlayerState.Stop; this.File = null; this.playNextFileAction = null; this.system = null; }
public static void Destroy() { SoundSystem.close(); // This will also release master, so we don't have to call master.release(); foreach (string key in channelGroups.Keys) { channelGroups[key].release(); } SoundSystem.release(); SoundSystem = null; audioClips = null; }
// TODO: automatically recognise if oneshot of loop and load from same list/class public static void Start() { corSystem = FMODUnity.RuntimeManager.CoreSystem; uint version; corSystem.getVersion(out version); corSystem.createChannelGroup("master", out channelgroup); channelgroup.setVolume(0.5f); //DSP pLowPass; //corSystem.createDSPByType(DSP_TYPE.LOWPASS, out pLowPass); //channelgroup.addDSP(0, pLowPass); //pLowPass.setParameterFloat(0, 1000.0f); }
public static EqualizerBand GetEqualizerBand(FMOD.System system, bool isActive, float centerValue, float bandwithValue, float gainValue) { FMOD.DSPConnection dspConnTemp = null; FMOD.DSP dspParamEq = null; if (isActive) { var result = system.createDSPByType(FMOD.DSP_TYPE.PARAMEQ, ref dspParamEq); if (!result.ERRCHECK()) { return(null); } result = system.addDSP(dspParamEq, ref dspConnTemp); if (!result.ERRCHECK()) { return(null); } result = dspParamEq.setParameter((int)FMOD.DSP_PARAMEQ.CENTER, centerValue); if (!result.ERRCHECK()) { return(null); } result = dspParamEq.setParameter((int)FMOD.DSP_PARAMEQ.BANDWIDTH, bandwithValue); if (!result.ERRCHECK()) { return(null); } result = dspParamEq.setParameter((int)FMOD.DSP_PARAMEQ.GAIN, gainValue); if (!result.ERRCHECK()) { return(null); } result = dspParamEq.setActive(true); if (!result.ERRCHECK()) { return(null); } } var band = new EqualizerBand(dspParamEq, centerValue, gainValue, isActive); return(band); }
void Start() { CubeData.globalColor = Color.red; dsps = new List <FMOD.DSP>(); singleton = this; playerState = FMODUnity.RuntimeManager.CreateInstance(PlayerStateEvent); lowlevelSystem = FMODUnity.RuntimeManager.LowlevelSystem; if (!masterDSP.hasHandle()) { FMOD.ChannelGroup master; lowlevelSystem.getMasterChannelGroup(out master); master.getDSP(0, out masterDSP); masterDSP.setMeteringEnabled(false, true); } setupLeapMotion(); currentTime = Time.Start; }
internal SongManager(FMOD.System system, bool hardware = true) { _log = Logging.LogManager.GetLogger(this); _log.Info("Initializing SongManager..."); _system = system; _songs = new List<Song>(); // ReSharper disable BitwiseOperatorOnEnumWihtoutFlags if (hardware) _soundMode = MODE._2D | MODE.HARDWARE | MODE.CREATESTREAM; else _soundMode = MODE._2D | MODE.SOFTWARE | MODE.CREATESTREAM; // ReSharper restore BitwiseOperatorOnEnumWihtoutFlags _log.DebugFormat("Sound Mode == {0}", _soundMode); _log.Debug("SongManager initialized!"); }
public Plugin(uint handle, FMOD.System system) { Handle = handle; _system = system; }
public void Release() { if (this.dspEQ != null) { this.dspEQ.setActive(false).ERRCHECK(); FMOD.ChannelGroup masterChannelGroup = null; this.fmodSystem.getMasterChannelGroup(out masterChannelGroup).ERRCHECK(); masterChannelGroup.removeDSP(this.dspEQ).ERRCHECK(); this.dspEQ.release().ERRCHECK(); this.dspEQ = null; this.fmodSystem = null; } this.IsActive = false; }
internal ReverbPropertiesController(FMOD.System system) { _system = system; }
private void PopulateProfileLists() { var boxArray = new[] {comboBoxDefaultProfile}; foreach (var box in boxArray) { var selectedIndex = box.SelectedIndex; box.BeginUpdate(); box.Items.Clear(); box.Items.AddRange(Directory.GetFiles(Paths.ProfilePath, Vendor.All + Vendor.ProfileExtension).Select(Path.GetFileNameWithoutExtension).ToArray()); if (selectedIndex < box.Items.Count) { box.SelectedIndex = selectedIndex; } box.EndUpdate(); } comboBoxDefaultProfile.Items.Insert(0, "None"); }
public static RESULT System_Create(ref System system) { RESULT result = RESULT.OK; IntPtr systemraw = new IntPtr(); System systemnew = null; result = FMOD_System_Create(ref systemraw); if (result != RESULT.OK) { return result; } systemnew = new System(); systemnew.setRaw(systemraw); system = systemnew; return result; }
public DeckControl() { _mixerBackground = new Image(); _mixerBackground.Height = 488; _mixerBackground.Width = 710; BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.UriSource = new Uri("png/deck_background.png", UriKind.Relative); bmp.EndInit(); _mixerBackground.Source = bmp; this.Children.Add(_mixerBackground); _recordController = new RecordController(RECORD_DIAMETER, RECORD_DIAMETER); _recordController.Margin = new Thickness(RECORD_MARGIN_LEFT, RECORD_MARGIN_TOP, 0, 0); _recordController.SetBackgroundImage(@"png/record.png"); _recordController.Width = RECORD_DIAMETER; _recordController.Height = RECORD_DIAMETER; _recordController.TouchDown += new EventHandler<TouchEventArgs>(RecordTouchDown); _recordController.TouchUp += new EventHandler<TouchEventArgs>(RecordTouchUp); _recordController.TouchMove += new EventHandler<TouchEventArgs>(RecordTouchMove); _recordController.DragEnter += new System.Windows.DragEventHandler(RecordDragEnter); _recordController.DragLeave += new System.Windows.DragEventHandler(RecordDragLeave); _recordController.Drop += new System.Windows.DragEventHandler(RecordDrop); _recordController.AllowDrop = true; this.Children.Add(_recordController); _highPassKnob = new KnobControl(KNOB_DIAMETER, KNOB_DIAMETER); _highPassKnob.Margin = new Thickness(KNOB_MARGIN_LEFT, KNOB_MARGIN_TOP, 0, 0); _highPassKnob.SetBackgroundImage(@"png/dial_background.png"); _highPassKnob.SetCenterImage(@"png/dial_knob.png"); _highPassKnob.Width = KNOB_DIAMETER; _highPassKnob.Height = KNOB_DIAMETER; //_highPassKnob.TouchDown += new EventHandler<TouchEventArgs>(HPKnobTouchDown); //_highPassKnob.TouchUp += new EventHandler<TouchEventArgs>(HPKnobTouchUp); _highPassKnob.TouchMove += new EventHandler<TouchEventArgs>(HPKnobTouchMove); this.Children.Add(_highPassKnob); _lowPassKnob = new KnobControl(KNOB_DIAMETER, KNOB_DIAMETER); _lowPassKnob.Margin = new Thickness(KNOB_MARGIN_LEFT, KNOB_MARGIN_TOP + KNOB_DIAMETER * 1 + KNOB_PADDING * 1, 0, 0); _lowPassKnob.SetBackgroundImage(@"png/dial_background.png"); _lowPassKnob.SetCenterImage(@"png/dial_knob.png"); _lowPassKnob.Width = KNOB_DIAMETER; _lowPassKnob.Height = KNOB_DIAMETER; _lowPassKnob.TouchMove += new EventHandler<TouchEventArgs>(LPKnobTouchMove); this.Children.Add(_lowPassKnob); _reverbKnob = new KnobControl(KNOB_DIAMETER, KNOB_DIAMETER); _reverbKnob.Margin = new Thickness(KNOB_MARGIN_LEFT, KNOB_MARGIN_TOP + KNOB_DIAMETER * 2 + KNOB_PADDING * 2, 0, 0); _reverbKnob.SetBackgroundImage(@"png/dial_background.png"); _reverbKnob.SetCenterImage(@"png/dial_knob.png"); _reverbKnob.Width = KNOB_DIAMETER; _reverbKnob.Height = KNOB_DIAMETER; this.Children.Add(_reverbKnob); angle = 1; _recordMidPoint = new System.Windows.Point(_recordController.Width / 2 + _recordController.Margin.Left, _recordController.Height / 2 + _recordController.Margin.Top); rotate = new RotateTransform(1, _recordController.Width / 2, _recordController.Height / 2); transform = new TransformGroup(); transform.Children.Add(rotate); dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 1); dispatcherTimer.Start(); system = new FMOD.System(); FMOD.RESULT result = Factory.System_Create(ref system); system.init(8, INITFLAGS.NORMAL, (IntPtr)null); channel = new Channel(system); channel.Initialize(0); channel.SetHighPass(1.0f); _isPlaying = false; }
private void StandardSequence_Load(object sender, EventArgs e) { // Fixed the issue where the icon does not show on load without setting it here (See Answer from Tom) // See: http://stackoverflow.com/questions/888865/problem-with-icon-on-creating-new-maximized-mdi-child-form-in-net Icon = Icon.Clone() as Icon; ToolStripManager.LoadSettings(this, _preferences.XmlDoc.DocumentElement); ToolStripManager.SaveSettings(this, _preferences.XmlDoc.DocumentElement, "reset"); _preferences.SaveSettings(); var panelArray = new[] { toolStripContainer1.TopToolStripPanel, toolStripContainer1.BottomToolStripPanel, toolStripContainer1.LeftToolStripPanel, toolStripContainer1.RightToolStripPanel }; var list = new List<string>(); foreach (var strip in panelArray.SelectMany(panel => panel.Controls.Cast<ToolStrip>())) { _toolStrips[strip.Text] = strip; list.Add(strip.Text); } list.Sort(); //this populates the toolstrip menu with the attached toolstrips var position = toolbarsToolStripMenuItem.DropDownItems.IndexOf(toolStripSeparator7); foreach (var menuItem in list.Select(str => new ToolStripMenuItem(str) {Tag = _toolStrips[str], Checked = _toolStrips[str].Visible, CheckOnClick = true})) { menuItem.CheckStateChanged += _toolStripCheckStateChangeHandler; toolbarsToolStripMenuItem.DropDownItems.Insert(position++, menuItem); } _actualLevels = _preferences.GetBoolean("ActualLevels"); if (_actualLevels) { toolStripButtonToggleLevels.Image = Resources.Percent; toolStripButtonToggleCellText.Image = Resources.level_Number; } else { toolStripButtonToggleLevels.Image = Resources.number; toolStripButtonToggleCellText.Image = Resources.level_Percent; } if (ToolStripManager.Crosshairs && !toolStripButtonToggleCrossHairs.Checked) { toolStripButtonToggleCrossHairs_Click(null, null); } if (ToolStripManager.WaveformShown && !toolStripButtonWaveform.Checked) { toolStripButtonWaveform.Checked = true; toolStripButtonWaveform_Click(null, null); } UpdateToolbarMenu(); UpdateLevelDisplay(); _sequence.CurrentGroup = Group.AllChannels; UpdateGroups(); SetEditingState(true); }
private fmod(System system, int deviceIndex) { this.m_system = system; this.m_deviceIndex = deviceIndex; this.m_channels = new List<SoundChannel>(); }
//This function is called by the loadSystem function. It sets up FMOD for the rest of //the program, like an "init" of sorts. Most of this code is boilerplate that is used in //every FMOD application. private FMOD.System fmodSetup() { FMOD.System t_system = new FMOD.System(); FMOD.RESULT result = new FMOD.RESULT(); uint version = 0; int numDrivers = 0; FMOD.SPEAKERMODE speakerMode = FMOD.SPEAKERMODE.STEREO; FMOD.CAPS caps = FMOD.CAPS.NONE; StringBuilder name = null; // Create FMOD interface object result = FMOD.Factory.System_Create(ref t_system); FMODErrorCheck(result); // Check version result = t_system.getVersion(ref version); FMODErrorCheck(result); if (version < FMOD.VERSION.number) { Console.WriteLine("Error! You are using an old version of FMOD " + version + ". This program requires " + FMOD.VERSION.number); return null; } //Check Sound Cards, if none, disable sound result = t_system.getNumDrivers(ref numDrivers); FMODErrorCheck(result); if (numDrivers == 0) { result = t_system.setOutput(FMOD.OUTPUTTYPE.NOSOUND); FMODErrorCheck(result); } // At least one sound card else { // Get the capabilities of the default (0) sound card result = t_system.getDriverCaps(0, ref caps, ref zero, ref speakerMode); FMODErrorCheck(result); // Set the speaker mode to match that in Control Panel result = t_system.setSpeakerMode(speakerMode); FMODErrorCheck(result); // Increase buffer size if user has Acceleration slider set to off if (FMOD.CAPS.HARDWARE_EMULATED.Equals(true)) { result = t_system.setDSPBufferSize(1024, 10); FMODErrorCheck(result); } // Get name of driver FMOD.GUID temp = new FMOD.GUID(); result = t_system.getDriverInfo(0, name, 256, ref temp); FMODErrorCheck(result); } System.IntPtr temp2 = new System.IntPtr(); // Initialise FMOD result = t_system.init(100, FMOD.INITFLAGS.NORMAL, temp2); // If the selected speaker mode isn't supported by this sound card, switch it back to stereo if (result == FMOD.RESULT.ERR_OUTPUT_CREATEBUFFER) { result = t_system.setSpeakerMode(FMOD.SPEAKERMODE.STEREO); FMODErrorCheck(result); result = t_system.init(100, FMOD.INITFLAGS.NORMAL, temp2); } FMODErrorCheck(result); return t_system; }
public RESULT getSystemObject(out System system) { system = null; IntPtr raw; RESULT result = ChannelControl.FMOD5_ChannelGroup_GetSystemObject(this.rawPtr, out raw); system = new System(raw); return result; }
//Calculates the angle between two Points relative to the midpoint private double CalculateAngle(System.Windows.Point Mid, System.Windows.Point A, System.Windows.Point B) { double MidA = Math.Sqrt(Math.Pow(Mid.X - A.X, 2) + Math.Pow(Mid.Y - A.Y, 2)); double AB = Math.Sqrt(Math.Pow(A.X - B.X, 2) + Math.Pow(A.Y - B.Y, 2)); double MidB = Math.Sqrt(Math.Pow(Mid.X - B.X, 2) + Math.Pow(Mid.Y - B.Y, 2)); Double angle = Math.Acos(((Math.Pow(AB, 2) - Math.Pow(MidA, 2) - Math.Pow(MidB, 2)) / (-2 * MidA * MidB))); double determinant = ((A.X - Mid.X) * (B.Y - Mid.Y)) - ((A.Y - Mid.Y) * (B.X - Mid.X)); if (determinant < 0) { angle = -angle; } //check if memory got updated before the render if (Double.IsNaN(angle)) { angle = 0; } return angle * (180 / Math.PI); }
public RESULT getSystemObject(ref System system) { var result = RESULT.OK; var systemraw = new IntPtr(); System systemnew = null; try { result = FMOD_Channel_GetSystemObject(channelraw, ref systemraw); } catch { result = RESULT.ERR_INVALID_PARAM; } if (result != RESULT.OK) { return result; } if (system == null) { systemnew = new System(); systemnew.setRaw(systemraw); system = systemnew; } else { system.setRaw(systemraw); } return result; }
//Call this function to create the "System" object that the detector will use //throughout its lifetime. Should only be called once per instance. public void loadSystem() { system = fmodSetup(); }
public RESULT getSystemObject(out System system) { system = null; IntPtr raw; RESULT result = DSP.FMOD5_DSP_GetSystemObject(this.rawPtr, out raw); system = new System(raw); return result; }
public RESULT getSystemObject(ref System system) { RESULT result = RESULT.OK; IntPtr systemraw = new IntPtr(); System systemnew = null; try { result = FMOD_SoundGroup_GetSystemObject(soundgroupraw, ref systemraw); } catch { result = RESULT.ERR_INVALID_PARAM; } if (result != RESULT.OK) { return result; } if (system == null) { systemnew = new System(); systemnew.setRaw(systemraw); system = systemnew; } else { system.setRaw(systemraw); } return result; }
static void Main(string[] args) { //Console.SetBufferSize(80, 500); Console.WriteLine("--- SpectralCoding League of Legends FMOD Sound Back Extractor ---"); Console.WriteLine(); ParseArgs(args); FMOD.RESULT FModResult; // Set our variable we will keep updating with the FMOD Results if ((!Directory.Exists(TargetDir)) && ExtractFSB) { // Create the target directory if it doesn't exist Console.WriteLine("Creating target directory: " + TargetDir + @"\"); Directory.CreateDirectory(TargetDir); } FMOD.System FModSys = new FMOD.System(); // Initialize and create a FMOD "System" so FModResult = FMOD.Factory.System_Create(ref FModSys); // we can interface with the FSBs // Initialize the FMod System with default flags FModResult = FModSys.init(16, FMOD.INITFLAGS.NORMAL, IntPtr.Zero); foreach (string CurFSB in FSBList) { // For each file we're going to list or extract if (FModSys == null) { // Something went wrong, probably didn't have the proper DLL or something. Console.WriteLine("Unable to initialize the FMOD System. Did you copy the fmodex.dll into the same folder as LoLFSBExtract.exe?"); Environment.Exit(1); } else { if (FModResult != FMOD.RESULT.OK) { // If something went wrong, print the error. Console.WriteLine("ERR FModSys.init(): " + FMOD.Error.String(FModResult)); } else { // Otherwise, dump the sound bank! Console.WriteLine(); FModResult = DumpSoundBank(FModSys, CurFSB); if (FModResult != FMOD.RESULT.OK) { Console.WriteLine("ERR DumpSoundBank: " + FMOD.Error.String(FModResult)); } } } } Console.WriteLine(); Console.WriteLine("Finished!"); //Console.ReadLine(); Environment.Exit(0); }
public static RESULT System_Create(ref System system) { #if WIN64 if (IntPtr.Size != 8) { /* Attempting to use 64-bit FMOD dll with 32-bit application.*/ return RESULT.ERR_FILE_BAD; } #else if (IntPtr.Size != 4) { /* Attempting to use 32-bit FMOD dll with 64-bit application. A likely cause of this error * is targetting platform 'Any CPU'. You cannot link to unmanaged dll with 'Any CPU' * target. * * For 32-bit applications: set the platform to 'x86'. * * For 64-bit applications: * 1. set the platform to x64 * 2. add the conditional complication symbol WIN64 * 3. download the win64 fmod release * 4. copy the fmodex64.dll to the location of the .exe file for your application */ return RESULT.ERR_FILE_BAD; } #endif RESULT result = RESULT.OK; IntPtr systemraw = new IntPtr(); System systemnew = null; // If you come to here with a DLLNotFound exception, make sure to copy "fmodex.dll" into // the game's runtime directory (along with config.xml) result = FMOD_System_Create(ref systemraw); if (result != RESULT.OK) { return result; } systemnew = new System(); systemnew.setRaw(systemraw); system = systemnew; return result; }
public RESULT getSystemObject (out System system) { system = null; IntPtr systemraw; RESULT result = FMOD_DSP_GetSystemObject(rawPtr, out systemraw); system = new System(systemraw); return result; }
public static RESULT System_Create(out System system) { system = null; RESULT result = RESULT.OK; IntPtr rawPtr = new IntPtr(); result = FMOD_System_Create(out rawPtr); if (result != RESULT.OK) { return result; } system = new System(rawPtr); return result; }
private void clean(bool checkForHandles) { int nbEventSystemHandles = FmodEventSystemHandle.NbHandles; if (m_eventSystem != null && (checkForHandles == false || nbEventSystemHandles <= 1)) { List<FmodEventAudioSource> tmpList = m_eventPoolManager.getAllActiveSources(); foreach (FmodEventAudioSource src in tmpList) { if (src != null) { src.Clean(); } } if (m_musicSystem != null) { m_musicSystem.release(); m_musicSystem = null; } if (_unloadAllFiles()) { ERRCHECK(m_eventSystem.unload()); } if (m_eventSystem != null) { ERRCHECK(m_eventSystem.release()); m_eventSystem = null; } if (m_system != null) { ERRCHECK(m_system.release()); m_system = null; } m_eventSystemWasCleaned = true; m_eventSystemWasInit = false; WasCleaned = true; FmodEventSystem.m_FmodEventSystem = null; } }
public Music(FMOD.System system, string intropath, string looppath, float baseVol) { this.system = system; callback = new CHANNEL_CALLBACK(SyncCallback); baseVolume = baseVol; volume = 1; if (looppath != null) system.createSound(looppath, MODE.LOOP_NORMAL, ref loop); if (intropath != null) { system.createSound(intropath, MODE.DEFAULT, ref intro); } Playing = false; }