JS Component understanding

Mod your Mixxx: Share your controller mappings, keyboard mappings, skin and script tweaks here!

Moderators: garth, User Customization Moderators

JS Component understanding

Postby sonnybalut » Mon Mar 26, 2018 6:55 pm

Hi,

I'm trying to understand JS Component from the examples, below code works for both decks, but second midi byte does not match the right deck, I specified 0x08 but right deck sends 0x09 and it works. I don't understand, I tried to look at midi-components-0.0.js and it's over my head ;-)

Code: Select all
this.volume = new components.Pot({
  midi: [0xB0 + midiChannel - 1, 0x08],
  inKey: 'volume',
});


My controllers sends B0 08 xx for left deck and sends B0 09 xx for right deck. Portion of my xml
xml left deck
Code: Select all
       <group>[Channel1]</group>
        <key>MIX2GO.leftDeck.volume.input</key>
        <status>0xB0</status>
        <midino>0x08</midino>

xml right deck
Code: Select all
        <group>[Channel2]</group>
        <key>MIX2GO.rightDeck.volume.input</key>
        <status>0xB0</status>
        <midino>0x09</midino>


Thanks,
Sonny
sonnybalut
 
Posts: 6
Joined: Fri Mar 23, 2018 9:49 pm

Re: JS Component understanding

Postby Be. » Mon Mar 26, 2018 7:21 pm

Is there a consistent relationship between the second byte of each control on the different decks? Is it always always 1 more on the right deck than the left?
I heard FLAC and I haven't gone back.
Protect your hearing with earplugs!

Hear my mixes
User avatar
Be.
Mixxx Developer
 
Posts: 2249
Joined: Tue Jan 06, 2015 1:00 am
Location: Chicago, USA

Re: JS Component understanding

Postby kazakore » Mon Mar 26, 2018 8:00 pm

As far as I could understand the MIDI values in Components are only for sending signal back to your controller, IE typically for lighting up LEDs.

As you see the script code specifies leftDeck and rightDeck explicitly in your xml code, so it's targeting the specific Deck component you made for that side.

When you come to do the buttons and want LEDs to light up correctly is when you might start having fun trying to work out how to match values between decks....
kazakore
 
Posts: 468
Joined: Sat Feb 20, 2016 1:38 pm

Re: JS Component understanding

Postby sonnybalut » Mon Mar 26, 2018 8:10 pm

Thanks for the quick response. The controller is a Gemini MIX2GO Pro. The play button are 2 numbers apart (0x4A and 0x4C) and still works except for the green led on the right deck. On the left deck when I press play the led turns on then the track plays, when I press it again the led turns off then the track pause. On the right deck when I press play the led does not turn on and the track starts playing, when I press it again the led does not turn on and the track pause.

js code
Code: Select all
  this.play = new components.PlayButton([0x90 + midiChannel -1 ,0x4A]);


xml left deck:
Code: Select all
      <control>
        <group>[Channel1]</group>
        <key>MIX2GO.leftDeck.play.input</key>
        <description></description>
        <status>0x90</status>
        <midino>0x4A</midino>
        <options>
          <script-binding/>
        </options>
      </control>
      <control>
        <group>[Channel1]</group>
        <key>MIX2GO.leftDeck.play.input</key>
        <description></description>
        <status>0x80</status>
        <midino>0x4A</midino>
        <options>
          <script-binding/>
        </options>
      </control>


xml right deck:
Code: Select all
      <control>
        <group>[Channel2]</group>
        <key>MIX2GO.rightDeck.play.input</key>
        <description></description>
        <status>0x90</status>
        <midino>0x4C</midino>
        <options>
          <script-binding/>
        </options>
      </control>
     <control>
        <group>[Channel2]</group>
        <key>MIX2GO.rightDeck.play.input</key>
        <description></description>
        <status>0x80</status>
        <midino>0x4C</midino>
        <options>
          <script-binding/>
        </options>
      </control>
      <control>
sonnybalut
 
Posts: 6
Joined: Fri Mar 23, 2018 9:49 pm

Re: JS Component understanding

Postby Be. » Mon Mar 26, 2018 8:21 pm

You can add a boolean variable to the constructor for your controller's Deck object to distinguish between the left and right decks. In your init function, specify that parameter as true for one deck and false for the other. This would allow you to write code like
Code: Select all
this.play = new components.PlayButton([0x90 + midiChannel -1 , leftDeck ? 0x4A : 0x4C]);
I heard FLAC and I haven't gone back.
Protect your hearing with earplugs!

Hear my mixes
User avatar
Be.
Mixxx Developer
 
Posts: 2249
Joined: Tue Jan 06, 2015 1:00 am
Location: Chicago, USA

Re: JS Component understanding

Postby sonnybalut » Mon Mar 26, 2018 9:14 pm

Thank you this code works.

Code: Select all
  this.play = new components.PlayButton([0x90, (script.deckFromGroup(this.currentDeck) === 1) ? 0x4A : 0x4C]);


On to more learning Components ...
sonnybalut
 
Posts: 6
Joined: Fri Mar 23, 2018 9:49 pm

Re: JS Component understanding

Postby kazakore » Wed Oct 31, 2018 11:03 am

midi: in components is the MIDI signal which is sent to the controller no the controller value it is operating on (which is all configured by sending it in your xml to the right functions)

Is there a consistent relationship between the second byte of each control on the different decks? Is it always always 1 more on the right deck than the left?


Mixxx has NO midi values internal to it! It depends 100% on how your controller has been built.
kazakore
 
Posts: 468
Joined: Sat Feb 20, 2016 1:38 pm


Return to User Customizations

Who is online

Users browsing this forum: No registered users and 2 guests