View Single Post
Old 04-08-2017, 06:05 PM   #1
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:

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:

    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