~ubuntu-branches/ubuntu/jaunty/nas/jaunty

« back to all changes in this revision

Viewing changes to server/dda/voxware/config.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve McIntyre
  • Date: 2004-06-23 01:15:02 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040623011502-30uqd1dyu47iv2dp
Tags: 1.6d-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* config.c - configuration setting and functions for this server 
2
2
 *
3
 
 * $Id: config.c,v 1.4 2001/04/29 22:47:47 jon Exp $
 
3
 * $Id: config.c,v 1.6 2002/07/12 04:44:16 jon Exp $
4
4
 *
5
5
 */
6
6
 
7
7
#include <fcntl.h>
8
 
#include "nasconfig.h"
 
8
#include "nasconf.h"
9
9
#include "config.h"
10
10
#include "aulog.h"
11
11
#include "../../dia/gram.h"
40
40
 
41
41
    case FORCERATE :
42
42
      num = (int) value;
43
 
                confStat->forceRate = num ;
 
43
      confStat->forceRate = num ;
 
44
      break;
 
45
 
 
46
    case GAIN :
 
47
      num = (int) value;
 
48
      /* the default is 50, so if it's just out of range, don't
 
49
         reset it */
 
50
      if (num < 0 || num > 100) 
 
51
        osLogMsg("config: Gain must be within the range 0-100, setting to 50\n");
 
52
      else
 
53
        confStat->gain = num ;
 
54
 
44
55
      break;
45
56
 
46
57
    case AUTOOPEN :
47
58
      num = (int) value;
48
 
                confStat->autoOpen = num;
 
59
      confStat->autoOpen = num;
49
60
      break;
50
61
 
51
62
    case READWRITE :
52
63
      num = (int) value;
53
 
                if (confStat == &sndStatIn) {
54
 
                        confStat->howToOpen = (num ? O_RDWR : O_RDONLY);
55
 
                }
56
 
                else {
57
 
                        confStat->howToOpen = (num ? O_RDWR : O_WRONLY);
58
 
                }
 
64
      if (confStat == &sndStatIn) {
 
65
        confStat->howToOpen = (num ? O_RDWR : O_RDONLY);
 
66
      }
 
67
      else {
 
68
        confStat->howToOpen = (num ? O_RDWR : O_WRONLY);
 
69
      }
59
70
      break;
60
71
 
61
72
    case MIXER:
66
77
 
67
78
    case DEVICE:
68
79
      str = (char *) value;
69
 
     
 
80
      
70
81
      confStat->device = str;
71
82
      if (!strcmp (str, "/dev/pcaudio") || !strcmp(str, "/dev/pcdsp"))
72
83
        confStat->isPCSpeaker = 1;
77
88
 
78
89
      if (num != 8 && num != 16) 
79
90
        {
80
 
          osLogMsg("*** Wordsize (%d) not 8 or 16, setting to 8\n", num);
 
91
          osLogMsg("config: Wordsize (%d) not 8 or 16, setting to 8\n", num);
81
92
          confStat->wordSize = 8;
82
93
        }
83
94
      else
99
110
          j >>= 1;
100
111
        }
101
112
        if (k != 1) {
102
 
          osLogMsg("*** Fragment size should be a power of two - setting to 256\n");
 
113
          osLogMsg("config: Fragment size should be a power of two - setting to 256\n");
103
114
          confStat->fragSize = 256;
104
115
        }
105
116
        else
106
117
          confStat->fragSize = num;
107
118
        if (NasConfig.DoDebug)
108
 
          osLogMsg("Fragsize set to %d\n", confStat->fragSize);
 
119
          osLogMsg("config: Fragsize set to %d\n", confStat->fragSize);
109
120
      }
110
121
      break;
111
122
 
114
125
 
115
126
      if (num < 2 || num > 32) 
116
127
        {
117
 
          osLogMsg("*** Minfrags out of range - setting to 2\n");
 
128
          osLogMsg("config: Minfrags out of range - setting to 2\n");
118
129
          confStat->minFrags = 2;
119
130
        }
120
131
      else
121
132
        confStat->minFrags = num;
122
133
 
123
134
      if (NasConfig.DoDebug)
124
 
        osLogMsg("+++ Minfrags set to %d\n", confStat->minFrags);
 
135
        osLogMsg("config: Minfrags set to %d\n", confStat->minFrags);
125
136
      break;
126
137
 
127
138
    case MAXFRAGS:
129
140
 
130
141
      if (num < 2 || num > 32) 
131
142
        {
132
 
          osLogMsg("*** Maxfrags out of range - setting to 32\n");
 
143
          osLogMsg("config: Maxfrags out of range - setting to 32\n");
133
144
          confStat->maxFrags = 32;
134
145
        }
135
146
      else
136
147
        confStat->maxFrags = num;
137
148
 
138
149
      if (NasConfig.DoDebug)
139
 
        osLogMsg("+++ Maxfrags set to %d\n", confStat->maxFrags);
 
150
        osLogMsg("config: Maxfrags set to %d\n", confStat->maxFrags);
140
151
      break;
141
152
 
142
153
    case NUMCHANS:
144
155
 
145
156
      if (num != 1 && num != 2) 
146
157
        {
147
 
          osLogMsg("*** Number of channels wrong, setting to 1\n");
 
158
          osLogMsg("config: Number of channels wrong, setting to 1\n");
148
159
          confStat->isStereo = 0;
149
160
        }
150
161
      else
171
182
 
172
183
    default:                    /* ignore any other tokens */
173
184
      if (NasConfig.DoDebug > 5)
174
 
        osLogMsg("ddaSetConfig() : unknown token %d, ignored\n", token);
 
185
        osLogMsg("config: ddaSetConfig() : unknown token %d, ignored\n", token);
175
186
 
176
187
      break;
177
188
    }