'How do I loop over section of audio in audiokit

How do I go about looping over a section of audio? For example, I'd like to loop from, say 7.3 seconds into a song to 10.5 seconds into it over and over indefinitely until I programmatically turn the looping off so the audio can continue past the 10.5 mark.

I have audio players working and playing audio just fine. I've got one audio player playing pitched instruments synced with another one playing drums only. So in my class:

var audioPlayerPitched: AudioPlayer
var audioPlayerNonPitched: AudioPlayer

and after initialization I load the song files up into buffers.

I'll need them both to loop over and over in perfect sync. Is this possible? A code snippet pointing the way would be greatly appreciated.




This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source