Coder Social home page Coder Social logo

2bbb / prolink-connect Goto Github PK

View Code? Open in Web Editor NEW

This project forked from evanpurkhiser/prolink-connect

0.0 0.0 0.0 1.61 MB

A Typescript / JavaScript library that is able to talk to Pioneer PROLINK enabled DJ equipment

Home Page: https://prolink-connect.vercel.app

License: MIT License

JavaScript 0.26% TypeScript 81.43% Kaitai Struct 18.31%

prolink-connect's Introduction

prolink-connect

Pioneer's PRO DJ LINK protocol, unlocked.
Consume CDJ states + Retrieve complete track metadata.

build npm


This library implments the Pioneer PROLINK network protocol + additional functionality to interact with the prolink network. This library is used as part of Prolink Tools.

Alternative implementations of the Prolink protocol: Java, golang.

Thank you to @brunchboy for his work on dysentery.

Features

  • Written in Typescript - Accurate typings making implementation a breeze. Autocompete your DJ tools to completion.

  • CDJ Status - Receive Player state details for each CDJ on the network. The status is reported as a CDJStatus.State.

  • Metadata Database - Access metadata of currently the currently playing (or not!) tracks stored in the connected Rekordbox formatted USB / SD device, or via Rekordbox link.

Library usage

Connecting to the network

To talk with Prolink devices on the network you'll first need to...

  1. Bring the network online
  2. Configure the network to be connected to.
  3. Connect to the devices on the network
import {bringOnline} from 'prolink-connect';

async function main() {
  // Bring the prolink network online.
  //
  // This will begin listening for prolink devices on the network that send
  // regular announcment packets over UDP.
  //
  // This will FAIL if Rekordbox is running on the same computer, or a second
  // instance of the prolink-connect library is running on the same machine.
  console.info('Bringing the network online');
  const network = await bringOnline();

  // Once online we can listen for appearning on the network
  network.deviceManager.on('connected', device =>
    console.log('New device on network:', device)
  );

  // To configure the online network to be "connected" we must need to specify
  // what network device to use to announce ourselves as a "virtual" device
  // onto the network, and what ID we want to announce ourselves as. By
  // announcing ourselves this will cause other devices to send us more detailed
  // information.
  //
  // There are two ways to configure the network:
  //
  // 1. Automatically - You can ask prolink-connect to wait for a device to
  //    appear on the network to determine what network interface devices exist
  //    on. Device ID 5 will be used in auto configure mode.
  //
  // 2. Manually - In this case you will need to manually specify the network
  //    device and device ID.
  //
  // NOTES on the Device ID:
  //
  //  It's recommended that you use a Device ID of `5` for the virtual device.
  //  Using a ID between 1 - 6 will take up ONE SLOT on the network that normally
  //  a CDJ would occupy. When a 1-6 ID is used You may ONLY HAVE 5 CDJs on the
  //  network. Attempting to connect a 6th CDJ will conflict with the virtual
  //  device announced on the network by prolink-connect. (On models older than
  //  2000s the rande is 1-4.)
  //
  //  There are some cases where you may want your virtual device to announce
  //  itself with "real" device ID, but this library does not currently support
  //  the scenarios that would requrie that (Becoming master and sending a master
  //  tempo)

  // 1. AUTO CONFIGURATION
  console.info('Auto configuring the network');
  await network.autoconfigFromPeers();

  // 2. MANUAL CONFIGURATION
  //
  // const configuredIface = getNetworkInterfaceInfoIPv4()
  // network.configure({vcdjId: 2, iface: configuredIface})

  // We can now connect to the network.
  //
  // This will begin announcing ourself on the network, as well as enable various
  // services on the network service object.
  console.info('Connecting to the network');
  await network.connect();

  // If you're using trypescript, you can now type guard [0] to coerce the type
  // to ProlinkNetworkConnected, marking all services as non-null.
  //
  // [0]: https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-type-predicates
  //
  // You don't need to do this if you're not using trypescript
  if (!network.isConnected()) {
    console.error('Failed to connect to the network');
    return;
  }
}

prolink-connect's People

Contributors

evanpurkhiser avatar dependabot[bot] avatar chrisle 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.