public static void SpotifySkipCommerical(
            PioneerDDJSB2 ddjsb2,
            string patchParameter,
            IDisposable skippingSubscription,
            Leds.Deck deck,
            Leds.PadGroup group,
            Led led,
            IState state,
            DateTime lastPause)
        {
            var button = state.Control as Button;
            var on     = button.NoteValue > 0;

            if (on)
            {
                // Switch On/Off
                var a1Patch = VoiceMeeter.Remote.GetParameter(patchParameter);
                VoiceMeeter.Remote.SetParameter(patchParameter, a1Patch > 0 ? 0f : 1f);

                var pauseAmount = DateTime.UtcNow - lastPause;
                var muteAmount  = TimeSpan.FromSeconds(30) - pauseAmount;

                if (muteAmount > TimeSpan.FromSeconds(1))
                {
                    ddjsb2.PadLedControl(deck, group, led, false, true);
                    var skipping = System.Reactive.Linq.Observable.Timer(muteAmount);
                    skippingSubscription = skipping.Subscribe(x => ReenableSound(ddjsb2, patchParameter, skippingSubscription, deck, group, led, skipping));
                }
            }
        }
Beispiel #2
0
        // Use a LINQ Expression to send the boolean property to set
        private void HandleForceEffects <T>(
            PioneerDDJSB2 ddjsb2,
            Leds.Deck deck,
            Leds.PadGroup group,
            Led led,
            T targetObject,
            System.Linq.Expressions.Expression <Func <T, bool> > targetExpr,
            IState state)
        {
            var button = state.Control as Button;
            var on     = button.NoteValue > 0;

            // Get the property
            var expr = (System.Linq.Expressions.MemberExpression)targetExpr.Body;
            var prop = (System.Reflection.PropertyInfo)expr.Member;

            // Get the value of the property
            bool effectState = (bool)prop.GetValue(targetObject);

            if (on)
            {
                prop.SetValue(targetObject, !effectState);
            }

            // Light the LED when on
            ddjsb2.PadLedControl(deck, group, led, false, effectState || on);
        }
Beispiel #3
0
        public static void ExplorerLog(PioneerDDJSB2 ddjsb2, Leds.Deck deck, Leds.PadGroup group, Led led, IState state)
        {
            var button = state.Control as Button;
            var on     = button.NoteValue > 0;

            // Light the LED when pressed
            ddjsb2.PadLedControl(deck, group, led, false, on);

            if (on)
            {
                Utils.ExplorerLog().Wait();
            }
        }
Beispiel #4
0
        public static void RestartAudio(PioneerDDJSB2 ddjsb2, Leds.Deck deck, Leds.PadGroup group, Led led, IState state)
        {
            var button = state.Control as Button;
            var on     = button.NoteValue > 0;

            ddjsb2.PadLedControl(deck, group, led, false, on);

            if (on)
            {
                // Restart Audio
                VoiceMeeter.Remote.Restart();
            }
        }
Beispiel #5
0
        private void StopAllEffects(PioneerDDJSB2 ddjsb2, Leds.Deck deck, Leds.PadGroup group, Led led, IState state)
        {
            var button = state.Control as Button;
            var on     = button.NoteValue > 0;

            // Light the LED when on
            ddjsb2.PadLedControl(deck, group, led, false, on);

            if (on)
            {
                msffb2.StopAllEffects();
            }
        }
        private static void ReenableSound(
            PioneerDDJSB2 ddjsb2,
            string patchParameter,
            IDisposable skippingSubscription,
            Leds.Deck deck,
            Leds.PadGroup group,
            Led led,
            IObservable <long> observable)
        {
            VoiceMeeter.Remote.SetParameter(patchParameter, 1f);

            ddjsb2.PadLedControl(deck, group, led, false, false);
            skippingSubscription?.Dispose();
        }