Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Developer Forum

Closed Thread
 
Thread Tools Display Modes
Old 11-30-2014, 11:02 AM   #81
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,335
Default

Quote:
Originally Posted by Lawrence View Post
As someone who failed a few times to get a basic extension running
Did you try to write/set up everything from scratch or did you try to open and build some of the existing extension plugin projects? The former way obviously is going to be hard, there are all kinds of details to worry about. (Which might not even have anything to do with C or C++ directly. For example the C++ language has no notion of binaries being 32 or 64 bit, but of course in practice you have to worry about that yourself when building since 32 bit Reaper can't load 64 bit plugins and vice versa...Another "gem" which will trip up people trying to do this is that the Reaper extension plugin dll names have to start with "reaper_", otherwise Reaper won't even consider loading the dll. Again that's a thing that has nothing to do with the C or C++ languages.)

With C(++) it's best to first see if building an existing project succeeds, and then start modifying the code in the project because of the intricacies involved in just building the code. When you are more confident about your abilities, you can start building things more from scratch.
__________________
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, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/

Last edited by Xenakios; 11-30-2014 at 11:08 AM.
Xenakios is online now  
Old 11-30-2014, 10:32 PM   #82
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,054
Default

Xenakios, figured this one is relevant to the topic.

I didn't know you had to re-generate reaper_plugin_functions.h by going running REAPER and finding the --> actions --> action list --> search for "developer" run "Write C++ API"

When I replace the old functions.h with the new one, GetSelectedMediaItems throws an error, as well as CountSelectedMediaItems. I get a bunch of "expected ')'" errors from reaper_plugin_functions.h as well as stuff like "ReaProject undefined"

The reason I need to update reaper_plugin_functions.h is because there's no AudioAccessor class in the old one.

Any possible explanation? thank you!
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline  
Old 11-30-2014, 10:41 PM   #83
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,335
Default

Quote:
Originally Posted by Argitoth View Post
Xenakios, figured this one is relevant to the topic.

I didn't know you had to re-generate reaper_plugin_functions.h by going running REAPER and finding the --> actions --> action list --> search for "developer" run "Write C++ API"

When I replace the old functions.h with the new one, GetSelectedMediaItems throws an error, as well as CountSelectedMediaItems. I get a bunch of "expected ')'" errors from reaper_plugin_functions.h as well as stuff like "ReaProject undefined"

The reason I need to update reaper_plugin_functions.h is because there's no AudioAccessor class in the old one.

Any possible explanation? thank you!
Ouch, these can be tricky...I will test later (once I've got some sleep) how the latest Reaper generated reaper_plugin_functions.h works with my own current code. (The ReaProject undefined thing is stupid, I'd consider that a bug in Reaper...)
__________________
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, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is online now  
Old 04-07-2015, 10:18 AM   #84
aurelien
Human being with feelings
 
Join Date: Apr 2014
Posts: 21
Default

Hey it's a great project! Really easy to setup for beginners, i was able to compile and load my dll successfuly, even attaching VS2013 to debug.

But when i launch any Reaper method in my code, i'm getting an exception, as if i was missing the reaper dll, am i missing a dll linking? Project settings?
I have my REAPER_PATH setup in my environment variables.

For example, i'm just calling simple EnumProjects method in the doAction1():
MessageBox(g_parent,L"Hello World!",L"Reaper extension API test",MB_OK);
char rpp[MAX_PATH];
EnumProjects(-1, rpp, MAX_PATH);


Thanks!
aurelien is offline  
Old 04-07-2015, 11:14 AM   #85
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,335
Default

Quote:
Originally Posted by aurelien View Post
Hey it's a great project! Really easy to setup for beginners, i was able to compile and load my dll successfuly, even attaching VS2013 to debug.

But when i launch any Reaper method in my code, i'm getting an exception, as if i was missing the reaper dll, am i missing a dll linking? Project settings?
I have my REAPER_PATH setup in my environment variables.

For example, i'm just calling simple EnumProjects method in the doAction1():
MessageBox(g_parent,L"Hello World!",L"Reaper extension API test",MB_OK);
char rpp[MAX_PATH];
EnumProjects(-1, rpp, MAX_PATH);


Thanks!
The plugin example only manually imports the functions from Reaper needed by the example...Which isn't that many functions. EnumProjects isn't among the manually imported functions in the plugin code. The source code has a warning comment that the functions needed by the plugin must be imported from Reaper if they are going to be used, otherwise a crash will occur. The newer Reaper header files actually have some stuff added that allow importing all the API functions in one go, I should probably update the example plugin code to use that instead of the manual IMPAPI macro calls.

The example extension plugin doesn't use an environment variable REAPER_PATH, so having that set or unset wouldn't affect anything.
__________________
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, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/

Last edited by Xenakios; 04-07-2015 at 11:24 AM.
Xenakios is online now  
Old 04-10-2015, 05:03 PM   #86
little Ellison
Human being with feelings
 
Join Date: Jun 2014
Posts: 47
Default

Quote:
Originally Posted by Xenakios View Post
The plugin example only manually imports the functions from Reaper needed by the example...Which isn't that many functions. EnumProjects isn't among the manually imported functions in the plugin code. The source code has a warning comment that the functions needed by the plugin must be imported from Reaper if they are going to be used, otherwise a crash will occur. The newer Reaper header files actually have some stuff added that allow importing all the API functions in one go, I should probably update the example plugin code to use that instead of the manual IMPAPI macro calls.

The example extension plugin doesn't use an environment variable REAPER_PATH, so having that set or unset wouldn't affect anything.

If I recall, when I generated the reaper_plugin_functions.h from the action menu (to use some of the newer api funcs in recent releases), my api init code, based on the example, quit working.

There's a detailed description in reaper_plugin_functions.h of the new way to do it.


Also, HUGE props and thanks to xenakios for the example and the ongoing help here. Really made it a lot easier for me, thanks, xenakios..

Last edited by little Ellison; 04-10-2015 at 05:47 PM.
little Ellison is offline  
Old 04-12-2015, 07:09 AM   #87
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,335
Default

Quote:
Originally Posted by little Ellison View Post
If I recall, when I generated the reaper_plugin_functions.h from the action menu (to use some of the newer api funcs in recent releases), my api init code, based on the example, quit working.
Yeah, the example plugin has been tested to only work with the header files that are distributed with the example source code. Which is a shame, as the API has expanded so much after the example was written. I will try to update the example at some point to use the newer header file that can be generated from Reaper.
__________________
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, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is online now  
Old 04-12-2015, 05:08 PM   #88
WyattRice
Human being with feelings
 
WyattRice's Avatar
 
Join Date: Sep 2009
Location: Virginia
Posts: 1,827
Default

Here's some info I found about the screensetCallbackFunc

From this post http://forum.cockos.com/showpost.php...&postcount=657

In the reaper_plugin.h or the one I have, it's located on line 794

Code:
typedef LRESULT (*screensetCallbackFunc)(int action, char *id, void *param, int param2);
do I still keep that line and add
Code:
typedef LRESULT (*screensetNewCallbackFunc)(int action, const char *id, void *param, void *actionParm, int actionParmSize);
below that, or should I just overwrite that line?

Then in the Reaper generated reaper_plugin_functions.h (generated from version 4.77)

add these
Code:
class ReaProject;
class TrackEnvelope;
right below where it states "class AudioAccessor;" ?

Anyway,
I have everything working, and it builds ok, with both Reaper generated function headers from 4.77, and the latest 5 pre.
It makes me wonder why doesn't cockos have a newly generated reaper_plugin.h like the function one does.

Last edited by WyattRice; 04-12-2015 at 08:40 PM.
WyattRice is online now  
Old 04-13-2015, 04:39 AM   #89
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,335
Default

Quote:
Originally Posted by WyattRice View Post
Here's some info I found about the screensetCallbackFunc
If it compiles and runs OK, then it's probably OK. I wouldn't want to start explaining in this thread how to edit the Reaper header files, even if the changes are trivial. The problem is that then beginners will be confused what is actually the right header file with what edits to use etc...Let's try to keep this thread about the simple plugin example. (Though it seems the thread has kind got quite confusing in any case. It would be best to start a new thread with updated files and so on.)
__________________
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, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is online now  
Old 10-08-2017, 06:30 AM   #90
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,044
Default

Quote:
Originally Posted by Xenakios View Post
The last time (this month) I talked with Justin about the C API undo stuff, he suggested me to use the undo functions that don't use the Undo_BeginBlock() stuff at all. So, for example use just this at the end of a successful action function run :

Code:
Undo_OnStateChange2(0,"Rename selected media item active takes to source filepath");
Note that you have to add the IMPAPI(Undo_OnStateChange2); line into your plugin entrypoint function in order for the function to work.

I think the Undo_BeginBlock/Undo_EndBlock call pairs are mostly useful in the situation when your extension code calls Reaper's built in actions, so that you don't get additional entries into the undo history. If you actually need that, I am not sure how you can cancel the already made Undo_BeginBlock call... :-/ (And I do recall that not making the EndBlock call does cause problems...)
Is there a way to suppress creating individual undo points when calling Reaper's built in actions in C(++) extension (here: SWS extension) without wrapping them in Undo_BeginBlock/Undo_EndBlock ?

Last edited by nofish; 01-30-2018 at 08:00 PM.
nofish is offline  
Old 01-30-2018, 08:00 PM   #91
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,044
Default

Quote:
Originally Posted by nofish View Post
Is there a way to suppress creating individual undo points when calling Reaper's built in actions in C(++) extension (here: SWS extension) without wrapping them in Undo_BeginBlock/Undo_EndBlock ?
bump, anyone ?
In this case I'd like to create no undo points at all when calling Reaper's native actions.
nofish is offline  
Old 04-19-2018, 10:16 AM   #92
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 1,818
Default

Thank for this! xenakios! i'll dive and do my first extension on C++! : )
I am bit confused! i think i'll prefer working in Xcode ! My question is quite basic.
For making the xcode project, i should include the first posted files in a new project and also WDL, and i am good to go? ! Wawaweee! i want to do this steps because it's part of the learning process.

Also ! in order to make it compile for different platforms (win, osx, linux), this files is all we need?

Last edited by deeb; 04-19-2018 at 10:23 AM.
deeb is offline  
Old 04-19-2018, 10:56 AM   #93
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,335
Default

Quote:
Originally Posted by deeb View Post
Thank for this! xenakios! i'll dive and do my first extension on C++! : )
I am bit confused! i think i'll prefer working in Xcode ! My question is quite basic.
For making the xcode project, i should include the first posted files in a new project and also WDL, and i am good to go? ! Wawaweee! i want to do this steps because it's part of the learning process.

Also ! in order to make it compile for different platforms (win, osx, linux), this files is all we need?
The example project in this thread is probably hopelessly out of date by now... edit : The Googlecode page doesn't even work anymore to get the source code. (Or did it work for you? Doesn't appear to be working for me...)

As mentioned already in the first post, the single code file at pastebin is completely useless for a newbie. Also the code has nothing to do with control surfaces, you need completely different code for that. Look in the official Cockos SDK for examples...
__________________
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, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/

Last edited by Xenakios; 04-19-2018 at 11:12 AM.
Xenakios is online now  
Old 04-19-2018, 11:20 AM   #94
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 9,688
Default

Closing this thread at Xenakios's request.
schwa is offline  
Closed Thread

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 05:32 PM.


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