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

Reply
 
Thread Tools Display Modes
Old 03-09-2017, 04:37 PM   #41
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 6,556
Default

Quote:
Originally Posted by rjlwest View Post

Also, the only bits of non library code I still use from the example project are

execute_in_main_thread
start_or_stop_main_thread_executor
mtetimerproc

I was wondering if this code is from Reaper or if I would be ripping off someones hard work? The Reaper plugin I'm making os a very lightweight part of something far deeper and will be comercially available so I'm just investigating whether or not I should take it out.

also one more question

_timer = SetTimer(0, 1000, 333, Proc);

the third parameter is UINT rate, I Was wondering are these milliseconds? I'm having a terrible problem with performance and can't pin it down, I think I investigated this already and found them to be milliseconds and that it sleeps for that time after the function has run until its called again.
That timer etc code was done by me. You can do whatever you want with it, but obviously I don't offer any support or warranties it works correctly. Use at your own risk. I am not responsible for any problems you may encounter. It might be wiser to use something else since that code was, if I recall right, just some experimental stuff I tried. What do you actually need to be able to do?
__________________
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 offline   Reply With Quote
Old 03-09-2017, 05:14 PM   #42
rjlwest
Human being with feelings
 
Join Date: Nov 2016
Posts: 14
Default

Quote:
Originally Posted by Xenakios View Post
That timer etc code was done by me. You can do whatever you want with it, but obviously I don't offer any support or warranties it works correctly. Use at your own risk. I am not responsible for any problems you may encounter. It might be wiser to use something else since that code was, if I recall right, just some experimental stuff I tried. What do you actually need to be able to do?
thanks. I'm using reaper as a server, it both listens and broadcasts to and from a socket. it queries reaper for things like media clips, fx info, packages it all up into my data type and sends it via osc to my standalone program. then i change things in the standalone program and send it back to reset the reaper objects. I liked your way of doing it as it just worked straight away and put things on the main thread, however I need to turn the frame rate all the way down so I need to investigate what's taking so long, no doubt it's how I'm communicating with my osc library, its a multi threaded dynamic library loaded at runtime that both reaper and the standalone app have instances of, listening and sending to each others designated socket. I'll be doing something silly somewhere.
rjlwest is offline   Reply With Quote
Old 03-09-2017, 05:22 PM   #43
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 6,556
Default

Quote:
Originally Posted by rjlwest View Post
however I need to turn the frame rate all the way down so I need to investigate what's taking so long
The code was probably never tested with heavy load etc...It isn't that ideal anyway since it uses mutex locking during adding the tasks and during the execution of them. (So the non-GUI threads adding the tasks may get blocked for a quite long time, depending on how much work the timer callback on the GUI thread takes etc...) There probably is some other solution around, I didn't find anything ready to use though, which is why I tried doing that solution of my own. (I dunno, maybe the Windows API PostMessage function could be leveraged but if I recall right, that has problems of its own if one wants to execute arbitrary tasks.)
__________________
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 offline   Reply With Quote
Old 03-10-2017, 06:38 AM   #44
rjlwest
Human being with feelings
 
Join Date: Nov 2016
Posts: 14
Default

I'm on mac so maybe there's some kind of mac specific objective-c dispatch queue function I can look into. Also we had a talk on spinlocks at work, maybe I can implement something there and avoid the locking. I actually think the locking wouldn't be a problem for me at the moment, the call just comes from an update from my osc lib, it would only hang up similar function calls which is fine for me.
rjlwest is offline   Reply With Quote
Old 03-10-2017, 06:46 AM   #45
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 6,556
Default

Quote:
Originally Posted by rjlwest View Post
I'm on mac so maybe there's some kind of mac specific objective-c dispatch queue function I can look into
Apple's Grand Central Dispatch (aka libdispatch) has a way to put tasks into the GUI thread.

If you are only on Mac, you should definitely use something else than my code, as on OS-X it depends on the Swell library which is overkill to just be able to use SetTimer and KillTimer.

Anyway this is getting way off topic for this thread.
__________________
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; 03-10-2017 at 07:06 AM.
Xenakios 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 03:38 AM.


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