コード例 #1
0
        public void AssignPageRank(AsmAdjancyGraph g)
        {
            if (g.St == MetadataTokenStatus.Error)
            {
                return;
            }
            if (g.Asms == null || !g.Asms.Any())
            {
                return;
            }
            if (g.Graph == null)
            {
                return;
            }
            var keepTemp = ResolveBool(SysCfg.GetAppCfgSetting(APP_SET_KEY_KEEP_TEMP)) ?? false;

            Efx.RTempDir = LogDirectory;
            var pageRank = Efx.GetPageRank(g.Graph, keepTemp);

            if (pageRank == null || !pageRank.Any())
            {
                return;
            }
            for (var i = 0; i < g.Asms.Length; i++)
            {
                var asm = g.Asms.FirstOrDefault(x => x.IndexId == i);
                if (asm == null)
                {
                    continue;
                }
                asm.PageRank = pageRank[i];
            }
        }
コード例 #2
0
        /// <summary>
        /// Sets up the hardware resources used by the controller.
        /// </summary>
        private OpenALSoundController()
        {
            if (AL.NativeLibrary == IntPtr.Zero)
            {
                throw new DllNotFoundException("Couldn't initialize OpenAL because the native binaries couldn't be found.");
            }

            if (!OpenSoundController())
            {
                throw new NoAudioHardwareException("OpenAL device could not be initialized, see console output for details.");
            }

            if (Alc.IsExtensionPresent(_device, "ALC_EXT_CAPTURE"))
            {
                Microphone.PopulateCaptureDevices();
            }

            // We have hardware here and it is ready

            allSourcesArray = new int[MAX_NUMBER_OF_SOURCES];
            AL.GenSources(allSourcesArray);
            ALHelper.CheckError("Failed to generate sources.");
            Filter = 0;
            if (Efx.IsInitialized)
            {
                Filter = Efx.GenFilter();
            }
            availableSourcesCollection = new List <int>(allSourcesArray);
            inUseSourcesCollection     = new List <int>();
        }
コード例 #3
0
        /// <summary>
        /// Dispose of the OpenALSoundCOntroller.
        /// </summary>
        /// <param name="disposing">If true, the managed resources are to be disposed.</param>
        void Dispose(bool disposing)
        {
            if (!_isDisposed)
            {
                if (disposing)
                {
#if DESKTOPGL
                    if (_oggstreamer != null)
                    {
                        _oggstreamer.Dispose();
                    }
#endif
                    for (int i = 0; i < allSourcesArray.Length; i++)
                    {
                        AL.DeleteSource(allSourcesArray[i]);
                        ALHelper.CheckError("Failed to delete source.");
                    }

                    if (Filter != 0 && Efx.IsInitialized)
                    {
                        Efx.DeleteFilter(Filter);
                    }

                    Microphone.StopMicrophones();
                    CleanUpOpenAL();
                }
                _isDisposed = true;
            }
        }
コード例 #4
0
        /// <summary>
        /// Sets up the hardware resources used by the controller.
        /// </summary>
        private OpenALSoundController()
        {
#if WINDOWS
            // On Windows, set the DLL search path for correct native binaries
            NativeHelper.InitDllDirectory();
#endif

            if (!OpenSoundController())
            {
                return;
            }
            // We have hardware here and it is ready
            _bSoundAvailable = true;

            allSourcesArray = new int[MAX_NUMBER_OF_SOURCES];
            AL.GenSources(allSourcesArray);
            ALHelper.CheckError("Failed to generate sources.");
            Filter = 0;
#if SUPPORTS_EFX
            if (Efx.IsInitialized)
            {
                Filter = Efx.GenFilter();
            }
#endif
            availableSourcesCollection = new List <int>(allSourcesArray);
            inUseSourcesCollection     = new List <int>();
        }
コード例 #5
0
ファイル: UtilityMethods.cs プロジェクト: nofuture-git/31g
        internal Tuple <int, int, double>[] ResolveTokenPageRanks(TokenIdResponse tokens)
        {
            if (tokens == null)
            {
                return(null);
            }
            var adjGraph = tokens.GetAsRoot().GetAdjancencyMatrix(true);

            Efx.RTempDir = _myProgram.LogDirectory;
            var pageRank = Efx.GetPageRank(adjGraph.Item2);
            var idx      = adjGraph.Item1;
            var valsOut  = new List <Tuple <int, int, double> >();

            for (var i = 0; i < idx.Count; i++)
            {
                if (i >= pageRank.Length)
                {
                    break;
                }
                var asmIdx = idx[i].RslvAsmIdx;
                var token  = idx[i].Id;
                var pr     = pageRank[i];
                valsOut.Add(new Tuple <int, int, double>(asmIdx, token, pr));
            }

            return(valsOut.ToArray());
        }
コード例 #6
0
        /// <summary>
        /// Sets up the hardware resources used by the controller.
        /// </summary>
        private OpenALSoundController()
        {
#if WINDOWS
            // On Windows, set the DLL search path for correct native binaries
            NativeHelper.InitDllDirectory();
#endif

            if (!OpenSoundController())
            {
                throw new NoAudioHardwareException("OpenAL device could not be initialized, see console output for details.");
            }

            if (Alc.IsExtensionPresent(_device, "ALC_EXT_CAPTURE"))
            {
                Microphone.PopulateCaptureDevices();
            }

            // We have hardware here and it is ready

            allSourcesArray = new int[MAX_NUMBER_OF_SOURCES];
            AL.GenSources(allSourcesArray);
            ALHelper.CheckError("Failed to generate sources.");
            Filter = 0;
            if (Efx.IsInitialized)
            {
                Filter = Efx.GenFilter();
            }
            availableSourcesCollection = new List <int>(allSourcesArray);
            inUseSourcesCollection     = new List <int>();
        }
コード例 #7
0
        /// <summary>
        /// Sets up the hardware resources used by the controller.
        /// </summary>
        private OpenALSoundController()
        {
            if (!OpenSoundController())
            {
                return;
            }
            // We have hardware here and it is ready
            _bSoundAvailable = true;

            allSourcesArray = new int[MAX_NUMBER_OF_SOURCES];
            AL.GenSources(allSourcesArray);
            ALHelper.CheckError("Failed to generate sources.");
            Filter = 0;
#if SUPPORTS_EFX
            if (Efx.IsInitialized)
            {
                Filter = Efx.GenFilter();
            }
#endif
            availableSourcesCollection = new List <int>(allSourcesArray);
            inUseSourcesCollection     = new List <int>();
        }
コード例 #8
0
        /// <summary>
        /// Disposes the <see cref="ALController"/>.
        /// </summary>
        /// <param name="disposing">If true, the managed resources are to be disposed.</param>
        private void Dispose(bool disposing)
        {
            if (!_isDisposed)
            {
                if (disposing)
                {
                    Streamer.Dispose();

                    if (Filter != 0 && Efx.IsAvailable)
                    {
                        Efx.DeleteFilter(Filter);
                    }

                    SoundEffectInstancePool.DisposeInstances();

                    AL.DeleteSources(_allSources);
                    ALHelper.CheckError("Failed to delete source.");

                    Microphone.StopMicrophones();
                    DestroyContexts();
                }
                _isDisposed = true;
            }
        }
コード例 #9
0
 public AudioSource PlayLoopEfx(Efx efx, Vector3 position)
 {
     return(PlayLoopEfx((int)efx, position));
 }
コード例 #10
0
ファイル: AudioEffect.cs プロジェクト: eriksk/skoggylib
 public override void BindTo(Sound sound)
 {
     Efx.Filter(FilterId, EfxFilterf.LowpassGainHF, Gain);
     Efx.BindFilterToSource(sound.Source, FilterId);
     ALHelpers.CheckError();
 }