Wassup JUCE Community,
I have a question regarding to drawing syncronized waveforms by bars into my GUI. Drawing the waveform of the current signal is no problem at all. I checked some LFO plugins and they display the waveform perfectly syncronized to the bar in strict time so I was wondering if anyone has an idea of how to implement it? I already implemented a Ring Buffer which is supposed to hold one quarter note lenths of the signal. I am pretty sure I have to calculate some kind of a factor of the CurrentPositionInfo. So i tried to calculate Samples per Bar but it does not really work and my bars also get inaccurate over time.
I reckoned, that a waveform would move too fast to give useful information if scrolling in realtime. I created this plot buffer instead, it collects blocks of audio and displays a min/max outline:
I never meant the audio to be scrolling in realtime. I was thinking about showing a static frame fitting to the bars of the DAW which updates, something like this:
Of couse it there is less rhymic information, it will look kind of weird. I like your outline buffer! In your Exampe, the ms Slider, I would like that to be calculated automatically by the DAW BPM that the current bar (4/4) always gets displayed in the window. Any ideas on how to implement it?
Well, I think it should be straight forward, you retrieve the BPM information from the host via AudioProcessor::getPlayHead(), and together with the sampleRate you should be able to figure out, how many samples you need to fit into your window…
Just make sure to use atomics, if you set variables in processBlock, that the drawing relies on…