Ok, let’s make it easy…
I have my MyPosAudioSource (that works), an AudioTransportSource called transportSource and the AudioSourcePlayer called audioSourcePlayer. In the constructor of my class I do this:
where myPos is a pointer to an instance of MyPosAudioSource.
I do play audio, I can stop, play again, set the start position etc. Everything seems to be all right.
I have also an AudioDeviceSelectorComponent and I can choose other audio device. All good. I can play with my asio device as before.
BUT, if i try to open, with the selectorComponent, a number of channel not equals to 2 the info.buffer->getNumChannels() in the getNextAudioBlock(…) of myPos returns always 2.
I cannot play, stop anymore (I think becouse the source of the audioSourcePlayer is no more the transportSource) but (wow) the info.buffer->getNumChannels() in the getNextAudioBlock(…) of myPos returns the number of channels that I choose in the selectorComponent.
How can I combine transportSource and myPos to select the right channel number and control playing, stopping etc…???
So what you mean is that the audiotransportsource doesn’t seem to handle more than 2 channels?
Have you stepped through the getNextAudioBlock method to track down where this limitation is getting applied? Because it looks to me like it doesn’t affect the number of channels at all.
so, what I mean is this or maybe that MyPositionableAudioSource doesn’t inherit the information about the channel number from audiotransportsource.
But I don’t know, since i was not able to debug the getNextAudioBlock(…) of the AudioTransportSource and so I don’t know if it has a buffer with the rightr channel number.
Tell me, is right that i suppose MyPositionableAudioSource should inherit the number of channel from AudioTransportSource???
Or, maybe, there’ll be a better solution???
I debugged the getNextAudioBlock method in the AudioTransportSource class… and the info.buffer->getNumChannels() returns the right channel number…
So, I think the problem is that, i don’t know how, MyPos has to change the info.buffer channel number in order to do things right. It has to reflects the changes made in his “container” (i use container to mean that i did: transportSource->setSource(myPos);).
Yes Jules, forgive me for my english…
I mean the number of channels.
Now, I work debugging all the stuff and I find something strange:
Situation 1)
...
transportSource2.setSource ( myPos ,
32768, // tells it to buffer this many samples ahead
0);
...
the info.buffer->getNumChannels in the AudioTransportSource::getNextAudioBlock(…) returns the right number of channels. But info.buffer->getNumChannels in the MyPositionable::getNextAudioBlock(…) returns always 2.
What this all comes down to is that the bufferingaudiosource only buffers 2 channels of its input source.
It’s actually quite tricky to change this because it doesn’t know how many channels it needs until it’s actually playing, and it might start buffering before that. I’ll have to have a think about it…
I hope I was useful with this topic.
Jules, maybe this is not a great question but what’s the main difference using buffered or not-buffered source (like the 2 situation above)?
When I have to choose buffered or when it’s supposed to use not-buffered?
I’m a littel bit confused…