root/src/detect_tones.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. main

   1 //#include "freetdm.h"
   2 #include "libteletone_detect.h"
   3 
   4 int main(int argc, char *argv[])
   5 {
   6         teletone_multi_tone_t mt = {0};
   7         teletone_tone_map_t map = {{0}};
   8 
   9         int fd, b;
  10         short sln[512] = {0};
  11 
  12         if (argc < 2) {
  13                 fprintf(stderr, "Arg Error!\n");
  14                 exit(-1);
  15         }
  16 
  17         map.freqs[0] = atof("350");
  18         map.freqs[1] = atof("440");
  19         teletone_multi_tone_init(&mt, &map);
  20 
  21         if ((fd = open(argv[1], O_RDONLY)) < 0) {
  22                 fprintf(stderr, "File Error! [%s]\n", strerror(errno));
  23                 exit(-1);
  24         }
  25 
  26         while((b = read(fd, sln, 320)) > 0) {
  27                 printf("TEST %d %d\n", b, teletone_multi_tone_detect(&mt, sln, b / 2));
  28         }
  29         close(fd);
  30         return 0;
  31 }
  32 

/* [<][>][^][v][top][bottom][index][help] */