6 int main(
int argc,
char * argv[])
14 if(argc < 2) exit(-1);
15 if(argv[1][0] ==
'a') {
18 if(argv[1][0] ==
'p') {
25 #define CAPSAMPS (48 * 1000 * 5) 29 float anginc = 2.0 * 3.14159 * 240.0 / 48000.0;
33 for(i = 0; i < 4; i++) {
34 ai[i] = anginc * ((float) (i + 1));
40 for(k = 0; k < 16; k++) {
43 std::cerr <<
"Gain set to " << again << std::endl;
45 for(j = 0; j < 48; j++) {
46 for(i = 0; i < 1000; i++) {
47 buf[i] = 0.5 * sin(ang);
50 if(ang > M_PI) ang -= (2.0 * M_PI);
55 audioI->
send(buf, 1000);
62 std::cerr <<
"Wow! the recv buffer isn't ready...." << std::endl;
70 std::cerr <<
"Wow! the send buffer isn't ready...." << std::endl;
virtual void sleepIn()=0
stop the input stream so that we don't encounter a buffer overflow while the transmitter is inactive...
virtual bool setOutGain(float gain)
set the gain for the output device.
virtual int send(void *buf, unsigned int len)=0
send – send a buffer to the audio output
the PortAudio interface class
virtual int recv(void *buf, unsigned int len, bool block=true)=0
recv – get a buffer of data from the audio input
virtual bool recvBufferReady(unsigned int len)=0
recvBufferReady – is there enough space in the audio device recv buffer for a call from recv...
virtual bool sendBufferReady(unsigned int len)=0
sendBufferReady – is there enough space in the audio device send buffer for a call from send...
ALSA audio interface class.
Generic Audio Interface Class.
int main(int argc, char *argv[])
virtual void wakeIn()=0
start the input stream