Hello,
i followed this tutorial
https://www.sfml-dev.org/tutorials/2.4/audio-recording.php to capture a sample then play it, here is the code:
#include <iostream>
#include <string>
#include <chrono>
#include <SFML/Audio.hpp>
#include <SFML/Audio/SoundBuffer.hpp>
#include <SFML/Audio/SoundBufferRecorder.hpp>
#include <SFML/Audio/Sound.hpp>
unsigned long int a=1,b=0;
int main(){
if (!sf::SoundBufferRecorder::isAvailable()){std::cout<<"ERROR NO DEVICE FOUND";}
sf::SoundBufferRecorder recorder;
recorder.start();
while(a){
++b;
if(b>2000000000){
--a;}}
recorder.stop();
const sf::SoundBuffer& buffer = recorder.getBuffer();
std::cout<<"PROGRAM SUCCESSFUL"<<std::endl;
sf::Sound sound;
sound.setBuffer(buffer);
sound.play();
return 0;}
It is supposed recording a sample then play it but all what i get is PROGRAM SUCCESSFUL after time of the loop, i followed exactly all that tuto and have required devices (microphone and speakers), could someone help me to correct my mistakes ?