#include <iostream>
        int ch; 
        int process(){
                if (inputAudio.rows()!=N || inputAudio.cols()!=ch){
                        inputAudio.resize(N, ch);
                        outputAudio.resize(N, ch);
                        inputAudio.setZero();
                }
                outputAudio=inputAudio; 
                return 0; 
        }
public:
        FullDuplexTest(
const char*devName, 
int latency) : 
FullDuplex(devName){
                ch=2; 
                N=latency;
                inputAudio.resize(0,0); 
                outputAudio.resize(0,0);
        }
};
int main(
int argc, 
char *argv[]) {
         int latency=2048;
        int fs=48000; 
        cout<<"latency = "<<(float)latency/(float)fs<<" s"<<endl;
        const char deviceName[]="hw:0";
        FullDuplexTest fullDuplex(deviceName, latency);
        cout<<"opened the device "<<fullDuplex.Playback::getDeviceName()<<endl;
        cout<<"channels max "<<fullDuplex.Playback::getMaxChannels()<<endl;
        
        int res=fullDuplex.resetParams();
        if (res<0)
                return res;
        snd_pcm_format_t format=SND_PCM_FORMAT_S32_LE;
        if ((res=fullDuplex.setFormat(format))<0)
                return res;
        res=fullDuplex.setAccess(SND_PCM_ACCESS_RW_INTERLEAVED);
        if (res<0)
                return res;
        if ((res=fullDuplex.setSampleRate(fs))<0)
                return res;
        res=fullDuplex.go(); 
}