Jump to content

.ngr refresh problem


Marxon
 Share

Recommended Posts

Hi all,

i use this script to change the function of enc=2 via button=1371 and button=1372.

 

.ngc

EVENT_BUTTON id= 70  hw_id= 70  type=Meta   meta=SetBank          range=1:2    meta=RunSection:2
EVENT_BUTTON id=1371  hw_id=1024    button_mode=toggle range=0:127     Bank=2    type=NoteOn    chn=3    key=41    
EVENT_BUTTON id=1372  hw_id=1017    button_mode=toggle range=0:127     Bank=2    type=NoteOn    chn=3    key=42    
EVENT_ENC     id=   2 hw_id=  2     type=cc chn= 2 cc=111             range= 0:127
EVENT_ENC     id=1371 hw_id=  2     type=cc chn=11 cc= 41 Bank=2    range= 0:127
EVENT_ENC     id=1372 hw_id=  2     type=cc chn=11 cc= 42 Bank=2    range= 0:127

 

.ngr
 

if ^section == 2
  if (iD)BUTTON:1371 < 1
    set_active (id)Enc:1371 0
    else set_active (id)Enc:1371 1
  endif

  if (iD)BUTTON:1372 < 1
    set_active (id)Enc:1372 0
    else set_active (id)Enc:1372 1
  endif
endif
exit


Now the problem:
i have to push button=70 a second time before
enc=1371 and enc=1372 get updated but i like them to update allready
during hold down button=70 for the first time.
How can i achieve this?


Best regards
Marxon


 
 

Link to comment
Share on other sites

What do you mean with:

 

enc=1371 and enc=1372 get updated but i like them to update allready

 

what kind of update do you expect?

 

If you mean, that they should be handled by the .NGR script, then I would say that this is unexpected.

Could you please add some debug messages (via the "LOG" command) to the script and doublecheck, which parts are executed?

 

Best Regards, Thorsten.

Link to comment
Share on other sites

Hi Thorsten,

somehow i killed the code, yesterday.
Now i allways get this error:

[385453.834] [MBNG_FILE_C:143] ERROR: '(iD)BUTTON' not found in event pool by 'if' command!
[385453.835] [MBNG_FILE_C:143] ERROR: invalid left value '(iD)BUTTON' in 'if' command!
[385453.836] [MBNG_FILE_R:143] stopped script execution due to previous error!

No matter what button i use in line 143. Strange...
Would you please take a look at the code?
It happens at .ngc line 10
Thank you very much!
 

M³.zip

Link to comment
Share on other sites

The button can't be found because it has an invalid fwd_id argument, and therefore was rejected:

[79761.466] [MBNG_FILE_C:651] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.469] [MBNG_FILE_C:653] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.469] [MBNG_FILE_C:655] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.472] [MBNG_FILE_C:657] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.473] [MBNG_FILE_C:659] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.477] [MBNG_FILE_C:661] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.477] [MBNG_FILE_C:663] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.480] [MBNG_FILE_C:665] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.480] [MBNG_FILE_C:669] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.484] [MBNG_FILE_C:671] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.484] [MBNG_FILE_C:673] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.487] [MBNG_FILE_C:675] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.487] [MBNG_FILE_C:677] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.491] [MBNG_FILE_C:679] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.491] [MBNG_FILE_C:681] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.554] [MBNG_FILE_C:683] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.554] [MBNG_FILE_C:813] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.557] [MBNG_FILE_C:815] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.557] [MBNG_FILE_C:817] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.561] [MBNG_FILE_C:819] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.561] [MBNG_FILE_C:821] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.564] [MBNG_FILE_C:823] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.564] [MBNG_FILE_C:825] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.568] [MBNG_FILE_C:827] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.568] [MBNG_FILE_C:831] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.571] [MBNG_FILE_C:833] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.571] [MBNG_FILE_C:835] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.575] [MBNG_FILE_C:837] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.575] [MBNG_FILE_C:839] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.578] [MBNG_FILE_C:841] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.578] [MBNG_FILE_C:843] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED
[79761.846] [MBNG_FILE_C:845] ERROR: invalid fwd_id controller name in EVENT_BUTTON ... fwd_id=<LED

It seems that the displayed line numbers are not correct (I've to fix this)

 

But if you search for "fwd_id=<", you will find the wrong definitions.

After correcting the syntax, "run 2" is executed without error

 

Best Regards, Thorsten.

Link to comment
Share on other sites

Ok i changed the .ngr
 

if ^section == 2
  log "Section is 2"
    if (iD)BUTTON:1371 < 1
    set_active (id)Enc:1371 0
       log "deactivated"
    else
    set_active (id)Enc:1371 1
       log "activated"
    endif  
  endif

This the output:

  • Hold button 70 pressed
    "Section is 2"
    "de/activated" (depending on actually status)
  •  Press  button1371
    "nothing"
  • Release button 70
    "de/activated" (status toggled)

It seems Set_active is executed to late. 

It should be executed after pressing button 1371.

 

Link to comment
Share on other sites

Well, in your .ngc setup the section is only executed with button id=70

 

You could execute it with id=1371 as well (just configure it as a meta event); the CC event could be sent with the "send <midi-event>" command from the .ngr script.

 

Best Regards, Thorsten.

Link to comment
Share on other sites

Ok thank you again Thorsten!

Its working without the CC too.
I also managed the refresh problem.
To sum up:
I have
-one "shift" button button id=26
-two "encoder on/off" buttons hw_id=1024, hw_id=1017
-one multi porpose encoder hw_id=1

Pressing the "shift" button together with one "encoder on/off" button
de/activates a function of the multi porpose encoder.

.ngc

 

 

EVENT_BUTTON  id=1371  hw_id=1024    button_mode=toggle range=0:127     Bank=2    type=meta      meta=runsection:101
EVENT_BUTTON  id=1381  hw_id=1024                                     bank=2 chn=3    label="^std_btn"    fwd_id=LED:1217
    #Encoder 1 on/off
EVENT_BUTTON  id=1372  hw_id=1017    button_mode=toggle range=0:127     Bank=2    type=meta      meta=runsection:102
EVENT_BUTTON  id=1382  hw_id=1017                                     bank=2 chn=3    label="^std_btn"    fwd_id=LED:1218
    #Encoder 2 on/off
EVENT_ENC     id=1371 hw_id=1    type=cc chn= 11 cc= 71 Bank=2    range= 0:127 enc_mode=Inc00Speed_Dec40Speed enc_speed_mode=fast:4 lcd_pos=1:1:1  label="^std_enc"
    #Multi porpose encoder function 1
EVENT_ENC     id=1372 hw_id=1     type=cc chn= 11 cc= 72 Bank=2    range= 0:127 enc_mode=Inc00Speed_Dec40Speed enc_speed_mode=fast:4 lcd_pos=1:1:1  label="^std_enc"
    #Multi porpose encoder function 2
EVENT_BUTTON id= 26 hw_id= 26      type=Meta   meta=SetBank  range=1:2  lcd_pos=1:1:1    label="^std_btn"
    # Shift Button

.ngr

   

 

if ^section == 101
    LOG "Volume 1"
    if (iD)BUTTON:1371 < 1
      set_active (id)Enc:1371 0
                 LOG "VolumeENC 1 off"
    else set_active (id)Enc:1371 1
      LOG "VolumeENC 1 on"
   endif
endif
if ^section == 102
    LOG "Volume 2"
    if (iD)BUTTON:1372 < 1
      set_active (id)Enc:1372 0
                 LOG "VolumeENC 2 off"
    else set_active (id)Enc:1372 1
      LOG "VolumeENC 2 on"
   endif
endif

 



Everything is working except that after release the shift button and press it again, then all encoders are "activated" again, regardless their previous state.

I hope my problem is understandable if not i can write it in german again :)

 

Best regards

Marxon

Link to comment
Share on other sites

Good progress! :)

 

 

Everything is working except that after release the shift button and press it again, then all encoders are "activated" again, regardless their previous state.

 

This shouldn't happen if you remove "Bank=2" from the EVENT_ENC statements which should be controlled from the .NGR script.

Because with "Bank=2" the encoders will be part of the bank, and therefore automatically activated on each bank switching.

 

Best Regards, Thorsten.

Link to comment
Share on other sites

Thanks for your patience, Thorsten! :thumbsup:

This is the new code:

EVENT_BUTTON id=1371 hw_id=1024 range=0:127 Bank=2 type=meta    meta=runsection:101 button_mode=toggle    
        #Encoder 1 on/off
EVENT_ENC    id=1371 hw_id=1    range=0:127 chn=11  cc=71 type=cc enc_mode=Inc00Speed_Dec40Speed enc_speed_mode=fast:4
        #Multi porpose encoder function 1
EVENT_BUTTON id= 26 hw_id= 26   range=1:2          type=Meta   meta=SetBank  lcd_pos=1:1:1    
        # Shift Button

 

if ^section == 101
    LOG "Volume 1"
    if (iD)BUTTON:1371 < 1
      set_active (id)Enc:1371 0
      set_active (id)LED:1217 0
                 LOG "VolumeENC 1 off"
    else set_active (id)Enc:1371 1
         set_active (id)LED:1217 1
         LOG "VolumeENC 1 on"
   endif
endif

 

New code, new problem:

Disabling the encoder works but it does not get reactivated after pressing button id=1371 again.

Although i receive "VolumeENC 1 on", nothing is sent when the encoder is moved.

But why?

Edited by Marxon
Link to comment
Share on other sites

Hi again,

have you tried it Thorsten?

 

EDIT:

It works with an additional

set_active (id)Enc:1371 1

in the first condition.

Although it should not be necessary, right?

if ^section == 101
   LOG "Volume 1"
   set_active (id)Enc:1371 1
      if   (iD)BUTTON:1371 < 1
           set_active (id)Enc:1371 0
	   set_active (id)LED:1217 0
     	   LOG "VolumeENC 1 off"
      else set_active (id)Enc:1371 1
	   set_active (id)LED:1217 1
	   LOG "VolumeENC 1 on"
    endif
endif

 

Best regards

Marxon

Edited by Marxon
Link to comment
Share on other sites

Ok, now it's clear to me what is going wrong here:

 

      else set_active (id)Enc:1371 1

The parser doesn't read commands after an ELSE statement.

On the other hand, it didn't complain about the command - and this caused the confusion at your side.

 

Here a new version which prints an error message whenever a command is detected after ELSE or ENDIF

-> http://www.ucapps.de/mios32/midibox_ng_v1_029_pre3.zip

 

Best Regards, Thorsten.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...