AudioTransportSource assign to std::vectors


I know AudioTransportSource::getNextAudioBlock() but it assign buffer to const AudioSourceChannelInfo& . But I want to assign for example left channel buffer to std::vector<float> leftVector and right to std::vector<float> rightVector . And want to avoid assigning data to AudioSourceChannelInfo buffer.
How to make that?


To be clear. I just want to manipulate the data before it goes to the speaker. But when I call transportSource.getNextAudioBlock (bufferToFill); It already play the wave file untouched.
Maybe there is some simpler thing to do than assigning to independent vector?


std::vector is not compatible with Juce’s AudioBuffer and related classes anyway, so forget using those in this case. (You technically could use them but you would need to copy audio data around, which maybe isn’t what you want happening.)


So how to get data from source file, change them and then send to bufferToFill?


Of course I want make changes on data in the real time


I am not entirely sure what you asking but just fill the buffer with the audio source and then modify the data in the buffer?


But how to get those data? I am in the getNextAudioBlock want to get the buffer from source file , send it for example to some compressor or filter and then send them to the BufferToFill


But when I use transportSource.getNextAudioBlock (bufferToFill); it immediately send it to the speakers.


Obviously, if that’s the only code you have. Alter the buffer contents after the transportSource.getNextAudioBlock call to process the audio…


Not sure what you mean. Yes I have code for making compression.


It’s impossible to help without seeing more of the involved code.


My code is:
void MainComponent::getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill)
if (wAudioPlayer.readerSource.get() == nullptr)

wAudioPlayer.transportSource.getNextAudioBlock (bufferToFill);

if(makeCompression.compType !=0)



Code formatting problem sorry


That doesn’t unfortunately tell much. Is the setInputData call supposed to process the audio? What is that function’s signature?


Sorry, on the end, before last } there is more code:
for(int sample = bufferToFill.startSample; sample<bufferToFill.buffer->getNumSamples(); sample++)
float output;

    output = makeCompression.wOutput->at(sample);
    bufferToFill.buffer->addSample(0, sample, output);


OK, I’ve found out. I’ve just created my own AudioSourceChannelInfo. And it works. Thanks for patient