hi.
If i want to do several playback via audioRequested at a same time, what do i do?
For multiple playback, first, i made a class for recording&playback
and when i’ve built it, i could hear only the last track.
all other tracks are not played. i don’t know why they aren’t played.
I’d appreciate your help.
codes in testApp is here;
void testApp::audioRequested(float * output, int bufferSize, int nChannels){
for(int i=0;i<NUM_TRACK;i++){
output=tracks[i].play(output,bufferSize,nChannels);
}
}
and codes in tracks class is here;
float* play(float* output_, int bufferSize_, int nChannels_){
//checking for mode
if (mode == 2&&recPos!=xp) {
//buffer array to output buffer
for (int i = 0; i < bufferSize_*nChannels_; i++) {
//checking current playPos
if(playPos<EndTime){
//buffer array to output buffer
output_[i] = buffer[int(playPos)] * audioLevel;
//playPos update with play speed that decided by finger
playPos +=playSpeed;
}
else{
//when playPos has overed EndTime , go back(Loop)
playPos = xp;
}
}
......
omitted
......
return output_;