Fear the Weasel Posted April 27, 2005 Report Share Posted April 27, 2005 *FIXED PICTURE LINK, sorry :) *Hi there everyone. I'm just trying to wrap my head around how all this programming fits together. I've done a lot of C programming before and a bit of ASM (a while ago granted) so the actual coding is not so much the issue, more how it is implemented.What I want to do: My midibox is a custom effect controller that controls a VST I have made for doing long evolving delays (prodominent in Dub music). The box actually controls two seperate effects (delay lines) which do the same thing (different sounds can be sent to each). Each effect has a 3 digit LED display which shows the delay timing information (ie. how many beats is the delay length  4, 1/2, 1/5, 1/6 etc). There are two buttons beneath this which increment and decrement this value.The output of the box just needs to be a single CC value and the display just needs to show 14 preset labels.               0   1   2   3   4    5     6    7    8     9    10     11    12    13Display        4/0 3/0 2/0  1/0 1/2   1/3   1/4   1/5   1/6   1/8   1/12   1/16   1/32   1/64CC  Output    0   10  19  28  37   46   55   64   73   82   91    100   109   118(CC value = (127\14) * index number, result then rounded up)I was just thinking of putting this info into an array (like above) where the Display field would hold the 3*8 bit values for the LED digit display.The increment and decrement buttons just control the index value and wrap at each end ( <0 & >13).Is this all possible with the C wrapper? (would be much easier for me)  How would I integrate this C code into the MB64 existing code? (which files need changing etc.)Not looking for the exact code from someone, just directions as where to start writing it myself. I've been reading all the code examples and documentation for a while now but that little light hasn't quite flicked on in my head yet. :)Thanks for your time, hope this isn't too long. :) Quote Link to comment Share on other sites More sharing options...
Fear the Weasel Posted April 28, 2005 Author Report Share Posted April 28, 2005 * FIXED PICTURE LINK ABOVE *Okay, here's what I'm thinking so far in psuedo-code. (note: this is just for one of the two LED Displays to simplify things)On Button x1  ;;Left button - decrease  If counter == 0   counter = 13 ;; wrap at each end, 14 Different values possible - see table above  else   counter--On button x2 ;;Right button........Update LED Digits   temp_sr = 8 bit value from table (counter*24) ;;Get Data for relevant 1st LED digit  (each index of the table hold 3 * 8bit data. 3 Digits,8 LEDS)    MIOS_SR_DOUT(sregister2 with temp_sr)  ;; DOUT registers 2 to 7 will be used for each of the 6 total digits (see picture above)      temp_sr = 8 bit value from table (counter*24+8) ;;Get Data for relevant 2nd LED digit    MIOS_SR_DOUT(sregister3 with temp_sr)        temp_sr = 8 bit value from table (counter*24+16) ;;Get Data for relevant 3rd LED digit    MIOS_SR_DOUT(sregister3 with temp_sr)  Update CC Value   CCValue = ccvalue from table (counter)  ;;see post aboveI realise it's kinda a hack to just store the data for the digits like this (instead just of the data for each digit 0-9, then writing code to sort out what needs to be displayed) but because of the nature of the numbers used (see table in above post) I figure it's much easier to consider the 3 digits as 'labels'.Hold your breath cos here's the questions.....1)  Would this code go in the mb64_buttons.inc file under MB64_BUTTON_Handler or as a META event?2)  Is my table that stores the sregister values for the digits alright or should I try and integrate the LED_digits1_v1_3 code?3)  Could I just use a pot to store the CC data in? My box doesn't use all the pots so could an unused one of these actually output the CC data? (0 - 127 in steps of (127/14) )4)  If above is possible wouldn't it then be not too differcult to use this value to update the LED Display when the VST changes it?5)  Am I even on the right track here?? :)Please ask if anything here doesn't make any sense. Any hints or tips no matter how small would be of help. If I get this all working I plan to write a bit of a quick tutorial about modifying code and how I did what I'm doing, a sort of primer for people like me. ;)Cheers guys!! Quote Link to comment Share on other sites More sharing options...
TK. Posted April 30, 2005 Report Share Posted April 30, 2005 Hi Weasel,it's not trivial to combine such a large application like MIDIbox64 with C code, I would say it isn't worth the effort.For your project only a very small number of MB64 features are required, it mainly relies on functions which are already provided by MIOS.This means: the easiest solution is to write this from scratch by using the MIOS C wrapper. Just download the C skeleton and SDCC, and start to play with the code.Keep in mind that all functions which are described here: http://www.ucapps.de/mios_fun.html are also available in C, this saves you from reinventing the wheel :)Once you got some experiences how the MIOS concept is working, you will notice that it is very easy to realize your plans (especially when you already have C skills :)Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Fear the Weasel Posted April 30, 2005 Author Report Share Posted April 30, 2005 Thanks!Hopefully over the next few weeks I'll start sorting something out. Would make a good example on using the MIOS C Wrapper I think.Cheers!!! Quote Link to comment Share on other sites More sharing options...
TK. Posted May 1, 2005 Report Share Posted May 1, 2005 Would make a good example on using the MIOS C Wrapper I think.yes! A public release of your project would be very interesting for other peopleBest Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.