Could ResamplingAudioSource inherit PositionableAudioSource


#1

Just as the title says, could the ResamplingAudioSource inherit PositionableAudioSource?

I use a ResamplingAudioSource as input to a BufferingAudioSource, but therefore I need it to be a PositionableAudioSource. The only thing needed would be to change setNextReadPosition, getNextReadPosition and getTotalLength to multiply with the ratio accordingly. I don’t see any drawbacks.

Now I will create a PositionableAudioSource which aggregates a ResamplingAudioSource, but that’s a step that could be saved…

Thanks for looking into it,
Daniel


#2

How about using an AudioTransportSource instead…?


#3

Sorry, I don’t understand, how this would help me. What I try to achieve is to resample data and feed it into a BufferingAudioSource. ThansportAudioSource is able to start and stop a stream, but it doesn’t resample. And I don’t even want the stream to be start- and stoppable.


#4

The AudioTransportSource can resample, it has a ResamplingAudioSource member.


#5

Thanks for letting me know. I wasn’t aware of these additional features of AudioTransportSource.

But for some reason I think it gives some overhead, I don’t want. But that’s probably just my preference.

I still think, that there is no point why the ResamplingAudioSource should not inherit PositionableAudioSource. It doesn’t even give any overhead during playback, only one multiplication, when cueing.


#6

Fair enough. i ended up using it instead of writing my own, so I cant really speak to the inheritance idea. I could only imagine there is more fiddling around with the different number of samples that the Positionable base class has to read, due to the resampling, which may or may not be easier to handle with a member instead of overriding…