Old 06-04-2014, 07:03 AM   #1
Apokalipsis
Human being with feelings
 
Join Date: Jan 2012
Location: Ukraine->Germany
Posts: 60
Default Example reaper plugin from plain C or other languages

Hi all!
Please give an example of writing a plugin for plain C or any other language.
I really do not know much C + +.
I programming on purebasic and freebasic.
I know a C
Apokalipsis is offline   Reply With Quote
Old 06-04-2014, 07:42 AM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Much of the Reaper API is just C, including the plugin entry point function, so you shouldn't encounter too many issues trying to use plain C. However, there are some things that can't be done from plain C as they require writing or using C++ classes. I would suggest just doing a C++ project where you write the code like it is C most of the time and deal with the C++ stuff as the need rises.

Trying other languages than C or C++ is not realistically going to work for making Reaper extension plugins. You wouldn't have any help available. There are very few people doing even C(++) extension plugins to begin with.

You might really also want to consider using ReaScript (which can be written in Python or Cockos's eel language) if your needs for extending/customizing Reaper are not very complicated. You should have a really really good reason for trying to make C(++) Reaper extension plugins. Do you have such a reason?

(Also, as a side note : C++ isn't really that complicated. It is complicated if you make it complicated for yourself, by for example reading bad tutorials and bad code. C++ is in my opinion much easier and safer than C and doesn't sacrifice any performance compared to C. If someone tells you otherwise, they are plain wrong.)

This example code of mine by the way doesn't at quick glance use any C++ specific features, it's just that the code file is named main.cpp instead of main.c...The plugin example is so simple, that no C++ was needed. It's just making some Reaper C API calls etc.

https://code.google.com/p/simple-rea...fd11ea1b3f7ec2
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.

Last edited by Xenakios; 06-04-2014 at 07:57 AM.
Xenakios is offline   Reply With Quote
Old 06-04-2014, 08:08 AM   #3
Apokalipsis
Human being with feelings
 
Join Date: Jan 2012
Location: Ukraine->Germany
Posts: 60
Default

[QUOTE=Xenakios;1363702]Much of the Reaper API is just C, including the plugin entry point function, so you shouldn't encounter too many issues trying to use plain C. However, there are some things that can't be done from plain C as they require writing or using C++ classes. I would suggest just doing a C++ project where you write the code like it is C most of the time and deal with the C++ stuff as the need rises.

Trying other languages than C or C++ is not realistically going to work for making Reaper extension plugins. You wouldn't have any help available. There are very few people doing even C(++) extension plugins to begin with.

You might really also want to consider using ReaScript (which can be written in Python or Cockos's eel language) if your needs for extending/customizing Reaper are not very complicated. You should have a really really good reason for trying to make C(++) Reaper extension plugins. Do you have such a reason?

Thanks Xenakios from ansver!
Reaaccess plugin is no longer developed, and I want to write your own plugin for controlling reaper using screenreaders, and enable with visual impairments people to write music.

Sory my bad english...
Apokalipsis is offline   Reply With Quote
Old 06-04-2014, 08:29 AM   #4
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by Apokalipsis View Post
Thanks Xenakios from ansver!
Reaaccess plugin is no longer developed, and I want to write your own plugin for controlling reaper using screenreaders, and enable with visual impairments people to write music.
Sory my bad english...
You are trying to do a good thing but it will be difficult. As you can see from the main.cpp code I posted a link to, even a very simple Reaper plugin is already quite complicated. (I think you can't do something like ReaAccess with ReaScript, either.)

I wish you the best of luck!
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 06-04-2014, 08:40 AM   #5
Apokalipsis
Human being with feelings
 
Join Date: Jan 2012
Location: Ukraine->Germany
Posts: 60
Default

Thanks for the help!
I will deal with your code and learn api reaper.
Apokalipsis is offline   Reply With Quote
Old 10-19-2014, 08:30 AM   #6
msiren
Human being with feelings
 
Join Date: Jun 2012
Location: Jyväskylä, Finland
Posts: 8
Default Learn the basics first..

Quote:
Originally Posted by Apokalipsis View Post
Thanks for the help!
I will deal with your code and learn api reaper.
Your motive is great! Doing something to help someone do something with something, helping other people in general is great. That is what I am trying to do with this reply, so do not get me wrong.

It appears that you know basic language and that is a good starting point, you've stepped into the world of developing. I did the same thing about 23 years ago so I might have some clue what I'm talking about at least I hope so.

Gathering information from your replies I think you are a fresh face in the world of programming, but you might be lacking in programming and what it means and how things are done. This is something that people learn to do by doing things and by rime. I know this because I've been there and I've experienced it (and still am actually, still learning after doing this stuff professionally over ten years).

As a word of advice I would suggest that you learn C and maybe the basic of C++ too. I suggest that you do this by doing simple example that feels pointless and might feel that you already know that stuff. Get comfortable with C language and after you feel like you've evolved then take the Reaper plugin examples and learn them. Patient is something that people sometimes do not have, believe me I know what I'm talking about.
Jumping straight into learning the Reaper plugin and stuff and the part of language feels like a cool thing to do, but it isn't actually, once again believe me I've been there done that. Having the patient to learn the language first will help you considerably in your guest.
And knowing that writing well optimized code in performance wise and putting everything in one .cpp file and writing huge functions to save the overhead that from function calls is just not applicable today. We are not running 086 processors anymore. It is now and has been for several years the trend in programming: code is written once and read many times. So trying to make you code clean and simple to read has higher priority than trying to write "optimized" code before you have event seen that applications performance.
I am not pointing at my finger are you trying to say that you are doing it wrong. I just try to say things I've gone trough and I have seen people go through time and again.

Personally I found the Reaper plugin code to be quite a hack. I did have trouble to get it to work in the first place when trying to write csuft plugin for Tascam FW-1082. Now taking the write once read many times idea I came to the conclusion that creating a plugin base that tries to make the plugin development object oriented is a good thing to do at first. I am currently working on that project in a private repo in bitbucket. Some wiki pages, cleaning and rewriting part of the code and code reviews and it could be ready for public.
msiren is offline   Reply With Quote
Old 10-19-2014, 05:43 PM   #7
vtsaran
Human being with feelings
 
Join Date: Jan 2011
Posts: 64
Default

Hi.
I am already working on a similar plugin for the Mac. OS X is my primary concern at the moment ,but the code will be easy to move to another platform at a later date.
Interestingly enough, the biggest challenge in writing such an extension is not the knowledge of programming, although this is obviously critical, but the Reaper API itself and sparse documentation around this project makes the effort so much more time-consuming than it needs to be. After spending hours after hours, you eventually grow into it.
When writing a similar extension using Cakewalk Control Surface API, the process was much smoother because of the class-oriented approach they have taken.
Anyways, I am eternally grateful for the SWS extension which I use as my cookbook as there is really nothing else that gets close to using Reaper API to such a great extent.

Best,
Victor
__________________
--- --- ---
Visit me at https://www.youtube.com/vtsaran
vtsaran is offline   Reply With Quote
Old 10-20-2014, 04:40 AM   #8
msiren
Human being with feelings
 
Join Date: Jun 2012
Location: Jyväskylä, Finland
Posts: 8
Default Mumble Rumble going off the topic...

Quote:
Originally Posted by vtsaran View Post
Hi.
I am already working on a similar plugin for the Mac. OS X is my primary concern at the moment ,but the code will be easy to move to another platform at a later date.
Interestingly enough, the biggest challenge in writing such an extension is not the knowledge of programming, although this is obviously critical, but the Reaper API itself and sparse documentation around this project makes the effort so much more time-consuming than it needs to be. After spending hours after hours, you eventually grow into it.
When writing a similar extension using Cakewalk Control Surface API, the process was much smoother because of the class-oriented approach they have taken.
Anyways, I am eternally grateful for the SWS extension which I use as my cookbook as there is really nothing else that gets close to using Reaper API to such a great extent.

Best,
Victor
Nice to hear that someone else has activated with the plugin stuff. The code to get the plugin to work seems a bit messy and the missing documentation on the Reaper API does not help. Surely you can get things done, but from my point of view it is just indication of bad practise taking over probably most of the reaper project. Hacking things together in the middle of the night and writing code that only you understand was cool and neat, but that was over ten years ago for me. What I am trying to say here is that if you let the code base go in the this-is-my-code direction it will be difficult to change it and the negative impact that comes from that might come much much later. And one thing I do not like is that writing hacks after hacks and using very bad practice and then giving it as example for somebody else because this will give the less experienced the impression that the code is ok although it is not. This is one of my main motivations to do the OOP based plugin project. Also try to make APIs easy to use and very hard to misuse is also something that I would like to aim for. What I am trying to achieve with the project is that since control surfaces use quite a lot of same functionality and ideas this plugin would give most of that and reduce the boiler plate code significantly when developing csurf plugin. If this project succeeds I will try to do same for other plugins as well. SWS seems to be very popular and most people rely 100% on it. One of my plans is to write the base for creating action plugin and try to rewrite the SWS in such way that actions are encapsulated and separated nicely making the code base more readable and hopefully more manageable.

I too am making the plugin project with OS X with Xcode 3,, but a friend of mine who has agreed on code review also most likely will help me to create visual studio project out of it. The aim is to create such project files that they work out of the box. I hope I can achieve this.

Now back to the original subject. What I am trying to say to Apokalipsis is that taking the time to learn C and C++ might be not so interesting and time consuming, but the pay off that you get out it, compared to the way of learning the language and the application at the same time, is huge. This isn't something that is a fact for everybody, but I believe that for most people this is the case. And once again I know this by experience.
msiren is offline   Reply With Quote
Old 10-20-2014, 05:38 PM   #9
vtsaran
Human being with feelings
 
Join Date: Jan 2011
Posts: 64
Default

Thanks. THis kind of boilerplate would be a great addition to the arsenal of Reaper developer tools. I really love the idea and the spirit behind the whole initiative.

Looking forward to more news.
Best,
Vic
__________________
--- --- ---
Visit me at https://www.youtube.com/vtsaran
vtsaran 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 02:12 PM.


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