Exemplo n.º 1
0
        public void Support_Balance()
        {
#if NCRUNCH
            Assert.Inconclusive("skip for NCrunch");
#endif

            var ctx = new CreationContext {
                VolumeEndpoint = CoreAudio.GetDefaultVolumeEndpoint()
            };

            var sut = ctx.Create();

            var       duration = TimeSpan.FromSeconds(3);
            const int n        = 50;

            var dt = (int)(duration.TotalMilliseconds / n);
            for (var i = 1; i <= n; i++)
            {
                var balance = Math.Sin(2 * i * Math.PI / n);
                sut.Balance = balance;

                Thread.Sleep(dt);

                sut.Balance.Should().BeApproximately(balance, VlcMediaPlayer.BalanceEps);
            }
        }
Exemplo n.º 2
0
        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterType <VlcMediaPlayer>().As <IMediaPlayer>();

            new VlcConfiguration().VerifyVlcPresent();

            try
            {
                // register AudioEndPointVolume (requires logged on user)
                if (Environment.UserInteractive)
                {
                    builder.RegisterInstance(CoreAudio.GetDefaultVolumeEndpoint());
                }
            }
            catch (COMException ex)
            {
                Trace.TraceError($"Well, do you have a sound card installed? Make sure the service is running (esp. when you running the app on a server): {ex}");
            }
        }