From c64848b8ed70ae5931fb1cf12ef55088cc752a14 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 3 Oct 2014 10:31:26 +0200 Subject: New aiorecord/aioplay stub programs. --- src/aiorecord.cc | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 src/aiorecord.cc (limited to 'src/aiorecord.cc') diff --git a/src/aiorecord.cc b/src/aiorecord.cc new file mode 100644 index 0000000..4da5366 --- /dev/null +++ b/src/aiorecord.cc @@ -0,0 +1,135 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set et sw=2 ts=2: */ +/*************************************************************************** + * aiorecord.cc + * + * Fri Oct 3 09:58:45 CEST 2014 + * Copyright 2014 Bent Bisballe Nyeng + * deva@aasimon.org + ****************************************************************************/ + +/* + * This file is part of LibAudioIO. + * + * LibAudioIO 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. + * + * LibAudioIO 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 LibAudioIO; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "audioin.h" + +#include +#include +#include + +#include "device.h" +#include "mixer.h" + +static const char version_str[] = +"aiomixer v" VERSION "\n" +; + +static const char copyright_str[] = +"Copyright (C) 2014 Bent Bisballe Nyeng - Aasimon.org.\n" +"This is free software. You may redistribute copies of it under the terms of\n" +"the GNU Lesser General Public License " +".\n" +"There is NO WARRANTY, to the extent permitted by law.\n" +"\n" +"Written by Bent Bisballe Nyeng (deva@aasimon.org)\n" +; + +static const char usage_str[] = +"Usage: %s options\n" +"Options:\n" +" -L, --list List cards.\n" +" -d, --device s Set device to s (default 'default').\n" +" -c, --channels n Set number of channels to n (default 2).\n" +" -s, --samplerate n Set samplerate to n (default 48000).\n" +" -f, --file s Set output file to s (default '/dev/stdout').\n" +" -v, --version Print version information and exit.\n" +" -h, --help Print this message and exit.\n" +; + +int main(int argc, char *argv[]) +{ + std::string device = "default"; + std::string file = "/dev/stdout"; + int samplerate = 48000; + int channels = 2; + + int c; + int option_index = 0; + while(1) { + static struct option long_options[] = { + {"list", no_argument, 0, 'L'}, + {"device", required_argument, 0, 'd'}, + {"channels", required_argument, 0, 'c'}, + {"samplerate", required_argument, 0, 's'}, + {"file", required_argument, 0, 'f'}, + {"version", no_argument, 0, 'v'}, + {"help", no_argument, 0, 'h'}, + {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "hvLd:c:s:f:", + long_options, &option_index); + + if (c == -1) + break; + + switch(c) { + case 'L': + list = true; + break; + + case 'd': + device = optarg; + break; + + case 'c': + channels = atoi(optarg); + break; + + case 's': + samplerate = atoi(optarg); + break; + + case 'f': + file = optarg; + break; + + case '?': + case 'h': + printf("%s", version_str); + printf(usage_str, argv[0]); + return 0; + + case 'v': + printf("%s", version_str); + printf("%s", copyright_str); + return 0; + + default: + break; + } + } + + Device dev(device); + + Source *src = dev.getSource(device); + if(!src) { + printf("Could not find source device: %s\n", device.c_str()); + } + + return 0; +} -- cgit v1.2.3