I have been experimenting with PulpCore for about a week or so and I am enjoying it very much but today I ran into a problem that I can't quite figure out.
Sound bgMusic = Sound.load("music/music.ogg");
Playback musicPlayback;
...
musicVolume = new Fixed(0.75);
musicPlayback = bgMusic.loop(musicVolume);
//TODO figure out why it's NOT looping when volume is animated
// musicVolume.animate(0, musicVolume.get(), FADE_IN_TIME);
This code, for as long as the last line is commented out, plays the music.ogg again and again in an endless loop (which I can stop by calling stop on the Playback object returned from loop(). However, I would like the music to fade in smoothly, so following the advice of the PulpCore API docs, I added the last line which will create the fade-in but the music will only play once and then stop. I wonder why is that? Here is a bit of the documentation:
Playback pulpcore.sound.Sound.loop(Fixed level)
Loops this sound clip with the specified volume level (0.0 to 1.0).
The level may have a property animation attached.
Parameters: level
Returns: a Playback object for this unique sound playback
(one Sound can have many simultaneous Playback objects)
or null if the sound could not be played.
So what could be the problem? I repeat, with the last line, the sound fades in but doesn't loop, without it it loops but starts with the specified 0.75 volume level.