# Adding VST effect to audioSources

**URL:** <https://forum.juce.com/t/adding-vst-effect-to-audiosources/33344>\
**Category:** General JUCE discussion\
**Created:** [May 11, 2019, 9:39pm UTC](https://forum.juce.com/t/adding-vst-effect-to-audiosources/33344 "2019-05-11T21:39:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gcass002](https://avatars.discourse-cdn.com/v4/letter/g/779978/32.png) [@gcass002](https://forum.juce.com/u/gcass002)\
**Post date:** [May 11, 2019, 9:39pm UTC](https://forum.juce.com/t/adding-vst-effect-to-audiosources/33344/1 "2019-05-11T21:39:26Z")

</div>

Hello GUYZ

I have been finished my application. I have used the AudioSources → AudioSourcePlayer → AudioDeviceManager pipeline. My Track class extend the audioSources and I do all the Audio stuff in the getNextAudioBlock() of each track, by handling the bufferToFill.

Considering this, now I want to add some VST effect to it and I see that everyone uses the AudioProcessor → AudioProcessorGraph → AudioProcessorPlayer → AudioDeviceManager paradigm…

Does this mean that all my work with AudioSources is wasted and I have to rethink my entire code ?

And if so, could you please me suggest me some threads or tutorial where it is well explained how to use the AudioProcessor paradigm ?

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [May 11, 2019, 10:17pm UTC](https://forum.juce.com/t/adding-vst-effect-to-audiosources/33344/2 "2019-05-11T22:17:43Z")

</div>

There is no problem adding an AudioProcessor into an AudioSource. The only thing you have to manage is to create an AudioBuffer, that refers to a subset of the buffer in AudioSourceChannelInfo (startSample and numSamples)

```auto
void getNextAudioBlock (const AudioSourceChannelInfo& info)
{
    // fill your buffer as normal

    AudioBuffer proxy (info.buffer->getArrayOfWritePointers(), 
                       info.buffer->getNumChannels(),
                       info.startSample,
                       info.numSamples);
    MidiBuffer midiDummy;

    if (!processor->isSuspended())
        processor->processBlock (proxy, midiDummy);
}

```

That’s simpler than using AudioProcessorGraph etc.  
Hope that helps…

---

<div class="post-metadata">

**Author:** ![gcass002](https://avatars.discourse-cdn.com/v4/letter/g/779978/32.png) [@gcass002](https://forum.juce.com/u/gcass002)\
**Post date:** [May 11, 2019, 10:36pm UTC](https://forum.juce.com/t/adding-vst-effect-to-audiosources/33344/3 "2019-05-11T22:36:34Z")

</div>

> [@daniel](#):
>
> processor-\>processBlock (proxy, midiDummy);

That sounds perfect,  
But I think I have another problem now :  
I want to do a master Track which process the audio outputs buffers after that all the tracks did their stuff to it ? Is there a way to say to the deviceManager to callback the Master’s processing function after all the others ?

Don’t know if I explained my self

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [May 11, 2019, 10:42pm UTC](https://forum.juce.com/t/adding-vst-effect-to-audiosources/33344/4 "2019-05-11T22:42:02Z")

</div>

Your AudioIODevice runs an AudioIODeviceCallback, which is maybe an AudioSourcePlayer (the AudioAppComponent has an AudioSourcePlayer and acts itself as AudioSource).

So you can put your master effects in there. You can even create a little AudioProcessingSource wrapper, inheriting from AudioSource and add the snippet above in the getNextAudioBlock and hook it between your AudioTransportSource -or whatever you use as final output- and the MixerAudioSource, that mixes your tracks, you get the gist…

---

<div class="post-metadata">

**Author:** ![gcass002](https://avatars.discourse-cdn.com/v4/letter/g/779978/32.png) [@gcass002](https://forum.juce.com/u/gcass002)\
**Post date:** [May 11, 2019, 10:50pm UTC](https://forum.juce.com/t/adding-vst-effect-to-audiosources/33344/5 "2019-05-11T22:50:58Z")

</div>

Yes I am using and AudioSourcePlayer, but I didn’t know it worked as an AudioSource, I seem to fit perfectly, tomorrow I am going to give it a try.  
I have already check and it has a AudioIOdeviceCallback and it seems where I am going to put my processor

Thanks as usual Daniel lifesaver.

P.S. About the Mixer Audio Source am going to look at it the future since a nice strategy
