Hi all!,
I was writing a little about it in General Section, but i think the main theme of the topic is not the same.
Well, i'm working in a Software for a Loop Pedal. I'm starting with the code, so i'm just trying to do one loop works. So, the idea is record the loop and when i stop record then play the sound recorded. i made this code:
if(Event.key.code == sf::Keyboard::R){
recorder.start();
std::cout<<"> Recording Loop"<<std::endl;
}
else if(Event.key.code == sf::Keyboard::S){
recorder.stop();
clock.restart();
std::cout<<"> Playing Loop"<<std::endl;
buffer = recorder.getBuffer();
sound.setBuffer(buffer);
std::cout<<"> Delay Between Record and Play: "<<clock.getElapsedTime().asMicroseconds()<<std::endl;
sound.play();
}
But i need those both actions start at the same time, i mean RECORD.STOP and SOUND.PLAY start together, because later i need to record another sound while im listening the first one and it doesnt have to exist delay. I print the delay between Record.stop and sound.play as MicroSeconds and i got this:
So i have 1570 microseconds between record.stop and sound play. What can i do to get 0 second of Delay (or close)?.
I think if i put sound.play straight after record.stop it would works, but it couldnt be possible cause there are buffer = recorder.getbuffer() and sound.setbuffer() functions :/. Is there any way to avoid it?
Thanks to all!.