COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 04-08-2017, 06:05 PM   #1
CaptnWillie
Human being with feelings
 
Join Date: Dec 2016
Posts: 51
Default Gain Over Time display

Hey guys,

All the help has been tremendous so far, so thanks again. But I have been trying to draw a loudness meter over time for a compressor that I am working on, so I can draw the gain above the threshold over time, similar to meters shown here:

http://www.musictech.net/2016/10/loudness-meters/

but I can't quite figure out how I should do it. I am using Youlean's awesome Cairo framework which is awesome, and I have a class where I do some drawing with rectangles inside a draw function:

Code:
    int i;
            //
            for (i=1; i < 500; i++)
               
            cairo_rectangle (cr, i, top + height / 2, 1, - fabs(rightInput[i]) * 550);
            cairo_set_source_rgba(cr, .5, 0.7, 0, 0.9);
            cairo_fill (cr);
my goal was to make something that will be a slider that will show gain over the last 2 seconds or so as it slides, I was thinking of a shift register, plotting a series of rectangles w the height that slide.
Which I wanted to rectify the signal, plot successive rectangles with a height relative to the magnitude of the signal. This ended up drawing a pseudo waveform that constantly refreshes. As always, if anyone can suggest a good way to draw that would be very appreciated!
CaptnWillie is offline   Reply With Quote
Old 04-09-2017, 07:26 AM   #2
Youlean
Human being with feelings
 
Youlean's Avatar
 
Join Date: May 2015
Location: Serbia
Posts: 652
Default

Simplest way to do this is using std::deque to construct buffer (use push back and pop front) and then use cairo_move_to, cairo_line_to and cairo_stroke or cairo_fill. Look at the documentation. https://www.cairographics.org/manual/cairo-Paths.html
Youlean is offline   Reply With Quote
Old 04-09-2017, 08:54 PM   #3
CaptnWillie
Human being with feelings
 
Join Date: Dec 2016
Posts: 51
Default

Quote:
Originally Posted by Youlean View Post
Simplest way to do this is using std::deque to construct buffer (use push back and pop front) and then use cairo_move_to, cairo_line_to and cairo_stroke or cairo_fill. Look at the documentation. https://www.cairographics.org/manual/cairo-Paths.html
Double ended queue is exactly what I was looking for - your plugin does a fantastic example of this Youlean, thanks for the help
CaptnWillie 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:16 PM.


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