Change colour of fixation cross relative to audio

OS (e.g. Win10): macOS 14.4.1
PsychoPy version (e.g. 1.84.x): 2022.2.4 and 2024.1.5
Standard Standalone? (y/n) If not then what?: Yes
What are you trying to achieve?:

I have an experiment where I present participants with an audio file and then they make a response, so I’ve built these two routines within a loop (which repeats through 10 audio files). While each audio file is playing, a fixation cross will appear on the screen, but the colour of the fixation cross will change at different points of the audio file, and this is different for each audio file, so I’ve put all this information in a conditions file. For example, during audioFile_1, the fixation cross will turn orange at 8.5 seconds and then turn yellow at 11.3 seconds, but on the next loop for audioFile_2, the fixation cross will turn orange at 6 seconds and yellow at 9 seconds, and so on.

To accomplish this, I also created a text component for the fixation cross within the audio file routine and used a custom code component to make the the colour changes, see below:

Begin routine:

fixation_color = ‘black’
practice_clock = core.Clock()
sound_duration = practiceSound.getDuration()
print(‘Begin Routine: fixation_color initialized to black’)

Each frame:

current_time = practice_clock.getTime()
if first_time is not None and current_time >= first_time:
fixation_color = ‘orange’
if second_time is not None and current_time >= second_time:
fixation_color = ‘yellow’

Now this was working really well when used in v 2022.2.4 but when I updated to 2024.1.5 all the colour change timings were off and the change of colour lagged behind. Why is this?