Old 04-04-2008, 12:35 PM   #1
Deric
Human being with feelings
 
Join Date: Mar 2007
Posts: 794
Default CSurf for dummies.

Anyone willing to advise???

I've some simple (very simple) programming skills from a couple of decades ago and wanted to try and improve the integration/functionality of my control surfaces with REAPER.

Can someone please explain the basic procedures we need to do, with which files (from the SDK), and with what software?

Any links would be appreciated too!

Basically - my 01X works well with REAPER but there are a bunch of buttons that aren't mapped - but would be very useful if they were.

I've used MIDI-OX to determine the values sent (by the 01X) for each of the keys.

The 01X works well with Justin's MCU CS selected, so... I was thinking of hacking that and adding in the stuff that's missing.

I thought I'd rename the current MCU file as 01X and then???

I guess I need to re-compile etc - is anyone willing to give a basic breakdown of the procedure one needs to follow to include a (edited csurf_mcu.cpp) csurf_01X.cpp and edited csurf.h back into REAPER?

Are there any of the other files that need to know the existence of csurf_01X.cpp?

If I can manage to do this (obviously I'd test it to death before posting a suggested working version...) I was thinking of doing the same with the csurf_bcf2000.cpp and modding it to work better with the BCR2000.

If this goes well I'll try and integrate my Novation X25 too.

Anyway... first things first - is anyone willing to post an idiots guide on how to get edited .cpp and .h files back into REAPER?
__________________
REAPER? Oh yes...
Deric is offline   Reply With Quote
Old 04-04-2008, 12:48 PM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 6,794
Default

Well you need a compatible (Microsoft) C++ compiler/IDE first. The only free alternative I can suggest is Microsoft Visual Studio Express 2008 C++. It kind of sucks in many ways, but, well, it's M$ we are talking about...

Once you got it installed, you should then set it up so that it can find all the necessary cpp and .h-files for the Reaper csurf-plugin. Actually, to succeed in that, you will also need the Microsoft Platform SDK installed. Big, big, bloated stuff...But you can't do much about that...

Before trying to do anything to the .cpp-files (you should NOT change the Cockos .h-file(s) unless you know what you are doing...), try to compile the reaper_csurf.dll and see if it works like the Cockos-built original one. Then, you could start messing around in the relevant .cpp-files to change and add your own things.
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 04-04-2008, 01:02 PM   #3
Deric
Human being with feelings
 
Join Date: Mar 2007
Posts: 794
Default

Xenakios,

Thank you for replying!

Before I go downloading (etc, etc,) - could you please verify that this is the stuff you are talking about?

http://www.microsoft.com/downloads/d...displaylang=en

and

http://www.microsoft.com/express/vc/

As I REALLY don't want to go off for a few days installing and learning the wrong stuff!

The reason I mentioned the .h file was because it references csurf_n_reg*, I therefore reasoned that if I managed to get a working .cpp that was to, eventually, have a different name - that it would have to be included?

* where 'n' is the surface name.

Thanks Xenakios!
__________________
REAPER? Oh yes...
Deric is offline   Reply With Quote
Old 04-04-2008, 01:20 PM   #4
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 6,794
Default

Oh, I haven't look very closely at all the csurf-stuff. I don't have any control surface myself I'd like to integrate. Well, if a Logitech gamepad doesn't count... I might try the csurf-dev stuff with that some day...

It may be you have to change something in the reaper_plugin.h, I am not sure, Justin will know best. It generally isn't a good idea to make too much additions to the API .h-files, as they get updated etc and you might accidentally lose your intended changes. Already happened to me once...

Those download links you've found seem alright!
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 04-04-2008, 01:24 PM   #5
Deric
Human being with feelings
 
Join Date: Mar 2007
Posts: 794
Default

Great! Cheers Xenakios, and thanks for your help and assistance!

Here goes to too many headaches to come!

Cheers!
__________________
REAPER? Oh yes...
Deric is offline   Reply With Quote
Old 04-04-2008, 01:54 PM   #6
sws
Code Monkey
 
sws's Avatar
 
Join Date: Sep 2007
Location: Madison, WI
Posts: 850
Default

Deric,

The MSVC project is already setup for you in the SDK download. Go to the jmde/csurf directory and open the reaper_csurf.dsw "workspace". It'll ask you if you want to convert, say yes. Do a build, and reaper_csurf.dll will magically appear in the Release directory. That DLL should be the same DLL that ships with REAPER. I would start by just modifying the existing MCU file csurf_mcu.cpp. Don't bother messing with anything else. Once you build with your new changes, just drop that new dll into REAPER\Plugins (overwriting the old) and you should be set to test.

Now... once you get something working, you will probably want to gut the project of all of the other csurfs, edit csurf_main.cpp, and rename to reaper_01X.dll so you can distribute the plugin without colliding with the builtin stuff. By the time you get the 01X working all those old C brain neurons will be firing again and it'll be easy!

(This of course all assumes '08 Express will open the project!)

Hope this helps, I know it's a bit of a rehash of what Xen said.

Last edited by sws; 04-04-2008 at 01:59 PM.
sws is offline   Reply With Quote
Old 04-04-2008, 02:30 PM   #7
Deric
Human being with feelings
 
Join Date: Mar 2007
Posts: 794
Default

Quote:
Originally Posted by sws View Post
...it's a bit of a rehash of what Xen said...
On the contrary, that's additional, sound advice you've provided there SWS!

Very useful indeed - thank you very much!

Heehee... There aren't any old C neurons to refire! I'm hoping I can convert long-unused Assembler, Pascal, and (minimal) Basic neurons into C ones though!

Thanks again SWS - your input has been invaluable and has saved me a bunch of time and head-scratching already!

Cheers!
__________________
REAPER? Oh yes...

Last edited by Deric; 04-04-2008 at 02:47 PM. Reason: Reworded to avoid ambiguity.
Deric is offline   Reply With Quote
Old 04-05-2008, 02:50 AM   #8
Deric
Human being with feelings
 
Join Date: Mar 2007
Posts: 794
Default

Hi!

Just wanted to check whether I'm doing something wrong... When I select 'Build Solution' I get an error (displayed in the Output window - of C++ Express):

.\res.rc(10) : fatal error RC1015: cannot open include file 'afxres.h'

I can't find this .h (by using Windows Search) but was wondering if I need to have the SDK in a specific (i.e. a REAPER) directory, or if I need to download something else for the SDK?

Or do I just ignore it?
__________________
REAPER? Oh yes...
Deric is offline   Reply With Quote
Old 04-05-2008, 03:03 AM   #9
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 6,794
Default

You need the Microsoft Platform SDK installed AND properly set up as an include directory in Visual Studio for that file to be found. Why the Platform SDK can't automatically set itself up in the Visual Studio IDE is beyound me, but that's how it is...

Look for :



By the way, if you haven't already downloaded and installed the Platform SDK, you may feel the temptation NOT to and find the one missing file from elsewhere in the internet etc...Doing that is not good, you probably break Microsoft's license by doing something like that (not that I would personally lose sleep over that) but more importantly, you will quite probably need more of that Platform SDK stuff later on in your coding efforts...
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass and λ) :
http://xenakios.wordpress.com/

Last edited by Xenakios; 04-05-2008 at 03:07 AM.
Xenakios is online now   Reply With Quote
Old 04-05-2008, 03:21 AM   #10
Deric
Human being with feelings
 
Join Date: Mar 2007
Posts: 794
Default

Xenakios!

Wow mate! You are like a machine! That's great!

Thanks very much...

Yes I installed both the SDK and the Visual Studio but, no, I didn't set anything up at all...

Thanks for the tip - I'll do that right away!

Really Xenakios... I'm simply amazed at the speed and quality of your responses here...

Thanks a lot!

Cheers!
__________________
REAPER? Oh yes...
Deric is offline   Reply With Quote
Old 04-05-2008, 03:50 AM   #11
Deric
Human being with feelings
 
Join Date: Mar 2007
Posts: 794
Default

I still get the error...

This is what I've added to the Options:

C:\Program Files\Microsoft SDKs\Windows\V6.0a\Include

Other than the path I am in the same place on the Options screen as your screenshot shows (i.e. Projects and Solutions->VC++ Directories, and I have the Include option showing in the 'Show directories for:' field.

Any ideas??
__________________
REAPER? Oh yes...
Deric is offline   Reply With Quote
Old 04-05-2008, 03:56 AM   #12
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 6,794
Default

Can you find the afxres.h file in your computer at all? If that Platform SDK you have installed did not come with that file, then I don't know what you should do...(Developing with Microsoft tools is a pain in the ass...)

The include directory you have set up in VS, does not seem right, anyway...

It should be something like this :

J:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\mfc

In my installation the afxres.h file is found there. If nothing else helps, you could find the "include afxres.h" in the Reaper plugin project files and comment it out (put // at the beginning of the source code line). That probably won't work also, but well, you can always try...

Hmm, you are on Vista, maybe? I don't know if that matters or not, but I can't give much Vista-spesific advice, I am still on XP and will likely be for many years...
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 04-05-2008, 04:08 AM   #13
Deric
Human being with feelings
 
Join Date: Mar 2007
Posts: 794
Default

Xenakios,

You must be getting bored of me thanking you for your generous and useful assistance - but thank you again!

I installed this:

Windows SDK for Windows Server 2008 and .NET Framework 3.5

But I see from your post that you have 2003.

I'm also on XP and, like you, anticpate being so for years too.

I've searched the machine and there is no file of this name to be found.

I'll remove this SDK and download the 2003 version...

Thanks again!

Ps. Agreed about the commenting-out - I've enough problems as it is and don't want to introduce anything else - especially as I'll probably forget in a couple of days that I commented stuff out anyway!
__________________
REAPER? Oh yes...
Deric is offline   Reply With Quote
Old 04-05-2008, 04:13 AM   #14
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 6,794
Default

Yeah I installed the 2003 Platform SDK because I had that one lying around on some backup hard disk, I've downloaded it a few years ago from MS. And it was a bit smaller in size than the latest official SDK, too...

I didn't think to warn you about the 2008 Platform SDK perhaps being not compatible, because I thought it would be backwards compatible etc, sorry about that! But as I said, developing with Microsoft stuff is a pain in the ass... Especially today when they push the .NET-stuff so hard...(.NET is baaaaaad...)
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 04-05-2008, 04:17 AM   #15
Deric
Human being with feelings
 
Join Date: Mar 2007
Posts: 794
Default

Not your fault - at all in fact.

The link I posted earlier was to the 2003 version - which you said looked OK. I then read the page and it explained that it had been superceded - and gave a link to the 2008 SDK.

My fault not yours! If I'd have followed as agreed I'd be on 2003.

Anyway, have just uninstalled 2008 and if you don't hear from me I'll be testing my bugs!

Thanks again!
__________________
REAPER? Oh yes...
Deric is offline   Reply With Quote
Old 04-05-2008, 04:23 AM   #16
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 6,794
Default

By the way, I don't know why Cockos' source code requires any of that MFC-stuff, I remember Justin maybe saying some critical things about MFC in the past... Maybe he could explain that for us... Actually, anyway, I think that afxres.h is in the includes of pretty much any win32 source code, hmm...
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 04-05-2008, 04:42 AM   #17
Deric
Human being with feelings
 
Join Date: Mar 2007
Posts: 794
Default

I'll take your word for it!

Can I ask? There are several surface button functions that can have dual modes - depending on whether they are pressed whilst another button is held-down.

i.e. There is a SHIFT button.

Holding down Shift allows some of the buttons to have a different function.

Would you do this with a 'wait n-mS' type of approach? i.e. 'If the Shift value has been recieved - wait and read the next value before deciding what to do'? Or is there a more sensible approach?

There are also a couple of latching option buttons, one is a ZOOM button.

If Zoom is on (latched, not momentary toggle like Shift) then the navigation keys can have a second function.

Would I store the value of Zoom (binary, I guess) and then reference whether Zoom was 1 (on) or 0 (off) to determine the function the navigation keys had to perform?

If so would I create a Variable to do this?

Sorry for the basic questions... This SDK download is so slow!
__________________
REAPER? Oh yes...
Deric is offline   Reply With Quote
Old 04-05-2008, 04:52 AM   #18
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 6,794
Default

Sorry, I have very little grasp of how the control surface stuff works and how to best implement new/different things...All the stuff involving getting and interpreting the shift-key and other modifiers in the control surface may already have been implemented in the source code files. And if not, then maybe you have to set up a global variable (that holds the control surface shift-key-state) that you toggle based on some events you receive from the control surface...
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 04-05-2008, 04:56 AM   #19
Deric
Human being with feelings
 
Join Date: Mar 2007
Posts: 794
Default

Quote:
Originally Posted by Xenakios View Post
...set up a global variable (that holds the control surface shift-key-state) that you toggle based on some events you receive from the control surface...
Thanks Xenakios, I'll do that (try to at least!) to get it working and see if Justin or one of the other developers (Cockos or forum-user) has any input on it as I'd prefer to do it the 'best' way if possible!

Anyway... I'm still waiting for this download!

Will let you (and anyone else interested) if the 2003 SDK fixes this issue with the missing .h

Cheers!
__________________
REAPER? Oh yes...
Deric is offline   Reply With Quote
Old 04-05-2008, 11:22 AM   #20
Deric
Human being with feelings
 
Join Date: Mar 2007
Posts: 794
Default

Just dropping a quick note here for anyone else:

In addition to the (three) Include directories as shown in Xenakios' screen shot, I also had to add:

C:\Program Files\Microsoft Platform SDK\Lib

This needs to be an added path in the 'Show directories for: Library files' field of Visual C++ Express Edition 'Tools->Options' as the Build failed with a Fatal Error due to not finding:

odbc32.lib

Anyway... great! I'm not set up and ready to start messing things up good and proper!

Thanks Xenakios and SWS for helping me get this far!
__________________
REAPER? Oh yes...
Deric is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:59 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.