Hi,
I have just started using SFML and it's a great resource. I have been searching for a solution to my problem but as of yet I haven't found one so I thought I would come here to see if anyone could help.
I'm developing an audio plugin that overrides the Soundstream and feeds the samples to my library before returning the average peak information, which my application can then display as a level meter (rising and falling based on the loudness of the current part of the audio). I have a global variable named levelValue which is set to the current peak after each return value from the library, and I set the rectangle outline thickness to this value. My thinking was that everytime I change the levelValue, then the thickness of the rectangle would change, allowing me to display a level meter.
However the rectangle doesn't update with the new value of levelValue unless I move my mouse/press buttons. This is my main GUI loop:
while (window.isOpen())
{
clock.restart();
sf::Event event;
while (window.pollEvent(event))
{
sf::Keyboard::P;
if (event.type == sf::Event::Closed)
{
window.close();
}if (window.waitEvent(event))
{
rectangle.setOutlineThickness(levelValue);
}
}
window.clear();
window.draw(rectangle);
window.display();
}
If anyone would be able to help me so that I can easily update my GUI every time the levelValue changes then that would be great. levelValue changes approx 43 times a second as I am calculating the average peak for 512 samples at a time. It may also be worth noting that I cannot update the rectangle from the area in which levelValue is set, as this is in a separate method, also a separate thread.
Thanks,
Mark.