User Tools

Site Tools


components_js

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
components_js [2018/03/12 19:19]
be.ing [Setup]
components_js [2019/02/24 15:58] (current)
swiftb0y changed shiftComponent to shiftControl
Line 141: Line 141:
   * **input**: the [[MIDI scripting#​MIDI input handling functions|function that receives MIDI input]]   * **input**: the [[MIDI scripting#​MIDI input handling functions|function that receives MIDI input]]
   * **output**: the [[midi scripting#​Connect output callback functions|function that gets called when outKey changes value]]. Typically this sends MIDI output to the controller to change the state of an LED, but it can do anything.   * **output**: the [[midi scripting#​Connect output callback functions|function that gets called when outKey changes value]]. Typically this sends MIDI output to the controller to change the state of an LED, but it can do anything.
-  * **connect**:​ register ''​output''​ as the callback function that gets executed when the value of the [[mixxxcontrols|Mixxx ControlObject]] specified by ''​group'',​ ''​outKey''​ changes. Implement a custom function if you need to connect callbacks for multiple Mixxx ControlObjects in one Component. Refer to the source code of [[#​SamplerButton|SamplerButton.prototype.connect]] for an example.+  * **connect**:​ register ''​output''​ as the callback function that gets executed when the value of the [[mixxxcontrols|Mixxx ControlObject]] specified by ''​group'',​ ''​outKey''​ changes. This is called automatically by the Component constructor if ''​group''​ and ''​outKey''​ are defined (otherwise it needs to be called after construction). Implement a custom function if you need to connect callbacks for multiple Mixxx ControlObjects in one Component. Refer to the source code of [[#​SamplerButton|SamplerButton.prototype.connect]] for an example.
  
 The following methods are called by the default Component ''​input''​ and ''​output''​ methods, as well as the default ''​input''​ functions of [[#​Button]],​ [[#Pot]], and [[#​Encoder]]. If you do not need to implement complex custom behavior, you can overwrite these instead of the default ''​input''​ and ''​output''​ methods: The following methods are called by the default Component ''​input''​ and ''​output''​ methods, as well as the default ''​input''​ functions of [[#​Button]],​ [[#Pot]], and [[#​Encoder]]. If you do not need to implement complex custom behavior, you can overwrite these instead of the default ''​input''​ and ''​output''​ methods:
Line 170: Line 170:
   * **sendShifted** (boolean, default false): whether to send a second, shifted MIDI message for every call to ''​send''​   * **sendShifted** (boolean, default false): whether to send a second, shifted MIDI message for every call to ''​send''​
   * **shiftChannel** (boolean, default false): whether the shifted MIDI message changes the MIDI channel (second nybble of the first byte of the MIDI signal)   * **shiftChannel** (boolean, default false): whether the shifted MIDI message changes the MIDI channel (second nybble of the first byte of the MIDI signal)
-  * **shiftComponent** (boolean, default false): whether the shifted MIDI message changes the MIDI control number (second byte) of the MIDI signal+  * **shiftControl** (boolean, default false): whether the shifted MIDI message changes the MIDI control number (second byte) of the MIDI signal
   * **shiftOffset** (number, default 0): how much to shift the MIDI channel or control number by   * **shiftOffset** (number, default 0): how much to shift the MIDI channel or control number by
  
Line 284: Line 284:
         number: n,         number: n,
         midi: [0x91, 0x02],         midi: [0x91, 0x02],
 +    });
 +)};
 +</​code>​
 +
 +You can also make the SamplerButtons velocity sensitive by setting the ''​volumeByVelocity:​ true''​ property on the object that gets passed to the constructor. This will change the volume at which the sample is being played at depending on how hard you pressed the button. Obviously, it will only work if your hardware features velocity sensitive buttons.
 +
 +<​code=javascript>​
 +var samplerButtons = [];
 +for (var n = 1; n <= 8; n++) {
 +    samplerButtons[n] = new components.SamplerButton({
 +        number: n,
 +        midi: [0x91, 0x02],
 +        volumeByVelocity:​ true,
     });     });
 )}; )};
Line 309: Line 322:
 )}; )};
 </​code>​ </​code>​
- 
 ==== EffectAssignmentButton ==== ==== EffectAssignmentButton ====
 An EffectAssignmentButton routes a deck through an EffectUnit. It is separate from the [[#​EffectUnit]] ComponentContainer because it is meant to be a part of a [[#Deck]]. Using [[#​Deck|Deck.setCurrentDeck]] to switch decks will switch the deck an EffectAssignmentButton assigns an EffectUnit to. An EffectAssignmentButton routes a deck through an EffectUnit. It is separate from the [[#​EffectUnit]] ComponentContainer because it is meant to be a part of a [[#Deck]]. Using [[#​Deck|Deck.setCurrentDeck]] to switch decks will switch the deck an EffectAssignmentButton assigns an EffectUnit to.
components_js.1520896798.txt.gz ยท Last modified: 2018/03/12 19:19 by be.ing