How to set looping for AudioTransportSource


#1

Hi, I am working with AudioTransportSource to read audio files, and am wondering how to set this to loop the file playback. There is a method for the AudioTransportSource class isLooping() and it inherits from a class with a setLooping() method. However when I call transportSource.setLooping(true), it does not loop.

How can I get the AudioTransportSource to loop? I have been reading up on this and all the answers seem to point to using another class. This confuses me since having a method to return whether the source is looping is pointless unless the looping can be changed. Is there something I am misunderstanding here?


#2

AudioTransportSource is a wrapper around a PositionableSource, so it can be started and stopped. If the wrapped source doesn’t support looping, it will not loop.

If the source source (lol) supports looping, the flag is forwarded:

See the sources:

HTH


#3

Use AudioFormatReaderSource’s setLooping method.


#4

…or rather whatever source you set as source.

Just realised, that there is no setLooping available for the AudioTransportSource. That could be easily added setting the looping flag on the wrapped source.


#5

The source must be inherited from PositionableAudioSource.
Even AudioTransportSource accepts PositionableAudioSource as source to read from.

And AudioTransportSource is inherited from PositionableAudioSource.
and isLooping method is overridden and it uses the isLooping method of passed in source.