RKPolyMux - the polymuxer

The Polymuxer class can be used to generate the RK002’s polymux effect.

Demonstration of it’s usage below is part of the Digitakt DUY.

#include "RKPolyMux.h"
RKPolyMux polymux;

// Handler for ALL MIDI channel messages: used for adding messages to polymux engine
bool RK002_onChannelMessage(byte sts, byte d1, byte d2)
{
  bool thru = true;

  // is it on our midi channel?
  if ((sts & 0x0f) == pChannel)
  {
    // don't send through
    thru = false;

    // but feed channel messages to polymux handler
    polymux.inputChannelMessage(sts,d1,d2);
  }

  return thru;
}

// handles polymux engine midi output,
void onPolyMuxOutput(void *userarg, byte polymuxidx, byte sts, byte d1, byte d2)
{
  byte chn = RK002_paramGet(PMUXBASECH)- 1 + polymuxidx; // 'polymuxidx' is auto incremented by polymux

  if (chn <= 15)
  {
    sts |= chn; // Bitwise OR: channel will be added to message type 'sts'
    RK002_sendChannelMessage(sts,d1,d2);
  }
}

void setup()
{
  polymux.setOutputHandler(onPolyMuxOutput,0);
  polymux.setPolyphony(8); // 8 channels polymux
}
Shopping cart0
There are no products in the cart!
Continue shopping
0