Jump to content

henrygr

Members
  • Posts

    220
  • Joined

  • Last visited

Everything posted by henrygr

  1. A while back you gave me assistance (ACommander also) on changing controller values for my Native Instruments B4 controller. I don't know if that is what you are hitting at, but look again at the post- do a search on 'boolean', it will be the first link. Weel, mission accomplished. I use a 3 pole switch to toggle between a variety of functions for each pot and switch eg- position 1- knob 1 is upper manual 16' pipe on channel 1 position 2- knob 1 is lower manual 16' pipe on cahannel 2 etc. Would the code for this help you. I only completed it two days ago, and am too busy playing with it to post the WIKI. So if you want I'll post the code here if you think it would help! MP
  2. I see. I don't see why the switches should not work in terms of breaking the signal, and as you are using a DIN module, there should be no random midi. (I'm taking it for granted that you are using a DIN module, and not connecting straight to the core). You are using an mechanical workaround however to a solution that is possible to program. So, to answer- yes, possible both as a mechanical and as a programmed utility. You're best bet is to build your bits and bobs, leaving youself room to change how you constructed it. That way, you could play around with both possibilities. Don't take what I say as any form of gospel. I just finished my first project and had an equally bizarre question. MP
  3. Not sure of the question. What exactly do you want to do?
  4. Would my assumption be correct in thinking that you are looking to change controller values of buttons and knobs on the fly without having to use a bankstick?
  5. :) :) :) :)MISSION ACCOMPLISHED!!!!!!! :) :) :) :) So now there is a switch that will change the control functions of analogue (and maybe DINX, but I havn't built them yet) controls on the fly without the need to upload different configurations from a bank stick. I will post the results in the WIKI and place a link here as soon as its done so that others who stumble upon here can follow it. Thanks you all for your patience and support. Mark.
  6. OK OK I hear you. And I promise to do my homework. I'd buy you an apple, but they cost too much. Pins 24,25,26 will not be used so much. When I flick them, I want the other pots to behave as instructed. Essentially change what each of the other pots controls depending on the condition of 24, 25 or 26. eg Pot 1 controls volume on channel 2 when pin 24 is selected. Pot 1 controls modulation on Channel 15 when pin 25 is selected Pot 1 controls reverb depth on Channel 3 when pin 26 is selected. In essence, 45, 25 and 26 act as a program shift for the Mbox. Am I making any sense? Going anywhere nice? mark
  7. OK I tried the same code but with the IF control statement, and substituted a vairiable in the code that calls the sub array: void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam { unsigned char knob_pos_1; unsigned char knob_pos_2; if(pin == 24 && pin_value > 512) { knob_pos_1 = 0; knob_pos_2 = 2; } if(pin == 25 && pin_value > 512) { knob_pos_1 = 0; knob_pos_2 = 3; } if(pin == 26 && pin_value > 512) { knob_pos_1 = 1; knob_pos_2 = 4; } MIOS_MIDI_TxBufferPut(pot_event_map[pin][knob_pos_1]); // first corresponding value from table MIOS_MIDI_TxBufferPut(pot_event_map[pin][knob_pos_2]); // second corresponding value from tab MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin)); // 7bit pot value } The result is unusual. Pins 0 to 23 send two midi messages per movement sequentially. The first is on Channel 1 with a value of 0, Control no 1. The second is still on channel 1, with a value of 0, but the contol no corresponds to pot movement ie increases or decreases depending on movement. When I flick the knob, its as though the positions of every pot is taken and echoed back through the channel corresponding to the position of the knob. Any comments?
  8. Sorry, I've read somewhere earlier about someome slapping their own wrists for rusing posts during a coffee break at work. Well, I'll slap my own wrists now, and say that caring for a teething nine month old baby with one eye on the PC and the Mbox is certainly not to be tried... I set up Code Blocks- GREAT. Tells me where my script is wromg as I type etc.... Back to the code above. Pins values spot on. Argument is not though. The only returned values are of those three pins, and values only above 512. So it is the syntax of the code. I don't know. I will have a good look at it now that I have a text editor that is more akin to working on a ZX81 over a C=64. Ahhhh...the days of sprites and (cough)SID chips!!!! Regards, MP
  9. This may be a silly suddestion, but have you tried connecting a USB/midi interface to it (like the M-Audio Uno), and simply using the Midi Out Din Terminal from that?
  10. Michael, Thanks for all your help in the programming. The code to me looks spot on, but i'm no expert. I have a hunch that it may be to do with thw flow of data in the PIC chip, in that such changes cannot be made on the fly. I am wondering how the MIOS deals with loading a new bank from the bankstick. If there is a system reset or something similar that sets the new values in place. When I get home later, I will put a reset into each block of 'case', and then set up a loop to return values (while pin_value>512.....) to appropriate pins until the condition has changed. Just a thought... Mark. PS Check this out. What do you think for the price? http://cgi.ebay.ie/JDM2-ISO-MICROCHIP-PIC-EEPROM-CARD-PROGRAMMER-JDM-MCU_W0QQitemZ7630631527QQihZ017QQcategoryZ4661QQrdZ1QQcmdZViewItem
  11. To answer: Yes, both cases above are working. All values in pot_event_map work when I specifically programme them directly without any switches. The switch works- ie. properly wired and sends values as intended when turned. I get the default-case-sections on all other switches, and erroneous data wherever I set the toggle, be it pin 1,2 and 3 or 24, 25 and 26. If I remove the default, I don't get anything. I am trying all sorts of different ways around the argument. I will keep at it for know. Right now though, I have to run to give the baby a bottle! :D Who's a pretty girl...... Mark.
  12. Hi Michael, The switch itself is a 4 pole three way switch, correctly wired with 10k resistors, to do the following (I am replacing numbers with letters for clarity) When A is on, B and C go to ground. When B is on, A and C go to ground. When C is on, A and B go to ground. The values of the above work correctly. I tested it with the code 'MIOS_MIDI_TxBufferPut(pin); // pin number corresponds to CC number' and got the correct values. ie. When the midi signal form A is 127, B and C are at 0....you get the picture. Now the purpose of this switch is to ast as a toggle switch, which will change the purpose of all 24 other controllers on the fly. To add, I havn't built an LCD to the core. I don't particularly need it, sind I built a 15" LCD monitor onto my keyboard!! ;)(No, not touch screen- they use up too much valuable processsing power). :-\ I have ordered a DIN module from SmashTV, which, even if I do find a workaround here, will be put to good use anyway. :). The AIN pins are the first three pins of the last multiplexer. ie pins 25, 26, 27- thus in the switch-case code- 24,25 and 26. One more thing, It is still p***ing rain in Dublin. The offer to go out and stand in it is still valid! Regards, Mark.
  13. Sorry Michael, I should have said that pins 25-27 do return a value according to pot_event_map. When I programme 1-3, same result. Thanks Anyway, Mark. :)
  14. Thank you both: Just tried it with pins 1 2 and 3 and still no joy. I get the impression from all of the results on the screen that conditions would have to be programmed for each individual switch which would mean both lots of workload and perhaps a slower machine. Put that versus a DINX1 and I thinf I will go with the latter. Will let you all know!! Regards, Mark.
  15. An afterthought: could I build a DIN with one 74HC165 and deacrease the size of the board. Space is getting tight in there!! MP
  16. OK. Is that pins 0,1 and 2 on the AIN module? As I am only using one AIN and still have four pins available on J5 of the core, could I utilise these even in muxed mode? If you are unsure I'll try it anyway. Nice to be home. Mark. :)
  17. I'm back all. Many thanks for your sympathies. Had time to reflect on things. Have a look at this. const unsigned char pot_event_map[27][5] = { // Pot 0..7 {0xb0, 0xb0, 0x13, 0x1c, 0x4f}, {0xb0, 0xb1, 0x12, 0x1b, 0x17}, {0xb0, 0xb1, 0x11, 0x1a, 0x16}, {0xb0, 0xb1, 0x10, 0x19, 0x15}, {0xb0, 0xb1, 0x0f, 0x18, 0x14}, {0xb0, 0xb3, 0x0e, 0x17, 0x07}, {0xb0, 0xb2, 0x0d, 0x16, 0x07}, {0xb0, 0xb1, 0x0c, 0x15, 0x07}, // Pot 8..15 {0xb0, 0xb0, 0x54, 0x53, 0x56}, {0xb0, 0xb0, 0x45, 0x5e, 0x59}, {0xb0, 0xb0, 0x4c, 0x5d, 0x57}, {0xb0, 0xb0, 0x42, 0x43, 0x55}, {0xb0, 0xb0, 0x48, 0x03, 0x44}, {0xb0, 0xb0, 0x47, 0x5b, 0x08}, {0xb0, 0xb0, 0x46, 0x5c, 0x0a}, {0xb0, 0xb0, 0x14, 0x1d, 0x4e}, // Pot 16..23 {0xb0, 0xb0, 0x01, 0x01, 0x01}, {0xb0, 0xb0, 0x0b, 0x0b, 0x0b}, {0xb0, 0xb0, 0x02, 0x02, 0x02}, {0xb0, 0xb0, 0x1e, 0x1e, 0x1e}, {0xb0, 0xb0, 0x1f, 0x1f, 0x1f}, {0xb0, 0xb0, 0x49, 0x51, 0x4c}, {0xb0, 0xb0, 0x4a, 0x52, 0x07}, {0xb0, 0xb0, 0x4b, 0x09, 0x58}, // the switch- pots 24, 25 and 26 with harmless info {0xbf, 0xbf, 0x77, 0x77, 0x77}, {0xbf, 0xbf, 0x77, 0x77, 0x77}, {0xbf, 0xbf, 0x77, 0x77, 0x77}, }; Super. Tested all the code by sending one set of variables at a time and they all do what they are suppesed to (except one, but I think it is a programming bug in B4) Now, back to the switch/case funtion void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam { switch (pin) { case 24: if(pin_value > 512) { MIOS_MIDI_TxBufferPut(pot_event_map[pin][0]); // first value from table MIOS_MIDI_TxBufferPut(pot_event_map[pin][2]); // third value from table MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin)); // 7bit pot value } break; case 25: if(pin_value > 512) { MIOS_MIDI_TxBufferPut(pot_event_map[pin][0]); // first value from table MIOS_MIDI_TxBufferPut(pot_event_map[pin][3]); // fourth value from table MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin)); // 7bit pot value } break; case 26: if(pin_value > 512) { MIOS_MIDI_TxBufferPut(pot_event_map[pin][1]); // second value from table MIOS_MIDI_TxBufferPut(pot_event_map[pin][4]); // fifth value from table MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin)); // 7bit pot value } break; default:{ MIOS_MIDI_TxBufferPut(pot_event_map[pin][0]); // first value from table MIOS_MIDI_TxBufferPut(pot_event_map[pin][2]); // third value from table MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin)); // 7bit pot value } } } All I get is the default. If I remove the default from the code I get nothing except the harmless channel 16 messages from the switch itself (pins 24, 25 and 26) Any ideas? Aaaargh! :) :) :) :)
  18. Will take it all on board folks and let you know how I egt on. However, theres been a bereavement in the family, so i will be out of action for a couple of weeks. Thank you all, abd talk to you soon. Mark Penny, Dublin.
  19. OK, (2.10am) Just got home from work. stryd_one: Erroneous- not the correct result, but consistant in its return. Lots of data I didn't even bother quantifying. Funny enough, earlier on I forgot the whole 'switch' command in the script and gave 'knob' a static value at the very beginning of the main.c page and got the same result. Then I moved the 'int knob=2;' to within the wpram calling pot movement and it worked like a dream! Food for thought? (Remember- I'm a chef, not a programmer- this was my own way of debugging) An 'if/else' in a switch statement is plausible. You are not allowed to use expressions or ranges. audiocommander: Correct. At the time of posting I figured it was most probably a problem with how I called the variable. I think that is where the problrm lies. Is the unsigned part of it necessary? All values are positive. As regards the rest of your note, I think I explained above that it worked perfectly when when I gave 'knob' a value- yes, the function line works. My problem is making sure the variable is passed on in its true integer form. Time for bed. Will test it all in the morning. I LIKE this C code thing............ Mark.
  20. Nearly there. Have written this to test my code. It is supposed to change the affect that pots one and two have dependant on the value of the switch at three. When three is closed the other two send an 'effect 1' signal on their respective channels. When open, it is an 'effect 3' signal const unsigned char pot_event_map[2][3] = { {0xb0, 0x5b, 0x5d}, {0xb1, 0x5b, 0x5d}, }; void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam { int knob; { switch(pin){ case 2: if(pin_value > 512){ knob=1; }else{ knob=2; } break; } } // send mapped CC value MIOS_MIDI_TxBufferPut(pot_event_map[pin][0]); // first value from table MIOS_MIDI_TxBufferPut(pot_event_map[pin][knob]); // second value from table MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin)); // 7bit pot value } However, all that is returned is erroneous messages on all three switches! Any ideas as to where I have erred. Mark.
  21. Thanks Michael, My difficulty in the whole programming is discerning what code does what. The integar after case in the above example would then mean the pin number in decimal form? Mark
  22. OOOOH So near yet so far..... Michael, I decided to test the example you gave me by keeping it simple, and basically using the first two pots only. So, I want to tell the PIC to switch the function of pin one, based on the position of pin two. In this example I wanted to keep it really easy, so I chose a CC event change (Reverb depth to Chorus depth). So here is the code: void Init(void) __wparam { // initialize the AIN driver MIOS_AIN_NumberSet(2); MIOS_AIN_Muxed(); MIOS_AIN_DeadbandSet(7); } void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam { switch (pin) { case 0x01: if(pin_value > 512) { MIOS_MIDI_TxBufferPut(0xb0); MIOS_MIDI_TxBufferPut(0x5b); MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin)); } else { MIOS_MIDI_TxBufferPut(0xb0); // first value from table MIOS_MIDI_TxBufferPut(0x5d); // second value from table MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin)); } } } All I've managed to do though is to get the second pot to change its own function on its own movement. ie Chourus Depth up to the value of 64 and Reverb from there on. Now, I recken one of two things 1. You are raising your eyes to heaven in total disbelief that I actually find this to be a problem 2. You are on the floor rolling around laughing at my ignorance. Both of these situations are totally understandable. But please, once more, wipe the tears from your eyes and help me. Thanks once again. Mark. When I get this completed, I will write the WIKI how to (and why to most importantly) do this little job. After that I'll wash your car for a whole year.....
  23. Excellent, I'll play around and let you know how I fared out, Thanks Again, Mark.
  24. Thank You Michael, This looks superb (not that I have an eye for code, but I'm getting the idea). Two points that I need to clarify: 1. As I have one ainx connected and the core is running in unmuxed mode, would I be better of connecting the 3 gang switch to three spare pins on the multiplexer? 2. I assume (although in my trade assumption is the mother of all f**k ups- I'm a chef) that when you code switch(pin) the (pin) is in direct reference to the pin on the core/multiplexer, and is to be replaced by a value accordingly. So how do I find out the value of the specific pin? Once Again Many Thanks, Mark.
  25. Great Michael, I'll get that set up asap. Now that I understand C a bit better, I see exactly what you have been trying to explain to me. Apologies for the slow uptake. Now that I have a better grasp, I can say now that I will be setting up the three DIN on J5 of the Core on pins A4, A5 and A6. "Additionally we need to have a variable that stores the last state, to prevent any looping unnecessary executions. That's all." As I am using a toggle switch that will always leave one of these pins on at all times, there would be no need to check for a switch off, but instead change the value of the variable accordingly. if(PORTDbits.[i]example[/i]) { ... } What I need to find out now is the value required in example field to check one of those three pins. To finish my query I will use their pin names as per pdf schematic. MIOS_TIMER_Init(0x00, 20000){ if(PORTbits.A4){ variable=value1 } if(PORTbits.A5){ variable=value2 } if(PORTbits.A6){ variable=value3 } } Here, every 2ms the pins will be checked. Am I heading the right direction? This now leaves me with the task of executing commands based on the value of variable, but one step at a time. Thanks Again, Mark. :)
×
×
  • Create New...