AudioSampleBuffer connection to audio output?


#1


Hello Friends!
I have this issue: I want to pass the audio thru the buffer, but it doesnt do anything at the audio output (the gain doesnt change from 1 to 0.25). I've checked with the console that the audio passes thru the buffer:     
  

std::cout<<buffer_salida.getRMSLevel(0, 0, 1024);

I put here my code:

​
    formatManager.registerBasicFormats();
    sourcePlayer.setSource (&transportSource);
    deviceManager.addAudioCallback (&sourcePlayer);
    deviceManager.initialise (2, 2, nullptr, true);

    AudioDeviceManager::AudioDeviceSetup setup;
    setup.sampleRate = 44100.0;
    setup.bufferSize = 1024.0;
    setup.inputChannels = 2;
    setup.outputChannels = 2;

    deviceManager.addChangeListener (this);
    transportSource.addChangeListener (this);
   
    state = Stopped;

    transportSource.setSource (nullptr);
    File startup (String("/Applications/Auding.app/Contents/MacOS/etc/startup.mp3"));
    readerSource = new
    AudioFormatReaderSource(formatManager.createReaderFor (startup), true);
    transportSource.setSource (readerSource);
    transportSource.setPosition (0.0);
    changeState (Starting);
    transportSource.setGain(1);

    // AUDIO BUFFER
    AudioSampleBuffer buffer_salida (2, 1024);
    AudioSourceChannelInfo info;
    info.buffer = &buffer_salida;
    info.startSample = 0;
    info.numSamples = buffer_salida.getNumSamples();
    transportSource.getNextAudioBlock(info);
    buffer_salida.applyGain(0.25);

How can I connect the buffer to the audio output?

Thanks in advance!