Giter Club home page Giter Club logo

ddjsb2's Introduction

DDJSB2

Pioneer DDJ-SB2 Reactive Library

https://www.pioneerdj.com/en-us/product/controller/archive/ddj-sb2/black/overview/

Simple Usage

using System.Linq;
using System.Reactive;

using(var ddjsb2 = PioneerDDJSB2.CreateInstance())
{
    // Deck 1 Left side
    var deckNumber = 1;

    // Find the button "Play" on Deck 1 and write to the console when pressed or released
    var playSubscription = (ddjsb2.ChannelControls[deckNumber].First(x => x.Name == "Play") as Button)
        .Subscribe(x => Console.WriteLine("Play Button Event"), ex => Console.WriteLine($"Exception : {ex}"));

    // Find the button "Cue" on Deck 2 light the button LED when pressed and perform an action
    var cueSubscription = (ddjsb2.ChannelControls[2].First(x => x.Name == "Cue") as Button)
        .Subscribe(x => ButtonEvent(ddjsb2, Leds.Deck.Deck2, x), ex => Console.WriteLine($"Exception : {ex}"));

    // Wait until shutdown

    playSubscription.Dispose();
    cueSubscription.Dispose();
}

private static void ButtonEvent(PioneerDDJSB2 ddjsb2, Leds.Deck deck, IState state)
{
    Console.WriteLine($"Button Event: {state.Control.Name}");

    var button = state.Control as Button;
    var on = button.NoteValue > 0;

    // Light the LED when pressed
    ddjsb2.LedControl(deck, Leds.CueLed, false, on);

    if (on)
    {
        // Do something
    }
}

ddjsb2's People

Contributors

bobhelander avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.