DAW transport to control audio file

Hi everybody, 

I'm new in this community and also in JUCE and C++, a completely newbie here! I've been doing Kontakt instruments for a few years (programming and scripting) and now I want to take another step, so I'm starting with JUCE.

I want to create an audio plugin that the only thing that does is stopping the sound of the track where it's inserted and play an audio file based on the position of the DAW. Maybe with a custom skinned knob to control the volume of the audio file. It will be a joke for the April Fools day, it seems like a good project to start since it's not too difficult and, since it's a one-day joke, it's not transcendent. 
Don't know where to start since there are a lot of information, what classes do I need to check out? Any help will be appreciated. 


If you start out with creating a standard plugin template, using the introjucer, it shouldn't be too hard. That will generate a working plugin out of the box, primarily consisting of an AudioProcessor and an Editor. Then you'll probably want to load the audiofile or stream it, perhaps using something like an AudioFormatReaderSource together with an ResamplingAudioSource (so your plugin can play at any samplerate).

Then, in your AudioProcessor::process() function (which is where the dsp part goes), you basically ignore the incoming samples - or turn them down a bit and add them to the output buffer, together with the output of your audio source. As for linking these two to the same place in time, use AudioProcessor::getPlayHead() to retrieve a block of info, that accuratively gives you the BPM and position in time, etc.

That should be the basics of the audio part - as for the graphics, either get some template shiny knob from somewhere, or make one in KnobMan. You can pretty easily make a modification to Slider such that it shows individual frames of a custom knob. If your editor is listening to this slider, you'll want to call Editor::getAudioProcessor()->setParameter(0 /* or whatever*/, slider.getValue()), and inside the audio processor, keep a float variable called volume, which will be set in this function. That should be just about it! 

Thank you very much, Mayae. This is a great community.

Hey, I found this old thread through a search - Did you get this plugin made? I'm new to JUCE and working on a plugin based on similar attributes (a combination of soundfile-playback mixed with the live track input). I've got the basics of playing a soundfile and running DSP on the incoming track signals, but I'm a bit lost with mixing the signals together for the output. I'd love to see examples or advice on where to start!

Do you just want to sum the audio signals? Because that is all there really is to it... You add each element of your signals together, and add them into the output buffer

[submitted the same message twice somehow, cant see a way to delete this one]

Yes, but I'm not sure of the correct way to go about doing this in a plugin format though. I already have the processBlock running the live audio stream (and any DSP on it) and putting the result back into the AudioSampleBuffer so presumably that's where I need to be combining the signal from a sound file playback? Yet all the audio examples I've seen use a route of AudioDeviceManager->AudioFormatReaderSource->AudioTransportSource->AudioSourcePlayer method (which I can execute fine in my audioProcessorEditor, from a GUI), but this just streams a soundfile and seems like it is making a second AudioDeviceManager and a second stream of audio (to what's already going on in the processBlock)? Thus I don't see how I connect the two and control / mix audio sources to the same output, which I guess I should be doing in the processBlock....


I feel like I must be missing a key part of this somewere? Thanks for the help!