Tutorial   Class/Enum List   File List   Compound Members  

KDjExtended Class Reference

A extended class for realtime i/o communication with KDJ devices. More...

#include <KontrolDj.h>

Inheritance diagram for KDjExtended:

KDjKernel List of all members.

Public Types

enum  BUTTON {
  button_two_A, button_three_A, button_four_A, button_play_A,
  button_bank_A, button_shift_A, button_one_A, button_stop_A,
  reserved_track2_A, reserved_track1_A, reserved_jog2_A, reserved_jog1_A,
  button_lever_A, button_pfl_A, button_select_A, button_pot_bank_A,
  button_two_B, button_three_B, button_four_B, button_play_B,
  button_bank_B, button_shift_B, button_one_B, button_stop_B,
  reserved_track2_B, reserved_track1_B, reserved_jog2_B, reserved_jog1_B,
  button_lever_B, button_pfl_B, button_select_B, button_pot_bank_B
}
 Defined KDjExtended buttons. More...
enum  ENCODER { encoder_track_A, encoder_jog_A, encoder_track_B, encoder_jog_B }
 Defined KDjExtended encoders. More...
enum  POTENTIOMETER {
  pot_crossfader, pot_two_A, pot_three_A, pot_four_A,
  pot_pitch_A, pot_one_A, pot_volume_B, pot_volume_A,
  pot_three_B, pot_two_B, pot_four_B, pot_one_B,
  pot_pitch_B
}
 Defined KDjExtended potentiometers. More...
enum  LED {
  led_pot_bank_B, led_pfl_B, led_play_B, led_four_B,
  led_three_B, led_stop_B, led_one_B, led_two_B,
  led_pot_bank_A, led_pfl_A, led_play_A, led_four_A,
  led_three_A, led_stop_A, led_one_A, led_two_A
}
 Defined KDjExtended leds. More...

Public Member Functions

 KDjExtended ()
 Default constructor.
 ~KDjExtended ()
 The destructor closes any open device connections.
void getControllerMode (void)
 Request for the current mode of operation of the controller.
void setControllerMode (unsigned char mode=0)
 Set the current mode of operation of the controller.
void getMidiMergerState ()
 Request for the current midi merger state of the controller.
void setMidiMergerState (unsigned char globalMergerState=1, unsigned char usbOutMergerState=1, unsigned char midiOutMergerState=1)
 Set the current midi merger state of the controller.
void getLedState (unsigned char led)
 Request for the led state (on / off).
void setLedState (unsigned char led, unsigned char state)
 Set the state of a led (on / off).
void getLedsStates (void)
 Request for the states of all the leds (on / off).
void setLedsStates (unsigned int states)
 Set the states of all the leds (on / off).
void getButtonsStates (void)
 Request for the states of all the buttons (up / down).
void getPotentiometerValue (unsigned char potentiometer)
 Request for the potentiometer value (8 bits).
virtual void doBufferProcessing (void)
 Read a message from the receive buffer queue which is processed.

Protected Member Functions

virtual void onGetControllerMode (unsigned char mode)
 Called when the mode of operation of the controller has been received. Virtual.
virtual void onGetMidiMergerState (unsigned char globalMergerState, unsigned char usbOutMergerState, unsigned char midiOutMergerState)
virtual void onGetLedState (unsigned char led, unsigned char state)
 Called when the state of a led has been received. Virtual.
virtual void onGetLedsStates (unsigned int states)
 Called when the states of all the leds has been received. Virtual.
virtual void onGetButtonsStates (unsigned int states)
 Called when the states of all the buttons has been received. Virtual.
virtual void onGetPotentiometerValue (unsigned char potentiometer, unsigned char value)
 Called when the value of a potentiometer has been received. Virtual.
virtual void onButtonPress (unsigned char button, unsigned char flags, std::vector< unsigned char > *midiMessage)
 Called when a button has been pressed. Virtual.
virtual void onButtonRelease (unsigned char button, unsigned char flags, std::vector< unsigned char > *midiMessage)
 Called when a button has been released. Virtual.
virtual void onPotentiometerChange (unsigned char potentiometer, unsigned char flags, unsigned char value, std::vector< unsigned char > *midiMessage)
 Called when a potentiometer has been moved/turned. Virtual.
virtual void onEncoderIncrement (unsigned char encoder, unsigned char flags, unsigned char speed, std::vector< unsigned char > *midiMessage)
 Called when a encoder has been turned right (increment). Virtual.
virtual void onEncoderDecrement (unsigned char encoder, unsigned char flags, unsigned char speed, std::vector< unsigned char > *midiMessage)
 Called when a encoder has been turned left (decrement). Virtual.
virtual void onEncoderStart (unsigned char encoder, unsigned char flags, std::vector< unsigned char > *midiMessage)
 Called at the start of the encoder movement. Virtual.
virtual void onEncoderStop (unsigned char encoder, unsigned char flags, std::vector< unsigned char > *midiMessage)
 Called at the stop of the encoder movement. Virtual.
virtual void onReceiveMidiMessage (unsigned char status, unsigned char data1, unsigned char data2)
 Called when a midi message has been received from the midi in port of KDj (MIDI MERGER). Virtual.

Detailed Description

A extended class for realtime i/o communication with KDJ devices.

This class provides a platform-independent API for realtime high level i/o communication with KDJ devices. It allows one to set the mode of operation of the controller, turn on/off the leds, request controls states (leds, buttons) and values (potentiometers).

The class also provides several "handler" methods (onButtonPress, onPotentiometerChange... ), these do nothing in the base class, but a derived class can override them to implement any special processing that should occur as a result of their event actions.

Create multiple instances of this class to connect to more than one Kontrol Dj device at the same time.

Definition at line 303 of file KontrolDj.h.


Member Enumeration Documentation

enum KDjExtended::BUTTON
 

Defined KDjExtended buttons.

Enumeration values:
button_two_A 
button_three_A 
button_four_A 
button_play_A 
button_bank_A 
button_shift_A 
button_one_A 
button_stop_A 
reserved_track2_A 
reserved_track1_A 
reserved_jog2_A 
reserved_jog1_A 
button_lever_A 
button_pfl_A 
button_select_A 
button_pot_bank_A 
button_two_B 
button_three_B 
button_four_B 
button_play_B 
button_bank_B 
button_shift_B 
button_one_B 
button_stop_B 
reserved_track2_B 
reserved_track1_B 
reserved_jog2_B 
reserved_jog1_B 
button_lever_B 
button_pfl_B 
button_select_B 
button_pot_bank_B 

Definition at line 308 of file KontrolDj.h.

enum KDjExtended::ENCODER
 

Defined KDjExtended encoders.

Enumeration values:
encoder_track_A 
encoder_jog_A 
encoder_track_B 
encoder_jog_B 

Definition at line 345 of file KontrolDj.h.

enum KDjExtended::POTENTIOMETER
 

Defined KDjExtended potentiometers.

Enumeration values:
pot_crossfader 
pot_two_A 
pot_three_A 
pot_four_A 
pot_pitch_A 
pot_one_A 
pot_volume_B 
pot_volume_A 
pot_three_B 
pot_two_B 
pot_four_B 
pot_one_B 
pot_pitch_B 

Definition at line 354 of file KontrolDj.h.

enum KDjExtended::LED
 

Defined KDjExtended leds.

Enumeration values:
led_pot_bank_B 
led_pfl_B 
led_play_B 
led_four_B 
led_three_B 
led_stop_B 
led_one_B 
led_two_B 
led_pot_bank_A 
led_pfl_A 
led_play_A 
led_four_A 
led_three_A 
led_stop_A 
led_one_A 
led_two_A 

Definition at line 372 of file KontrolDj.h.


Constructor & Destructor Documentation

KDjExtended::KDjExtended  )  [inline]
 

Default constructor.

An exception will be thrown if a system initialization error occurs.

Definition at line 396 of file KontrolDj.h.

KDjExtended::~KDjExtended  )  [inline]
 

The destructor closes any open device connections.

Definition at line 399 of file KontrolDj.h.


Member Function Documentation

void KDjExtended::getControllerMode void   ) 
 

Request for the current mode of operation of the controller.

Kontrol Dj controller can operate in two modes, master and slave. The main difference between the both modes is that in master mode the leds are managed automatically by the controller and in slave mode you must to turn on/off the leds. An exception is thrown if an error occurs while attempting to get the controller mode.

See also:
onGetControllerMode event handler for more info.

void KDjExtended::setControllerMode unsigned char  mode = 0  ) 
 

Set the current mode of operation of the controller.

An exception is thrown if an error occurs while attempting to set the controller mode.

Parameters:
mode Set to '0' to make the controller operate in default (master) mode. Set to '1' to make the controller operate in slave mode.
See also:
getControllerMode for more info.

void KDjExtended::getMidiMergerState  ) 
 

Request for the current midi merger state of the controller.

Kontrol Dj controller midi merger functionallity can be enabled or disabled. Incoming midi messages (throught midi in port) can be merger to midi out port and/or usb out port. An exception is thrown if an error occurs while attempting to get the midi merger state.

See also:
onGetMidiMergerState event handler for more info.

void KDjExtended::setMidiMergerState unsigned char  globalMergerState = 1,
unsigned char  usbOutMergerState = 1,
unsigned char  midiOutMergerState = 1
 

Set the current midi merger state of the controller.

An exception is thrown if an error occurs while attempting to set the midi merger state.

Parameters:
globalMergerState Set to '0' to disable midi merger functionallity. Set to '1' to enable midi merger functionallity.
usbOutMergerState Set to '0' to disable usb out merger functionallity. Set to '1' to enable usb out merger functionallity.
midiOutMergerState Set to '0' to disable midi out merger functionallity. Set to '1' to enable midi out merger functionallity.
See also:
getMidiMergerState for more info.

void KDjExtended::getLedState unsigned char  led  ) 
 

Request for the led state (on / off).

An exception is thrown if an error occurs while attempting to get the led state.

Parameters:
led Number of the led.
See also:
onGetLedState event handler for more info. LED for more info about the names and numbers of the leds.

void KDjExtended::setLedState unsigned char  led,
unsigned char  state
 

Set the state of a led (on / off).

An exception is thrown if an error occurs while attempting to set the led state.

Parameters:
led Number of the led.
state Set to '1' to turn on the led or set to '0' to turn off the led.
See also:
LED for more info about the names and numbers of the leds.

void KDjExtended::getLedsStates void   ) 
 

Request for the states of all the leds (on / off).

An exception is thrown if an error occurs while attempting to get all the leds states.

See also:
onGetLedsStates event handler for more info.

void KDjExtended::setLedsStates unsigned int  states  ) 
 

Set the states of all the leds (on / off).

An exception is thrown if an error occurs while attempting to set all the leds states.

Parameters:
states The states parameter must be interpreted as a bitfield (16 bits) which contains the leds states. For example:
  • setLedsStates( 0x0000 ); // Turn off all the leds.
  • setLedsStates( 0xFFFF ); // Turn on all the leds.

void KDjExtended::getButtonsStates void   ) 
 

Request for the states of all the buttons (up / down).

An exception is thrown if an error occurs while attempting to get all the buttons states.

See also:
onGetButtonsStates event handler for more info.

void KDjExtended::getPotentiometerValue unsigned char  potentiometer  ) 
 

Request for the potentiometer value (8 bits).

An exception is thrown if an error occurs while attempting to get the potentiometer value.

Parameters:
potentiometer Number of the potentiometer.
See also:
onGetPotentiometerValue event handler for more info.

virtual void KDjExtended::doBufferProcessing void   )  [virtual]
 

Read a message from the receive buffer queue which is processed.

Each time this method is called a message from the receive buffer queue is read. The message is processed, if the message has an avaliable event "handler" method then it will be called.

virtual void KDjExtended::onGetControllerMode unsigned char  mode  )  [inline, protected, virtual]
 

Called when the mode of operation of the controller has been received. Virtual.

This method does nothing in the base class, it is avaliable for the derived class to override. Use the onGetControllerMode event handler to implement any special processing that should occur as a result of getting the controller mode of operation.

Parameters:
mode Indicates the current mode of operation of the controller: 'O' if the controller is in master mode or '1' if the controller is in slave mode.
See also:
getControllerMode function for more info.

Definition at line 533 of file KontrolDj.h.

virtual void KDjExtended::onGetMidiMergerState unsigned char  globalMergerState,
unsigned char  usbOutMergerState,
unsigned char  midiOutMergerState
[inline, protected, virtual]
 

This method does nothing in the base class, it is avaliable for the derived class to override. Use the onGetMidiMergerState event handler to implement any special processing that should occur as a result of getting the midi merger state of the controller.

Parameters:
globalMergerState Indicates the current global midi merger state of the controller: 'O' if midi merger is disabled or '1' if the midi merger is enabled.
usbOutMergerState Indicates the current usb out merger state of the controller: 'O' if it's disabled or '1' if it's enabled.
midiOutMergerState Indicates the current midi out merger state of the controller: 'O' if it's disabled or '1' if it's enabled.
See also:
getMidiMergerState function for more info.

Definition at line 549 of file KontrolDj.h.

virtual void KDjExtended::onGetLedState unsigned char  led,
unsigned char  state
[inline, protected, virtual]
 

Called when the state of a led has been received. Virtual.

This method does nothing in the base class, it is avaliable for the derived class to override. Use the onGetLedState event handler to implement any special processing that should occur as a result of getting the state of a led.

Parameters:
led Indicates the number of the led.
state Indicates the current state of the led: '0' if the led is off or '1' if the led is on.
See also:
getLedState function for more info. LED for more info about the names and numbers of the leds.

Definition at line 564 of file KontrolDj.h.

virtual void KDjExtended::onGetLedsStates unsigned int  states  )  [inline, protected, virtual]
 

Called when the states of all the leds has been received. Virtual.

This method does nothing in the base class, it is avaliable for the derived class to override. Use the onGetLedsStates event handler to implement any special processing that should occur as a result of getting the states of all the leds.

Parameters:
states The states parameter must be interpreted as a bitfield (16 bits). It indicates the current states of all the leds. To test if one led is on, use the & (and) operator: if(states & LED_PLAY_A) { // The led "LED_PLAY_A" is on. }
See also:
getLedsStates function for more info.

Definition at line 582 of file KontrolDj.h.

virtual void KDjExtended::onGetButtonsStates unsigned int  states  )  [inline, protected, virtual]
 

Called when the states of all the buttons has been received. Virtual.

This method does nothing in the base class, it is avaliable for the derived class to override. Use the onGetButtonsStates event handler to implement any special processing that should occur as a result of getting the states of all the buttons.

Parameters:
states The states parameter must be interpreted as a bitfield (32 bits). It indicates the current states of all the buttons. To test if one button is released, use the & (and) operator: if(states & BUTTON_PLAY_A) { // The button "BUTTON_PLAY_A" is released. }
See also:
getButtonsStates function for more info.

Definition at line 600 of file KontrolDj.h.

virtual void KDjExtended::onGetPotentiometerValue unsigned char  potentiometer,
unsigned char  value
[inline, protected, virtual]
 

Called when the value of a potentiometer has been received. Virtual.

This method does nothing in the base class, it is avaliable for the derived class to override. Use the onGetPotentiometerValue event handler to implement any special processing that should occur as a result of getting the value of a potentiometer.

Parameters:
potentiometer Indicates the number of the potentiometer.
value Indicates the value of the potentiometer (8 bits).
See also:
getPotentiometerValue function for more info.

Definition at line 613 of file KontrolDj.h.

virtual void KDjExtended::onButtonPress unsigned char  button,
unsigned char  flags,
std::vector< unsigned char > *  midiMessage
[inline, protected, virtual]
 

Called when a button has been pressed. Virtual.

This method does nothing in the base class, it is avaliable for the derived class to override. Use the onButtonPress event handler to implement any special processing that should occur as a result of pressing a button.

Parameters:
button Indicates which button has been pressed.
flags The flags parameter must be interpreted as a bitfield. It indicates whether the Shift'X', Button_Bank'X', and Knobs_Bank'X' buttons are combined with the button pressed.
midiMessage Midi message assigned to the button in the KDj firmware.
See also:
BUTTON for more info about the names and numbers of the buttons. KontrolDj.h for avaliable flags.

Definition at line 629 of file KontrolDj.h.

virtual void KDjExtended::onButtonRelease unsigned char  button,
unsigned char  flags,
std::vector< unsigned char > *  midiMessage
[inline, protected, virtual]
 

Called when a button has been released. Virtual.

This method does nothing in the base class, it is avaliable for the derived class to override. Use the onButtonRelease event handler to implement any special processing that should occur as a result of releasing a button.

Parameters:
button Indicates which button has been released.
flags The flags parameter must be interpreted as a bitfield. It indicates whether the Shift'X', Button_Bank'X', and Knobs_Bank'X' buttons are combined with the button released.
midiMessage Midi message assigned to the button in the KDj firmware.
See also:
BUTTON for more info about the names and numbers of the buttons. KontrolDj.h for avaliable flags.

Definition at line 645 of file KontrolDj.h.

virtual void KDjExtended::onPotentiometerChange unsigned char  potentiometer,
unsigned char  flags,
unsigned char  value,
std::vector< unsigned char > *  midiMessage
[inline, protected, virtual]
 

Called when a potentiometer has been moved/turned. Virtual.

This method does nothing in the base class, it is avaliable for the derived class to override. Use the onPotentiometerChange event handler to implement any special processing that should occur as a result of moving/turning a potentiometer.

Parameters:
potentiometer Indicates which potentiometer has been moved/turned.
flags The flags parameter must be interpreted as a bitfield. It indicates whether the Shift'X', Button_Bank'X', and Knobs_Bank'X' buttons are combined with the potentiomer moved/turned.
value Indicates the current value of the potentiometer.
midiMessage Midi message assigned to the potentiometer in the KDj firmware.
See also:
POTENTIOMETER for more info about the names and numbers of the potentiometers. KontrolDj.h for avaliable flags.

Definition at line 662 of file KontrolDj.h.

virtual void KDjExtended::onEncoderIncrement unsigned char  encoder,
unsigned char  flags,
unsigned char  speed,
std::vector< unsigned char > *  midiMessage
[inline, protected, virtual]
 

Called when a encoder has been turned right (increment). Virtual.

This method does nothing in the base class, it is avaliable for the derived class to override. Use the onEncoderIncrement event handler to implement any special processing that should occur as a result of turning right a encoder.

Parameters:
encoder Indicates which encoder has been turned right.
flags The flags parameter must be interpreted as a bitfield. It indicates whether the Shift'X', Button_Bank'X', and Knobs_Bank'X' buttons are combined with the encoded turned right.
speed Indicates the actual speed of the encoder.
midiMessage Midi message assigned to the encoder in the KDj firmware.
See also:
ENCODER for more info about the names and numbers of the encoders. KontrolDj.h for avaliable flags.

Definition at line 679 of file KontrolDj.h.

virtual void KDjExtended::onEncoderDecrement unsigned char  encoder,
unsigned char  flags,
unsigned char  speed,
std::vector< unsigned char > *  midiMessage
[inline, protected, virtual]
 

Called when a encoder has been turned left (decrement). Virtual.

This method does nothing in the base class, it is avaliable for the derived class to override. Use the onEncoderDecrement event handler to implement any special processing that should occur as a result of turning left a encoder.

Parameters:
encoder Indicates which encoder has been turned right.
flags The flags parameter must be interpreted as a bitfield. It indicates whether the Shift'X', Button_Bank'X', and Knobs_Bank'X' buttons are combined with the encoded turned left.
speed Indicates the actual speed of the encoder.
midiMessage Midi message assigned to the encoder in the KDj firmware.
See also:
ENCODER for more info about the names and numbers of the encoders. KontrolDj.h for avaliable flags.

Definition at line 696 of file KontrolDj.h.

virtual void KDjExtended::onEncoderStart unsigned char  encoder,
unsigned char  flags,
std::vector< unsigned char > *  midiMessage
[inline, protected, virtual]
 

Called at the start of the encoder movement. Virtual.

This method does nothing in the base class, it is avaliable for the derived class to override. Use the onEncoderStart event handler to implement any special processing that should occur as a result of starting a encoder movement (turn right or turn left).

Parameters:
encoder Indicates which encoder has been started to move.
flags The flags parameter must be interpreted as a bitfield. It indicates whether the Shift'X', Button_Bank'X', and Knobs_Bank'X' buttons are combined with the encoder movement.
midiMessage Midi message assigned to the encoder in the KDj firmware.
See also:
ENCODER for more info about the names and numbers of the encoders. KontrolDj.h for avaliable flags.

Definition at line 712 of file KontrolDj.h.

virtual void KDjExtended::onEncoderStop unsigned char  encoder,
unsigned char  flags,
std::vector< unsigned char > *  midiMessage
[inline, protected, virtual]
 

Called at the stop of the encoder movement. Virtual.

This method does nothing in the base class, it is avaliable for the derived class to override. Use the onEncoderStop event handler to implement any special processing that should occur as a result of stopping a encoder movement (turn right or turn left).

Parameters:
encoder Indicates which encoder has been stopped.
flags The flags parameter must be interpreted as a bitfield. It indicates whether the Shift'X', Button_Bank'X', and Knobs_Bank'X' buttons are combined with the encoder.
midiMessage Midi message assigned to the encoder in the KDj firmware.
See also:
ENCODER for more info about the names and numbers of the encoders. KontrolDj.h for avaliable flags.

Definition at line 728 of file KontrolDj.h.

virtual void KDjExtended::onReceiveMidiMessage unsigned char  status,
unsigned char  data1,
unsigned char  data2
[inline, protected, virtual]
 

Called when a midi message has been received from the midi in port of KDj (MIDI MERGER). Virtual.

This method does nothing in the base class, it is avaliable for the derived class to override. Use the onReceiveMidiMessage event handler to implement any special processing that should occur as a result of getting a midi message from the midi in port of the KDj controller.

Parameters:
status First byte (status) of the midi message.
data1 Second byte (data1) of the midi message.
data2 Third byte (data2) of the midi message.

Definition at line 741 of file KontrolDj.h.


The documentation for this class was generated from the following file:
Copyright © 2005 by LSD Software. All Rights Reserved.
Maintained by LSD, info at kontrol-dj.com