View Single Post
Old 06-02-2008, 11:49 AM   #88
Deric
Human being with feelings
 
Join Date: Mar 2007
Posts: 794
Default

Ian,

Honestly I simply don't yet know enough to be able to attempt a worthwhile tutorial on this stuff, unlike you I still haven't figured out "what all the blocks are doing".

My 01X code (csurf_01x.cpp) is in the SDK now - along with all the other control surface .cpp files. It's reasonably documented as to what is doing what etc.

I went as far as I felt I could with the 'current' 01X release, I then realised that I had to learn more of the basics of C++ programming before being able to attempt 'the next stage'. I know that once I am comfortable with this next stage that I'll be able to apply that understanding to any other control surface.

'Hacking-and-hoping' quickly becomes tiring after a few weeks - it gets to the stage where you know that you simply don't know enough and then have to find out what you need to know next.

If you want to have a try I'd suggest messing about with the .cpp of the control surface emulation you are currently using - that's what I did when I started this - I looked at the mcu cpp and started modifying bits of it and just continued from there.

To get an LED to illuminate you'll need something like this:

Code:
if (m_midiout) m_midiout->Send(0x90, 0x64,0x7f,-1);
What this does (I think!) is check if access is available to the MIDI Out port, and if it is, it transfers the following message to the MIDI Output utility:

90 64 7F

This is a 'Note On' message for note '64' - in Hexadecimal (you know it's Hex because the number is expressed '0xnn' in the command. (This is therefore note '100' in decimal - but that probably won't matter - as you'll determine the value with, say, MIDI-OX which will display it in Hex anyway...).

I think '90' specifies that the message is a 'Note On/Off' type of message, the 'middle' value (in the above case '64') specifies the 'note/pitch', and the last value (7F) specifies velocity.

Ordinarily a velocity of 00 will turn an LED off, whilst 7F turns it on. However, some LEDS have multiple states/colours and require a velocity value other than 7F to trigger the LED in that colour (and if you find out how to determine this without a load of very boring, time consuming, incrementing a value, re-compiling, transferring the newly compiled .dll to REAPER, starting REAPER, and then seeing if the LED has changed colour - before doing it all over again, for every value, please let me know!).

Of the stuff I've looked at so far it seems to be that LEDs 'generally' have the same address (note on/off (middle number) number) as the button they are related to. So, if your button thows out 'code x' when you press it, then sending 'code-x' back to the unit will trigger that button's LED.

If I already had the knowledge to the complete what I am trying to do - I would be able to get a Houston map out (or, pretty much, any other CS map) within a few hours - this is not yet the case, which is why 01X V2 is not out yet, and also why I say I don't have enough understanding to be able to supply you with a suitable 'framework'.

What I don't want to do is 'do a little bit of a lot of things'... I want to do this so that it is as useful as it can currently be (given what is achievable with the current Cockos SDK) and whilst it would seem tempting to start getting 'skeletons' together for other control surface types, in reality is is just distracting time away from actually understanding what I need to know to understand how to use the SDK properly.

I will say that there is (at least in my case) a significant difference between modifying bits of code to do something different/access a different address/run a different command, and actually knowing what one's doing, with enough understanding, to get the code to do whatever one wants it to do - within its given limitations.

Having said (all of) that - you can get very far just by hacking existing code with very little actual understanding (as I did previously with the 01X), so if you want to - just do as advised above and start looking at the .cpp that your surface currently works best with.

I hope this is of some help

Deric.
__________________
REAPER? Oh yes...
Deric is offline   Reply With Quote