/*---------------------------------------------------------------------------*\ FILE....: RECWAV.CPP TYPE....: C++ Console program AUTHOR..: David Rowe DATE....: 6/6/01 This program takes a line off hook and records a wave file. \*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*\ Voicetronix Voice Processing Board (VPB) Software Copyright (C) 1999-2001 Voicetronix www.voicetronix.com.au This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "../src/vpbapi.h" #include "../src/verbose.h" int arg_exists(int argc, char *argv[], char *arg); int main(int argc, char * argv[]) { int h; VPB_RECORD record; if (argc < 4) { printf("usage: %s WaveFile ChNum[1..4] Secs [--vpb4]\n", argv[0]); exit(0); } int bases_isa[] = {0x310}; int bases_pci[] = {0}; int arg; // which card if ((arg = arg_exists(argc, argv, "--vpb4")) != 0) { vpb_config(1, bases_isa, "/etc/vpb/vpbmain_pci.out", VPB_VPB4); } else { vpb_config(1, bases_pci, "/etc/vpb/vpbmain_pci.out", VPB_V4PCI); } record.term_digits = ""; record.time_out = atoi(argv[3])*1000; vpb_seterrormode(VPB_DEVELOPMENT); h = vpb_open(1,atoi(argv[2])); vpb_record_set(h, &record); vpb_sethook_sync(h, VPB_OFFHOOK); vpb_record_file_sync(h, argv[1], VPB_LINEAR); vpb_sethook_sync(h, VPB_ONHOOK); vpb_close(h); return 0; } int arg_exists(int argc, char *argv[], char *arg) { int i; for(i=0; i