How to use getNextAudioBlock method


#1

Hi all,

Please help me to explain more detail about getNextAudioBlock method and how to use it. I read so many code but still don't understand clearly this method. Please help me, thanks in advance!


#2

Hmm...You are not really supposed to "use" it yourself, in most cases. Juce calls/"uses" it FOR you. What you must do is implement that method in a subclass. What are you trying to do?


#3

Hi Xenakios,

Thanks for your reply. Sorry about my unclear question. I read implement of getNextAudioBlock method in "white noise generator" and "playing sound files" demo but still don't understand how to implement and how to use  AudioSourceChannelInfo parameter in that method. Can you tell me that method often be used for which purposes. Sorry for my poor English. Looking forward to your reply!


#4

I am not sure if anyone here can explain things better with less text than those tutorials already do...Audio software programming with something like C++ just tends to be complicated! 

Do you already have a pretty good grasp of C++ programming? Is there some really particular thing you don't understand that the tutorials texts maybe skip over? 

What is your desired end result? What have you already tried to achieve that? If it didn't work, what did you get instead?


#5

With no guarantee of course....
The audio signal flows from its audio source to the standard audio output, under control of  JUCE-Audio-thread.
The function getNext AudioBlock() is called internally by the JUCE-Audio-thread, in order to make available the signal to you, if you want to apply any DSP on it.

Actually, this function acts as a *window* to you, for each part of the signal.
The AudioSourceChannelInfo structure, contains all you need for any your process (current part of audio signal, number of samples contained in the buffer...)


I hope it helped you to figure out a more clear view for this issue.