예제 #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;
            }
        }
        /// <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
        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
 public override void BindTo(Sound sound)
 {
     Efx.Filter(FilterId, EfxFilterf.LowpassGainHF, Gain);
     Efx.BindFilterToSource(sound.Source, FilterId);
     ALHelpers.CheckError();
 }