Hi all,
I’ve just started exploring Juce’s capabilities beyond simple buttons + sliders, and recently I’ve been trying to make a DrawableButton blink using setBackgroundColours. I’m using juce with portaudio, but I don’t think my simple audio streams are related to my trouble here.
Below is part of my button handling code - basically, I want to play a beep twice (Pa_StartStream( stream ) plays a 500 ms beep) while flashing a DrawableButton (leftBlinker) in sync with the beeps.
leftBlinker->setBackgroundColours (Colours::yellow, Colours::yellow);
Pa_StartStream( stream );
sleep(500);
Pa_StopStream( stream );
leftBlinker->setBackgroundColours (Colours::slategrey, Colours::slategrey);
sleep(100);
leftBlinker->setBackgroundColours (Colours::yellow, Colours::yellow);
Pa_StartStream( stream );
sleep(500);
Pa_StopStream( stream );
leftBlinker->setBackgroundColours (Colours::slategrey, Colours::slategrey);
Is there a better way to do simple animations like this in Juce? It seems like what I’m doing must be wrong. If I simplify the code to a single color change (below), the button doesn’t turn yellow until after the beep has played:
leftBlinker->setBackgroundColours (Colours::yellow, Colours::yellow);
Pa_StartStream( stream );
sleep(500);
Pa_StopStream( stream );
Thanks,
Ben