2007-11-15 22:05:41 +00:00
|
|
|
//#include "openzap.h"
|
|
|
|
#include "libteletone_detect.h"
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
teletone_multi_tone_t mt = {0};
|
2008-09-06 05:46:14 +00:00
|
|
|
teletone_tone_map_t map = {{0}};
|
2007-11-15 22:05:41 +00:00
|
|
|
|
|
|
|
int fd, b;
|
|
|
|
short sln[512] = {0};
|
|
|
|
|
|
|
|
if (argc < 2) {
|
|
|
|
fprintf(stderr, "Arg Error!\n");
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
2007-11-17 01:39:28 +00:00
|
|
|
map.freqs[0] = atof("350");
|
|
|
|
map.freqs[1] = atof("440");
|
2007-11-15 22:05:41 +00:00
|
|
|
teletone_multi_tone_init(&mt, &map);
|
|
|
|
|
|
|
|
if ((fd = open(argv[1], O_RDONLY)) < 0) {
|
2008-09-06 05:46:14 +00:00
|
|
|
fprintf(stderr, "File Error! [%s]\n", strerror(errno));
|
2007-11-15 22:05:41 +00:00
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
while((b = read(fd, sln, 320)) > 0) {
|
|
|
|
printf("TEST %d %d\n", b, teletone_multi_tone_detect(&mt, sln, b / 2));
|
|
|
|
}
|
|
|
|
close(fd);
|
2008-09-06 05:46:14 +00:00
|
|
|
return 0;
|
2007-11-15 22:05:41 +00:00
|
|
|
}
|
|
|
|
|