diff --git a/src/Makefile b/src/Makefile index 5a43cf5..f8bd6b4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,6 +1,6 @@ SRC = irmc.c cwprotocol.c OBJ = ${SRC:.c=.o} -LDFLAGS = -L/usr/local/lib -L/opt/local/lib -lportaudio -lm -lmorse +LDFLAGS = -L/usr/local/lib -L/opt/local/lib -lportaudio -lpthread -lm -lmorse CFLAGS = -I/usr/local/include -I/opt/local/include -Wall INSTALLDIR = ${HOME}/bin diff --git a/src/beep.h b/src/beep.h index ed4cb52..433f442 100644 --- a/src/beep.h +++ b/src/beep.h @@ -104,8 +104,10 @@ static void StreamFinished( void* userData ) } /*******************************************************************/ -int main(void); -int main(void) + +void beep_init(void); + +int beep(double freq_hz, double duration_sec) { PaStreamParameters outputParameters; PaStream *stream; @@ -155,7 +157,7 @@ int main(void) if( err != paNoError ) goto error; printf("Play for %d seconds.\n", NUM_SECONDS ); - Pa_Sleep( NUM_SECONDS * 1000 ); + Pa_Sleep( duration_sec * 1000 ); err = Pa_StopStream( stream ); if( err != paNoError ) goto error; diff --git a/src/irmc.c b/src/irmc.c index fe70660..ab3099d 100644 --- a/src/irmc.c +++ b/src/irmc.c @@ -12,6 +12,7 @@ #include #include #include +#include #ifdef BEEP_MORSE #include #else @@ -34,11 +35,11 @@ #include #endif -#ifndef BEEP_MORSE +#ifndef BEEP_MORSE // does not help!! #include "beep.h" #endif -#define DEBUG 0 +#define DEBUG 1 #define MAXDATASIZE 1024 // max number of bytes we can get at once @@ -353,8 +354,7 @@ int main(int argc, char *argv[]) break; } - - fcntl(fd_socket, F_SETFL, O_NONBLOCK); + fcntl(fd_socket, F_SETFL, O_NONBLOCK); if (p == NULL) { fprintf(stderr, "Failed to connect.\n"); return 2;