dinama
March 18, 2013, 6:39pm
1
Hi.
I have not programming skill so is about a week that i try to solve this thing.
I want a special button for my midibox.
This button have the same function of “snapshot at poweron” but manually triggered .
So when i push this button the box will send all current pot settings ( actual values ​​marked by the position of the potentiometer not the one stored in bank) whithout store it in bank.
In other words get the current physical position of all pots, and then transmit them to output midi port.
I try to write a meta event to do this
MB64_META_Handler
movf MIDI_EVNT1, W
goto MB64_PATCH_SendCurrent
but there is somethig wrong in this.
http://discourse.midibox.org/t/topic/9361
unsigned char i;
unsigned char MyArray[num_ains];
for (i = 0 ; i <= num_ains ; i++) {
MyArray[(i)] = MIOS_AIN_Pin7bitGet(i);
}
but this is a pseudocode and i don’t have skill to translate it in a real solution.
I think there is a simple solution with meta handler and existing functions but i don’t see it.
please can someone help me.
thanks
T.K
March 18, 2013, 9:06pm
2
Just
call MB64_PATCH_SendCurrent
what’s wrong with this function?
Or do you want to send the current patch?
Then
call MB64_PATCH_Send
The code is located in mb64_patch.inc (for your inspiration)
Best Regards, Thorsten.
dinama
March 19, 2013, 11:51am
3
Hi.
I try your solution but it does not work.
i modify mb64_meta.inc
MB64_META_Handler
movf MIDI_EVNT1, W
call MB64_PATCH_SendCurrent
and compile a new hex file.
This is the part of .ini file where the meta event is assigned to button
[bUTTONS]
# Additional 4 Buttons in the menu section
19 = F0 00 7f @Onoff
these are other options active
[sNAPSHOT_AT_POWERON]
enabled
[AUTO_SNAPSHOT]
enabled
When i turn on midibox i can see on display “Loading Setup from bankstick” then “Sending Snapshot” .
After this the midibox turn-off alone, restart , again on display “Loading Setup from bankstick” and “Sending Snapshot” , then the box crash .
the display text remains “Sending Snapshot”.
I try with
goto MB64_PATCH_SendCurrent
with same result.
It like there is a loop that sends the machine in crash.
i don’t know
When i delete
movf MIDI_EVNT1, W
call MB64_PATCH_SendCurrent
the midibox return ok.
T.K
March 19, 2013, 7:31pm
4
Alright, now it’s clear (you should have mentioned this earlier): since the MB64_PATCH functions also send the meta event, you will get an infinite loop.
I remember that I had the same problem with the snapshot SFB, and I remember that I solved this by implementing a request flag mechanism in main.inc to ensure, that the patch is only sent once.
So, new approach:
write
MB64_META_Handler
bsf MB_STAT2, MB_STAT2_PWR_SNAPSHOT_REQ
return
if you want to request the MB64_PATCH_SendCurrent call
or write
MB64_META_Handler
bsf MB_STAT, MB_STAT_SNAPSHOT_REQ
return
if you want to request the MB64_PATCH_Send call
The USER_Tick function in main.inc will check this flag, call the appr. function if it’s 1, and clear the flag thereafter.
Best Regards, Thorsten.
dinama
March 24, 2013, 6:50pm
6
Sorry but after a few attempts i discovered a problem.
i use your solution and i assign to a button the meta handler.
MB64_META_Handler
bsf MB_STAT2, MB_STAT2_PWR_SNAPSHOT_REQ
return
but now with
[AUTO_SNAPSHOT] enabled
when i change bank with button 17-18-19 midibox don’t recall the values stored in bankstick but everytime
make a snapshot of current pot position.
if i use
[AUTO_SNAPSHOT] disabled midibox recall the values stored in bankstick but don’t sent it to midi out port.
This is the part of .ini file where the meta event is assigned to button
17 = FF 04 00 @OnOnly
18 = FF 04 01 @OnOnly
19 = FF 04 03 @OnOnly
20 = F0 00 7F @OnOnly
T.K
March 24, 2013, 7:51pm
7
I’ve to ask you some questions to ensure that I understood you correctly:
Which option do you want to use?
[AUTO_SNAPSHOT] enabled?
And you want that values are stored in BankStick, and that they are sent to the MIDI OUT?
Best Regards, Thorsten.
dinama
March 24, 2013, 9:06pm
8
i think it’s better for me to use
[AUTO_SNAPSHOT] enabled
because when in bank1 i push button
18 = FF 04 01 @OnOnly (or FF 02 01 if i don’t want to save the value in bank1)
i want to jump to bank 2 and restore value stored in bank2 and sent it to midi out.
maybe the problem is the flag that i set in meta-handler for my special button
MB64_META_Handler
bsf MB_STAT2, MB_STAT2_PWR_SNAPSHOT_REQ
return
maybe USER_Tick function in main.inc don’t clear the flag
T.K
March 24, 2013, 9:09pm
9
Could you please search in main.inc, if the flag is cleared?
(this is a learning example which should help you to get a better understanding of the code without asking me ;-))
Best Regards, Thorsten.
dinama
March 25, 2013, 5:45am
10
Ok i think this is the line where the flag is reset in user tick
bcf MB_STAT2, MB_STAT2_PWR_SNAPSHOT_REQ
So why every time i change bank i don’t have value stored in bank but the snapshot value?
T.K
March 26, 2013, 7:34pm
11
Yes, you are right.
I’m surprised by myself that nobody noticed this yet!
I can work on the MB64_PATCH_SendCurrent routine, so that the value is stored in the snapshot as well.
But this needs some time…
Best Regards, Thorsten.
T.K
April 3, 2013, 7:50pm
13
Not yet… as mentioned above, it will need some time.
I’ve to open my MB64 case, replace the MBHP_CORE_LPC17 module by a MBHP_CORE, have to find out what I did years ago and then try out changes (which are error prone…) in order to help you on this topic.
Best Regards, Thorsten.
dinama
May 29, 2013, 3:51pm
16
please give me a news. i’d like to finish my project. thanks
T.K
May 30, 2013, 8:19pm
17
currently too many people are giving me requests…
Is this enhancement really so important? It seems that you are the only guy who is interested on this, or are there others (maybe even with programming skills) who could help out?
Best Regards, Thorsten.