I'm playing some music in python, I want the music to fade in.
//I have this function to fade it in
def FadeInMusic( speed,song ):
while( song.volume < 1):
song.volume += speed
musicHandle = FMOD.playSound( musicPath )
musicHandle.volume = 0
# Fade the song in at a given speed
t = Thread(target=FadeInMusic, args=(self.musicFadeSpeed,musicHandle,))
t.start()
This works sometimes and then sometimes it gives me a PySound error saying that it's an invalid handle to a PySound object
What could I do to make sure it's valid?