Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 06-20-2017, 06:52 PM   #1
dbmdbu
Human being with feelings
 
Join Date: Oct 2014
Posts: 6
Default Csurf, Run() and the "Control surface display update frequency" (long post)

Hi

I'm trying to solve an issue that creates Midi message drop outs, in a custom OSX Csurf driver that sends midi messages to a USB/MIDI device in relation to changes in the volume automation lanes. (what most csurf drivers are designed for...)

The problem:
As soon as there is more then 8 tracks reading volume automation, if those tracks generates simultaneous volume changes (a typical example would be slow fade-outs on all tracks) I get volume jumps on the receiving midi device (a volume control device).

Using the "Midiscope" to analyze Reaper's output midi stream, I can see that received midi messages don't match the fading data.

The problem gets worse on the more "powerfull" CPU Macs. I get a lot of drops/jumps on a i7 and less on CoreDuo2 processor machines.

Looking at the time stamped midi messages coming out of Reaper, I can see that the midi messages timing is problematic. They come in bursts of up to 50 messages (3 bytes type) in less the 1ms, the next ones are spaced 30ms later, but nothing in between

Knowing that the volume Midi data had a 14 bits resolution (16383 steps for the 120 db range), I scaled it down to 10 bits (1024 steps). The drops/jumb have diminished, but I still get some on the i7 mac when playing back 16 tracks or more, or more the 32 tracks on a CoreDuo Mac

I'm trying figure out a way to parse over time the midi messages, using a buffer and some kind of Timer callback function so I can eliminate those 30ms message bursts.

Q1:
Does anyone know if the Run() (Csurf function/callback) timing can be modified (or controlled) to something else the 30ms between calls.

Q2:
What does the "Control surface display update frequency" affect in the Csurf driver API. I have read in a Klinke's MCU Csurf manual that it could be changed to a higher value in if used with a USB device.

Any help or pointer thsoe solve this issue would be appreciated

dbmdbu
dbmdbu is offline   Reply With Quote
Old 06-24-2017, 06:55 PM   #2
Pollo
Human being with feelings
 
Join Date: Jan 2015
Location: Amsterdam
Posts: 94
Default

Well, I think you answered your own questions. Yes, the timing of the run function can be modified and the update frequency does exactly that.
Pollo is offline   Reply With Quote
Old 06-26-2017, 03:51 PM   #3
dbmdbu
Human being with feelings
 
Join Date: Oct 2014
Posts: 6
Default

Quote:
Originally Posted by Pollo View Post
Well, I think you answered your own questions. Yes, the timing of the run function can be modified and the update frequency does exactly that.
Not sure about that...

I checked the Run() timing by outputting a ShowConsoleMsg() every 30 cycles, it would give me a message every second with the default "Control surface display update frequency " set to 15Hz, (15Hz should give 66ms not 30ms...)

Setting it to any other values did not produce any timing changes in the Run() function. Still got a 1 message/sec rate.

I'm still trying to understand what the "Control surface display update frequency" affects in the Csurf overall timing, and how it can be used the affect the timing of a Reaper/Csurf API function

dbmdbu
dbmdbu is offline   Reply With Quote
Old 06-27-2017, 01:38 AM   #4
Geoff Waddington
Human being with feelings
 
Geoff Waddington's Avatar
 
Join Date: Mar 2009
Location: Dartmouth, Nova Scotia
Posts: 11,184
Default

Quote:
Originally Posted by dbmdbu View Post
Not sure about that...

I checked the Run() timing by outputting a ShowConsoleMsg() every 30 cycles, it would give me a message every second with the default "Control surface display update frequency " set to 15Hz, (15Hz should give 66ms not 30ms...)

Setting it to any other values did not produce any timing changes in the Run() function. Still got a 1 message/sec rate.

I'm still trying to understand what the "Control surface display update frequency" affects in the Csurf overall timing, and how it can be used the affect the timing of a Reaper/Csurf API function

dbmdbu
Perhaps the update frequency is how often Reaper sends messages to the control surface.

So if this is true, the Run method timing is the internal Reaper state sampling frequency (fixed at ~33 msec ?), and the adjustable rate just sets how often this new updated state gets sent to the control surface.
__________________
To install you need the CSI Software and Support Files
For installation instructions and documentation see the Wiki
Donate -- via PayPal to waddingtongeoff@gmail.com
Geoff Waddington is online now   Reply With Quote
Old 06-30-2017, 05:25 PM   #5
Kyran
Human being with feelings
 
Join Date: Sep 2010
Posts: 49
Default

I've found showconsolemessage to be a bit slow. Maybe try recording the system time in millis and compare against the times from previous invocations of run(). Then print out the average time delta every ~100th time so you don't have to call showconsolemessage as much.
Kyran 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 12:16 PM.


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