Jump to content

Zam

Members
  • Posts

    625
  • Joined

  • Last visited

  • Days Won

    26

Posts posted by Zam

  1. Welcome here 2hb

    Protools don't support mackie control or logic control protocol, only HUI which is different...

    You have to handle it with CC tricks. Two CC to active a function and two CC to turn it off

    0xb0 0x0c 0xzz select a zone

    0xb0 0x2c 0x0p port ON

    0xb0 0x2c 0x4p port OFF

    let say transport record button is zone 0e and port 5

    you should send CC 12(0x0c) value 14(0x0e) followed by CC 44(0x2c) value 5(0x05) to start record

    and CC 12(0x0c) value 14(0x0e) followed by CC 44(0x2c value 69(0x45) to stop record.

    Here you will find a pdf with all zone and port definition https://forum.cockos.com/showthread.php?t=101328

    Best

    Zam

     

     

     

     

  2. Hi all

    I just want to share a setup and configuration to send full 13 or 14bit CV voltage

    For a side project (not fully related to audio) I came across a simple way to perform this :happy:

    I use a AOUT_NG, and hook a summing amp at output

    you need to sum 2 out for 13 bit, or 4 out for 14bit

    then it's just need map split at NGC.

    like this (for 14bit) each CV take care of a quarter:

    MAP11/HWORDI \
    0:0 \
    16383:65535 \
    65535:65535
    
    MAP12/HWORDI \
    0:0 \
    16383:0 \
    32767:65535 \
    65535:65535
    
    MAP13/HWORDI \
    0:0 \
    32767:0 \
    49151:65535 \
    65535:65535
    
    MAP14/HWORDI \
    0:0 \
    49151:0 \
    65535:65535
    
    EVENT_CV  hw_id=1  id=1    type=PitchBend  chn=1  range=map11  value=0 ports=10000000000000000000
    EVENT_CV  hw_id=2  id=2    type=PitchBend  chn=1  range=map12  value=0 ports=10000000000000000000
    EVENT_CV  hw_id=3  id=3    type=PitchBend  chn=1  range=map13  value=0 ports=10000000000000000000
    EVENT_CV  hw_id=4  id=4    type=PitchBend  chn=1  range=map14  value=0 ports=10000000000000000000

    Side note:

    -increasing definition will give you less output as you see

    -you need a good layout and proper grounding/0v reference, for a 0-5V CV (my use case) the step is 300uV !!!

     

    Best

    Zam

     

    • Like 1
  3. Ok, I should say

    41 minutes ago, Zam said:

    By default it forward the receiver velocity value (or note n° value in your case) or a fixed value if you add it to the definition (then it act more like a trigger)

     

    First define the rgbled ID

    with fwd_id:rgbled:ID (if you have event_rgbled id=ID....)

    check in debug mode that the rgbled event receive the value 0 to 127 (according to note n°)

     

    now I have a doubt, look like you have more than one rgbled, I have to think more...

     

    Best

    Zam

     

     

  4. I'm here :happy:

    I never used use_key_number flag, but I think it's exactly for this kind of purpose

    You can't define ^value for the fwd_id.

    By default it forward the receiver value (or note n° in your case) or a fixed value if you add it to the definition (then it act more like a trigger)

    Here it seems you miss the id of the fwd_id=rgbled:id(:optional fixed value)

    Hope this help again.

    Best

    Zam

  5. Hi

    Will you really consider buying 20 TKD fader for a Ramsa ???

    My system use da and ad for every fader, motor driver is pure analogue with pid controller (little more that just a RC circuit...)

    Despite it's midibox HW compatible, I won't recommand it for your project regarding your skill and the actual analogue console involved.

    As a start you better use MF_NG with ALPS dual track, and see how it goes in the desk regarding noise.

    Best

    Zam

     

  6. Hi all

    I want to implement a smart select function for my controler.

    The goal is simple, let say you have 8 button (and led) in a row,

    if you push button 3 and 6, led 3,4,5 and 6 is active

    if you push any button again, only this event is active

    if you push then button 8 and 4, led 4,5,6,7 and 8 is active

    etc...

    Any strategy recommanded to achieve this ?

    I like to avoid NRG for this function but right now I don't see how to handle this with NGC only.

     

    For the moment I have in mid NGR that get first(A) and second(B) value given by button N°

    set a value(C) according to how many button are involved between, C=(B-A)+1

    set a value(D) that give the button offset, D=A-1

    then conditional for each event M,N,O...T like

    if D<1 elsif C>8 set M=on

    if D<2 elsif C>7 set N=on

    if D<3 elsif C>6 set O=on

    ....

    if D<8 elsif C>5 set T=on

     

    I think I will also need a flip in case first button is higher count

    like If C<0 then C=C-(2C)

    As a delay (like 500ms) to let the system don't wait forever if only one button is pressed

     

    Input welcome

     

    Best

    Zam

     

     

  7. Cool :happy:

    But as I suspected, the video you link use TO220 package for "power drive" can't say the transistor ref used here but certainly more than 1A capabilities.

    Check your solenoid datasheet, there is chance ULN2803 can't drive them safely.

    Like with motor, spike current can be consequent.

    Best

    Zam

  8. Hello Phat

    As a start it's a good idea to test what you say !

    Just midi out to audio in (and connection back for playback), maybe with opamp buffer? to scale the 5Vdc, depending of your converter sensitivities, 5Vptp is about 7dBu.

    I still record my juno60 preset to DAW audio track across real juno audio when saving a project. It work well.

    In that case the data stream seem low speed, you can almost ear all bit transfer, 

    also my converters are DC coupled which might help for such recording?

    About code you will certainly slower the baud rate to have a definable data over your converter bit rate (44k1?)

    (I just check, juno60 is 340baud...baud seem to be one bite)

    Best

    Zam

     

     

  9. 16 hours ago, Elektruck said:

    Hello, I would like to experiment with this but the link to the schematic in this article is broken :( 

    I'm looking  for a schematic for dout > solenoid, anybody any idea's?

     

    Hello

    You just need a transistor switching circuit.

    If isolation is requested use an optocoupler.

    Best

    Zam

  10. Hi Chris

     

    53 minutes ago, FantomXR said:

    Lets take the original schematic from the AINSER64 which is basically what I use. If I do not set the jumper J5 at all, I still am able to read out the potentiometer with nearly the full range (starts at 1 instead of 0 and goes up to 125 instead of 127). I'd expect that I either get jittering values or I'm not able to read out the potentiometer in total. 

    That's strange...without any Vref it should not work...I don't have a look at 3208 datasheet recently but don't remember any "sens" that use VDD is case Vref is not here ???

     

    56 minutes ago, FantomXR said:

    I tried to connect the 3.3V to the Vref of the MCP3208. Now I'd expect that I can read out the faders but wouldn't reach 127, because I have not configured them in the NGC via pinrange for 3.3V. But nothing changes here... I get the fullrange of the potentiometer. But jittering continues as soon as I change the colors on the LEDs....

    You get full range because it is given by  Vref ! If Vref=3.3V you get max value when AD input is at 3.3V

    Definitely thinking your led draw enough current to cheat your 0V.

    Is the jitter only at the instant you switch led or change color, or it  jitter stay as soon as you have led ON ?

    Again, check for strong as possible GND path from LED pcb to PSU, as AINSER pcb to psu.

     

    Do you have pcb design of your new layout?

     

    Best

    Zam

     

     

  11. Hi

    Check also for the LM317L, I don't remember if it have the same spec regarding min Vin against Vout

    For local regulation, yes, only Vref (and fader/pot +side), chips supply can stay at +5V logical/digital (VDD).

    10ohm no longer needed, but you have to take care that Vref don't exceed VDD, or you won't have full scale definition.

    If you expect voltage drop at VDD, set Vref regulator to be little below worst VDD drop case (all LED on).

    Best

    Zam

  12. Hey Chris

    What is the amount of your voltage drop? one LED on, all LED on, at PSU terminal, PCB power input, somewhere far from PSU, opposite end of 5v trace

    How is the jitter threshold now, 8bit 9bit 10bit ?

    Also current "call" from LED can momentary "move" your GND

    What you have to measure is voltage change between two GND point

    -AIN 0V pin across common PSU GND

    -AIN 0V pin across fader 0V pin

    Also your 5V rail

    -AIN Vref across fader Vref

     

    More generally, try to look how the same trace/signal move within different place, especially long trace.

    It should give you a clue where instability is. Is the 5V dropping, is the 0V momentary loading a little, etc...

     

    Another test because, it could be low cost fader limitation, use two 5k series resistor (or any sum around 10k) in place of fader, "wiper" (at two resistance junction) is now hardly fixed, half Vref voltage (if 2x5k), and check if consistency at this AIN pin is better or not

     

    If you really need to keep only one PSU, maybe go for a 9 or 12v, and use different onboard regulation for each section, analog and digital, Like LM317 (should run 5V with 9V input) or LM317L for AIN Vref (low current here)

    I was tempted to tell you to just add a 317L from 5V to AIN Vref, but you have to check minimum voltage and minimum IO differential at data sheet, If you end over 3V but super stable it can make the trick... it depend of the noise around

     

    Hope it help

    Best

    Zam

     

  13. Hey Novski

    That's what I understand too.

    Do we still see you around ? you just shift interest to go further with your controller design or you shift whole interest ?

    I'm short at the moment but if I can in the few next week/month I pay you back to have my PCB returned, as 8 or 16 RSAOK fader with coreless motor

    Best

    Zam

  14. On 12/04/2015 at 9:17 PM, TK. said:

    Hi,

     

    it isn't impossible, but difficult to implement.

    Looking at my backlog for various projects, it could take several months until I will find the time to implement such a challenging feature.

     

    So: better don't wait for this and search for alternative solutions.

     

    Best Regards, Thorsten.

    Hey

    Long time I don't look at this, but I'm somehow forced to make the moving fader system natively compatible with protool (HUI only...)

    I ended today with modification at mbng_event.c alowing NRPN event to handle the dual CC (not in NRPN format)

    and it work both way, sending end receiving fader data to/from DAW

    As I'm far from good programmer and C expert

    here is what I do, input and comment welcome about method I use to achieve this, in case it was completely bad strategy.

    to send:

    /////////////////////////////////////////////////////////////////////////////
    //! Sends a NRPN event. Skips address bytes if they already have been sent!
    /////////////////////////////////////////////////////////////////////////////
    s32 MBNG_EVENT_SendOptimizedNRPN(mios32_midi_port_t port, mios32_midi_chn_t chn, u16 nrpn_address, u16 nrpn_value, u8 msb_only)
    {
      u8 nrpn_address_msb = (nrpn_address >> 7) & 0x7f;
      u8 nrpn_address_lsb = (nrpn_address >> 0) & 0x7f;
      u8 nrpn_value_msb = (nrpn_value >> 7) & 0x7f;
      u8 nrpn_value_lsb = (nrpn_value >> 0) & 0x7f;
    
      // create MIDI package
      mios32_midi_package_t p;
      p.ALL = 0;
      p.type = CC;
      p.event = CC;
      p.chn = chn;
    
      // quick&dirty
    #if MBNG_EVENT_NRPN_SEND_PORTS_MASK != 0x00f0
    # error "Please adapt MBNG_EVENT_SendOptimizedNRPN!"
    #endif
    #if MBNG_EVENT_NRPN_SEND_PORTS_OFFSET != 4
    # error "Please adapt MBNG_EVENT_SendOptimizedNRPN!"
    #endif
        
          // NRPN special handling for HUI fader data
          // FADER 1
          if( nrpn_address == 0 ) {
              p.cc_number = 0x00; // Data MSB
              p.value = nrpn_value_msb;
              MIOS32_MIDI_SendPackage(port, p);
    
    
              p.cc_number = 0x20; // Data LSB
              p.value = nrpn_value_lsb;
              MIOS32_MIDI_SendPackage(port, p);
          }
          // FADER 2
          if( nrpn_address == 1 ) {
              p.cc_number = 0x01; // Data MSB
              p.value = nrpn_value_msb;
              MIOS32_MIDI_SendPackage(port, p);
          
          
              p.cc_number = 0x21; // Data LSB
              p.value = nrpn_value_lsb;
              MIOS32_MIDI_SendPackage(port, p);
          }
          // FADER 3
          if( nrpn_address == 2 ) {
              p.cc_number = 0x02; // Data MSB
              p.value = nrpn_value_msb;
              MIOS32_MIDI_SendPackage(port, p);
              
              
              p.cc_number = 0x22; // Data LSB
              p.value = nrpn_value_lsb;
              MIOS32_MIDI_SendPackage(port, p);
          }
          // FADER 4
          if( nrpn_address == 3 ) {
              p.cc_number = 0x03; // Data MSB
              p.value = nrpn_value_msb;
              MIOS32_MIDI_SendPackage(port, p);
              
              
              p.cc_number = 0x23; // Data LSB
              p.value = nrpn_value_lsb;
              MIOS32_MIDI_SendPackage(port, p);
          }
          // FADER 5
          if( nrpn_address == 4 ) {
              p.cc_number = 0x04; // Data MSB
              p.value = nrpn_value_msb;
              MIOS32_MIDI_SendPackage(port, p);
              
              
              p.cc_number = 0x24; // Data LSB
              p.value = nrpn_value_lsb;
              MIOS32_MIDI_SendPackage(port, p);
          }
          // FADER 6
          if( nrpn_address == 5 ) {
              p.cc_number = 0x05; // Data MSB
              p.value = nrpn_value_msb;
              MIOS32_MIDI_SendPackage(port, p);
              
              
              p.cc_number = 0x25; // Data LSB
              p.value = nrpn_value_lsb;
              MIOS32_MIDI_SendPackage(port, p);
          }
          // FADER 7
          if( nrpn_address == 6 ) {
              p.cc_number = 0x06; // Data MSB
              p.value = nrpn_value_msb;
              MIOS32_MIDI_SendPackage(port, p);
              
              
              p.cc_number = 0x26; // Data LSB
              p.value = nrpn_value_lsb;
              MIOS32_MIDI_SendPackage(port, p);
          }
          // FADER 8
          if( nrpn_address == 7 ) {
              p.cc_number = 0x07; // Data MSB
              p.value = nrpn_value_msb;
              MIOS32_MIDI_SendPackage(port, p);
              
              
              p.cc_number = 0x27; // Data LSB
              p.value = nrpn_value_lsb;
              MIOS32_MIDI_SendPackage(port, p);
          }
     
    
    
      return 0; // no error
    }
    

    to receive:

        // track NRPN event
        if( port_mask & MBNG_EVENT_NRPN_RECEIVE_PORTS_MASK ) {
          int port_ix = (port_class | (port & 3)) - MBNG_EVENT_NRPN_RECEIVE_PORTS_OFFSET;
          if( port_ix >= 0 && port_ix < MBNG_EVENT_NRPN_RECEIVE_PORTS ) {
              // NRPN special handling for HUI fader data
            switch( midi_package.cc_number ) {
                    
            case 0x00: { // Address MSB FADER 1
                nrpn_received_value[port_ix][midi_package.chn] &= ~0x3f80;
                nrpn_received_value[port_ix][midi_package.chn] |= ((midi_package.value << 7) & 0x3f80);
                nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                nrpn_address = 0;
                nrpn_msb_only = 1; // for the MsbOnly format
    #if 0
                // MEMO: it's better to update only when LSB has been received
                if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                    midi_learn_nrpn_port = port;
                    midi_learn_nrpn_chn = midi_package.chn + 1;
                    midi_learn_nrpn_valid = 0;
                } else {
                    // only if valid address has been parsed
                    midi_learn_nrpn_valid |= 0x04;
                }
    #endif
            } break;
    
            case 0x20: { // Address LSB
                nrpn_received_value[port_ix][midi_package.chn] &= ~0x007f;
                nrpn_received_value[port_ix][midi_package.chn] |= (midi_package.value & 0x007f);
                nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                nrpn_address = 0;
                
                if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                    midi_learn_nrpn_port = port;
                    midi_learn_nrpn_chn = midi_package.chn + 1;
                    midi_learn_nrpn_valid = 0;
                } else {
                    // only if valid address has been parsed
                    // use same valid flag like Data MSB (complete NRPN is valid with 0x07)
                    midi_learn_nrpn_valid |= 0x04;
                }
                
                
            } break;
    
                case 0x01: { // Address MSB FADER 2
                    nrpn_received_value[port_ix][midi_package.chn] &= ~0x3f80;
                    nrpn_received_value[port_ix][midi_package.chn] |= ((midi_package.value << 7) & 0x3f80);
                    nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                    nrpn_address = 1;
                    nrpn_msb_only = 1; // for the MsbOnly format
    #if 0
                    // MEMO: it's better to update only when LSB has been received
                    if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                        midi_learn_nrpn_port = port;
                        midi_learn_nrpn_chn = midi_package.chn + 1;
                        midi_learn_nrpn_valid = 0;
                    } else {
                        // only if valid address has been parsed
                        midi_learn_nrpn_valid |= 0x04;
                    }
    #endif
                } break;
                    
                case 0x21: { // Address LSB
                    nrpn_received_value[port_ix][midi_package.chn] &= ~0x007f;
                    nrpn_received_value[port_ix][midi_package.chn] |= (midi_package.value & 0x007f);
                    nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                    nrpn_address = 1;
                    
                    if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                        midi_learn_nrpn_port = port;
                        midi_learn_nrpn_chn = midi_package.chn + 1;
                        midi_learn_nrpn_valid = 0;
                    } else {
                        // only if valid address has been parsed
                        // use same valid flag like Data MSB (complete NRPN is valid with 0x07)
                        midi_learn_nrpn_valid |= 0x04;
                    }
                    
                    
                } break;
                    
                case 0x02: { // Address MSB FADER 3
                    nrpn_received_value[port_ix][midi_package.chn] &= ~0x3f80;
                    nrpn_received_value[port_ix][midi_package.chn] |= ((midi_package.value << 7) & 0x3f80);
                    nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                    nrpn_address = 2;
                    nrpn_msb_only = 1; // for the MsbOnly format
    #if 0
                    // MEMO: it's better to update only when LSB has been received
                    if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                        midi_learn_nrpn_port = port;
                        midi_learn_nrpn_chn = midi_package.chn + 1;
                        midi_learn_nrpn_valid = 0;
                    } else {
                        // only if valid address has been parsed
                        midi_learn_nrpn_valid |= 0x04;
                    }
    #endif
                } break;
                    
                case 0x22: { // Address LSB
                    nrpn_received_value[port_ix][midi_package.chn] &= ~0x007f;
                    nrpn_received_value[port_ix][midi_package.chn] |= (midi_package.value & 0x007f);
                    nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                    nrpn_address = 2;
                    
                    if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                        midi_learn_nrpn_port = port;
                        midi_learn_nrpn_chn = midi_package.chn + 1;
                        midi_learn_nrpn_valid = 0;
                    } else {
                        // only if valid address has been parsed
                        // use same valid flag like Data MSB (complete NRPN is valid with 0x07)
                        midi_learn_nrpn_valid |= 0x04;
                    }
                    
                    
                } break;
                
                case 0x03: { // Address MSB FADER 4
                    nrpn_received_value[port_ix][midi_package.chn] &= ~0x3f80;
                    nrpn_received_value[port_ix][midi_package.chn] |= ((midi_package.value << 7) & 0x3f80);
                    nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                    nrpn_address = 3;
                    nrpn_msb_only = 1; // for the MsbOnly format
    #if 0
                    // MEMO: it's better to update only when LSB has been received
                    if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                        midi_learn_nrpn_port = port;
                        midi_learn_nrpn_chn = midi_package.chn + 1;
                        midi_learn_nrpn_valid = 0;
                    } else {
                        // only if valid address has been parsed
                        midi_learn_nrpn_valid |= 0x04;
                    }
    #endif
                } break;
                    
                case 0x23: { // Address LSB
                    nrpn_received_value[port_ix][midi_package.chn] &= ~0x007f;
                    nrpn_received_value[port_ix][midi_package.chn] |= (midi_package.value & 0x007f);
                    nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                    nrpn_address = 3;
                    
                    if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                        midi_learn_nrpn_port = port;
                        midi_learn_nrpn_chn = midi_package.chn + 1;
                        midi_learn_nrpn_valid = 0;
                    } else {
                        // only if valid address has been parsed
                        // use same valid flag like Data MSB (complete NRPN is valid with 0x07)
                        midi_learn_nrpn_valid |= 0x04;
                    }
                    
                    
                } break;
                    
                case 0x04: { // Address MSB FADER 5
                    nrpn_received_value[port_ix][midi_package.chn] &= ~0x3f80;
                    nrpn_received_value[port_ix][midi_package.chn] |= ((midi_package.value << 7) & 0x3f80);
                    nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                    nrpn_address = 4;
                    nrpn_msb_only = 1; // for the MsbOnly format
    #if 0
                    // MEMO: it's better to update only when LSB has been received
                    if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                        midi_learn_nrpn_port = port;
                        midi_learn_nrpn_chn = midi_package.chn + 1;
                        midi_learn_nrpn_valid = 0;
                    } else {
                        // only if valid address has been parsed
                        midi_learn_nrpn_valid |= 0x04;
                    }
    #endif
                } break;
                    
                case 0x24: { // Address LSB
                    nrpn_received_value[port_ix][midi_package.chn] &= ~0x007f;
                    nrpn_received_value[port_ix][midi_package.chn] |= (midi_package.value & 0x007f);
                    nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                    nrpn_address = 4;
                    
                    if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                        midi_learn_nrpn_port = port;
                        midi_learn_nrpn_chn = midi_package.chn + 1;
                        midi_learn_nrpn_valid = 0;
                    } else {
                        // only if valid address has been parsed
                        // use same valid flag like Data MSB (complete NRPN is valid with 0x07)
                        midi_learn_nrpn_valid |= 0x04;
                    }
                    
                    
                } break;
                    
                case 0x05: { // Address MSB FADER 6
                    nrpn_received_value[port_ix][midi_package.chn] &= ~0x3f80;
                    nrpn_received_value[port_ix][midi_package.chn] |= ((midi_package.value << 7) & 0x3f80);
                    nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                    nrpn_address = 5;
                    nrpn_msb_only = 1; // for the MsbOnly format
    #if 0
                    // MEMO: it's better to update only when LSB has been received
                    if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                        midi_learn_nrpn_port = port;
                        midi_learn_nrpn_chn = midi_package.chn + 1;
                        midi_learn_nrpn_valid = 0;
                    } else {
                        // only if valid address has been parsed
                        midi_learn_nrpn_valid |= 0x04;
                    }
    #endif
                } break;
                    
                case 0x25: { // Address LSB
                    nrpn_received_value[port_ix][midi_package.chn] &= ~0x007f;
                    nrpn_received_value[port_ix][midi_package.chn] |= (midi_package.value & 0x007f);
                    nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                    nrpn_address = 5;
                    
                    if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                        midi_learn_nrpn_port = port;
                        midi_learn_nrpn_chn = midi_package.chn + 1;
                        midi_learn_nrpn_valid = 0;
                    } else {
                        // only if valid address has been parsed
                        // use same valid flag like Data MSB (complete NRPN is valid with 0x07)
                        midi_learn_nrpn_valid |= 0x04;
                    }
                    
                    
                } break;
                    
                case 0x06: { // Address MSB FADER 7
                    nrpn_received_value[port_ix][midi_package.chn] &= ~0x3f80;
                    nrpn_received_value[port_ix][midi_package.chn] |= ((midi_package.value << 7) & 0x3f80);
                    nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                    nrpn_address = 6;
                    nrpn_msb_only = 1; // for the MsbOnly format
    #if 0
                    // MEMO: it's better to update only when LSB has been received
                    if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                        midi_learn_nrpn_port = port;
                        midi_learn_nrpn_chn = midi_package.chn + 1;
                        midi_learn_nrpn_valid = 0;
                    } else {
                        // only if valid address has been parsed
                        midi_learn_nrpn_valid |= 0x04;
                    }
    #endif
                } break;
                    
                case 0x26: { // Address LSB
                    nrpn_received_value[port_ix][midi_package.chn] &= ~0x007f;
                    nrpn_received_value[port_ix][midi_package.chn] |= (midi_package.value & 0x007f);
                    nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                    nrpn_address = 6;
                    
                    if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                        midi_learn_nrpn_port = port;
                        midi_learn_nrpn_chn = midi_package.chn + 1;
                        midi_learn_nrpn_valid = 0;
                    } else {
                        // only if valid address has been parsed
                        // use same valid flag like Data MSB (complete NRPN is valid with 0x07)
                        midi_learn_nrpn_valid |= 0x04;
                    }
                    
                    
                } break;
                    
                case 0x07: { // Address MSB FADER 8
                    nrpn_received_value[port_ix][midi_package.chn] &= ~0x3f80;
                    nrpn_received_value[port_ix][midi_package.chn] |= ((midi_package.value << 7) & 0x3f80);
                    nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                    nrpn_address = 7;
                    nrpn_msb_only = 1; // for the MsbOnly format
    #if 0
                    // MEMO: it's better to update only when LSB has been received
                    if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                        midi_learn_nrpn_port = port;
                        midi_learn_nrpn_chn = midi_package.chn + 1;
                        midi_learn_nrpn_valid = 0;
                    } else {
                        // only if valid address has been parsed
                        midi_learn_nrpn_valid |= 0x04;
                    }
    #endif
                } break;
                    
                case 0x27: { // Address LSB
                    nrpn_received_value[port_ix][midi_package.chn] &= ~0x007f;
                    nrpn_received_value[port_ix][midi_package.chn] |= (midi_package.value & 0x007f);
                    nrpn_value = nrpn_received_value[port_ix][midi_package.chn]; // pass to parser
                    nrpn_address = 7;
                    
                    if( port != midi_learn_nrpn_port || midi_package.chn != (midi_learn_nrpn_chn-1) ) {
                        midi_learn_nrpn_port = port;
                        midi_learn_nrpn_chn = midi_package.chn + 1;
                        midi_learn_nrpn_valid = 0;
                    } else {
                        // only if valid address has been parsed
                        // use same valid flag like Data MSB (complete NRPN is valid with 0x07)
                        midi_learn_nrpn_valid |= 0x04;
                    }
                    
                    
                } break;
    
          
                    
    
            }
          }
        }

    Best

    Zam

×
×
  • Create New...