Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Making DUI visualizer plugin: best way to fetch sample data + repaint? (Read 1974 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Making DUI visualizer plugin: best way to fetch sample data + repaint?

I'm trying to develop a visualizer (a simple peak and RMS meter) component for the default UI. I used foo_sample as a starting point and removed all unnecessary source files from the project, so I kept main.cpp, PCH.cpp (dummy) and ui_element.cpp. Now I wonder what's the best approach to fetch the sample data at a regular interval and repaint the UI element's contents.

I found out that I can use Invalidate() to force a repaint and that on_playback_time() is called every second. For a visualizer that would be too slow, so I used SetTimer() and KillTimer() in combination with OnTimer() to get a smaller interval. But I'm sure there are better ways.

To retrieve the sample data I used visualisation_stream_v3 with get_absolute_time() and get_chunk_absolute() but I noticed that the video was ahead of the audio, just like I noticed with VST plug-ins before.