示例#1
0
文件: BPCM.cs 项目: KyodaiKen/BPCM2
        public Player(string bpcmFile, ConfigurationBean config)
        {
            //First of all check the configs and if in doubt, use default values
            if (config.WaveOutDevice > WaveOut.DeviceCount || config.WaveOutDevice < 0)
            {
                config.WaveOutDevice = 0;
            }
            if (config.WaveOutBufferCount < 2)
            {
                config.WaveOutBufferCount = 2;
            }
            if (config.WaveOutBufferSize == 0)
            {
                config.WaveOutBufferSize = 100;
            }
            if (config.Volume > 1)
            {
                config.Volume = 1f;
            }
            if (config.Volume < 0)
            {
                config.Volume = 0f;
            }
            if (config.PlaybackRate == 0)
            {
                config.PlaybackRate = 1;
            }
            _config = config;

            //Open the BPCM file
            _BPCMFile   = new FileStream(bpcmFile, FileMode.Open, FileAccess.Read, FileShare.Read, 1048576, FileOptions.RandomAccess);
            _BPCMStream = new BitstreamReader(_BPCMFile);
            _BPCMStream.EnableDither = _config.EnableDithering;

            __INTERNAL_WaveOutInit();

            //Determine the used device and fire the init event once.
            WaveOutCapabilities devcaps = WaveOut.GetCapabilities(0);

            for (int x = 0; x < WaveOut.DeviceCount; x++)
            {
                if (x == _WaveOut.DeviceNumber || x != 0)
                {
                    devcaps = WaveOut.GetCapabilities(x);
                }
            }
            _config.WaveOutInitializedEvent?.Invoke(devcaps);
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void durationListedWithUnit()
        public virtual void DurationListedWithUnit()
        {
            ConfigurationBean configurationBean = (( GraphDatabaseAPI )_graphdb).DependencyResolver.resolveDependency(typeof(JmxKernelExtension)).getSingleManagementBean(typeof(ConfigurationBean));

            object v = configurationBean.GetAttribute(GraphDatabaseSettings.log_queries_threshold.name());

            assertEquals("0ms", v);

            AttributeList attrs = configurationBean.GetAttributes(new string[] { GraphDatabaseSettings.log_queries_threshold.name() });

            assertEquals(1, attrs.size());

            Attribute attr = ( Attribute )attrs.get(0);

            assertEquals("0ms", attr.Value);
            assertEquals("dbms.logs.query.threshold = 0ms", attr.ToString());
        }
示例#3
0
        public override void Start()
        {
            _support = ManagementSupport.Load();
            _mbs     = _support.MBeanServer;
            _beans   = new LinkedList <Neo4jMBean>();
            try
            {
                Neo4jMBean bean = new KernelBean(_kernelData, _dataSourceManager, _support);
                _mbs.registerMBean(bean, bean.ObjectName);
                _beans.Add(bean);
            }
            catch (Exception)
            {
                _log.info("Failed to register Kernel JMX Bean");
            }

            foreach (ManagementBeanProvider provider in Service.load(typeof(ManagementBeanProvider)))
            {
                try
                {
                    foreach (Neo4jMBean bean in provider.LoadBeans(_kernelData, _support))
                    {
                        _mbs.registerMBean(bean, bean.ObjectName);
                        _beans.Add(bean);
                    }
                }
                catch (Exception e)
                {
                    _log.info("Failed to register JMX Bean " + provider + " (" + e + ")");
                }
            }
            try
            {
                Neo4jMBean bean = new ConfigurationBean(_kernelData, _support);
                _mbs.registerMBean(bean, bean.ObjectName);
                _beans.Add(bean);
            }
            catch (Exception)
            {
                _log.info("Failed to register Configuration JMX Bean");
            }
        }