source: roaraudio/roarclients/roarphone.c @ 2127:85fca7cf35bb

Last change on this file since 2127:85fca7cf35bb was 2127:85fca7cf35bb, checked in by phi, 15 years ago

added --driver and --device

File size: 2.8 KB
Line 
1//roarbidir.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008
5 *
6 *  This file is part of roarclients a part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  RoarAudio is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU General Public License for more details.
18 *
19 *  You should have received a copy of the GNU General Public License
20 *  along with this software; see the file COPYING.  If not, write to
21 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 */
24
25#include <roaraudio.h>
26#include "driver.h"
27
28#define BUFSIZE 1024
29
30#define DRIVER  "oss"
31
32void usage (void) {
33 printf("roarcat [OPTIONS]...\n");
34
35 printf("\nOptions:\n\n");
36
37 printf("  --server SERVER    - Set server hostname\n"
38        "  --rate   RATE      - Set sample rate\n"
39        "  --bits   BITS      - Set bits per sample\n"
40        "  --chans  CHANNELS  - Set number of channels\n"
41        "  --codec  CODEC     - Set the codec\n"
42        "  --driver DRIVER    - Set the driver\n"
43        "  --device DEVICE    - Set the device\n"
44        "  --help             - Show this help\n"
45       );
46
47}
48
49int main (int argc, char * argv[]) {
50 struct roar_audio_info info = {.rate     = ROAR_RATE_DEFAULT,
51                                .bits     = ROAR_BITS_DEFAULT,
52                                .channels = ROAR_CHANNELS_DEFAULT,
53                                .codec    = ROAR_CODEC_DEFAULT
54                               };
55 struct roar_vio_calls dvio;
56 char * driver   = DRIVER;
57 char * device   = NULL;
58 char * server   = NULL;
59 char * k;
60 int    i;
61
62 for (i = 1; i < argc; i++) {
63  k = argv[i];
64
65  if ( strcmp(k, "--server") == 0 ) {
66   server = argv[++i];
67  } else if ( strcmp(k, "--rate") == 0 ) {
68   info.rate = atoi(argv[++i]);
69  } else if ( strcmp(k, "--bits") == 0 ) {
70   info.bits = atoi(argv[++i]);
71  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) {
72   info.channels = atoi(argv[++i]);
73  } else if ( strcmp(k, "--codec") == 0 ) {
74   info.codec = roar_str2codec(argv[++i]);
75  } else if ( strcmp(k, "--driver") == 0 ) {
76   driver = argv[++i];
77  } else if ( strcmp(k, "--device") == 0 ) {
78   device = argv[++i];
79  } else if ( strcmp(k, "--help") == 0 ) {
80   usage();
81   return 0;
82  } else {
83   fprintf(stderr, "Error: unknown argument: %s\n", k);
84   usage();
85   return 1;
86  }
87 }
88
89 if ( roar_cdriver_open(&dvio, driver, device, &info, ROAR_DIR_BIDIR) == -1 ) {
90  return 1;
91 }
92
93 roar_vio_close(&dvio);
94
95 return 0;
96}
97
98//ll
Note: See TracBrowser for help on using the repository browser.