This file is indexed.

/usr/include/jkAudIO.h is in tcl-snack-dev 2.2.10.20090623-dfsg-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
/* 
 * Copyright (C) 1997-2004 Kare Sjolander <kare@speech.kth.se>
 *
 * This file is part of the Snack Sound Toolkit.
 * The latest version can be found at http://www.speech.kth.se/snack/
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef _SNACK_AUDIO
#define _SNACK_AUDIO

#ifdef __cplusplus
extern "C" {
#endif

#ifndef CONST84
#   define CONST84
#endif

#ifdef HPUX
#  include <Alib.h>
#endif

#ifdef Solaris
#  include <sys/types.h>
#  include <sys/file.h>
#  include <sys/ioctl.h>
#  include <sys/fcntl.h>
#  include <stropts.h>
#  include <sys/errno.h>
#  include <sys/audioio.h>
#  include <errno.h>
#  include <sys/filio.h>
#endif

#ifdef WIN
#  include <windows.h>
#  include <mmsystem.h>
#  include <mmreg.h>
#  include <dsound.h>
# ifdef WAVEFORMATEXTENSIBLE
#  include <ks.h>
# endif
#endif

#ifdef IRIX
#  include <audio.h>
#endif

#if defined(MAC) || defined(OS_X_CORE_AUDIO)

/* We need to temporarily redefine several symbols used by an obsolete
 *  MacOS interface as they are also used by Snack */

#  define convertCmd convertCmd_MacOS
#  define soundCmd   soundCmd_MacOS
#  define flushCmd   flushCmd_MacOS
#  define volumeCmd  volumeCmd_MacOS
#  define pauseCmd   pauseCmd_MacOS

#if defined(OS_X_CORE_AUDIO)
#undef min
#undef max
#  include <CoreServices/CoreServices.h>
#  include <CoreAudio/AudioHardware.h>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#else
#  include <Sound.h>
#endif

#  undef convertCmd
#  undef soundCmd
#  undef flushCmd
#  undef volumeCmd
#  undef pauseCmd

#  ifndef rate44khz
#    define rate44khz ((unsigned long)(44100.0*65536))
#  endif /* !rate44khz */
/* How many buffers to maintain (2 is enough) */
#define NBUFS 2
/* The duration in seconds desired for each buffer */
/*#define DFLT_BUFTIME (0.0625) *//* i.e. frq/16, the favorite transfer size of the system */
#define DFLT_BUFTIME (0.25)	/* seems to work much better on the mac */
/* The number of SPBRecord calls to overlap.  I *think* this *has* to be zero */
#define INBUF_OVERLAP (0)

#endif /* MAC */

#ifdef ALSA
#include <alsa/asoundlib.h>
#endif

typedef struct ADesc {

#ifdef HPUX
  Audio    *audio;
  ATransID  transid;
  int       Socket;
  int       last;
  int       convert;
  double    time;
  int       freq;
#endif

#ifdef OSS
  int    afd;
  /*int    count;*/
  int    frag_size;
  double time;
  double timep;
  int    freq;
  int    convert;
  int    warm;
#endif

#ifdef ALSA
  snd_pcm_t *handle;
  int       freq;
  long      nWritten;
  long      nPlayed;
#endif

#ifdef Solaris
  int afd;
  audio_info_t ainfo;
  double time;
  double timep;
  int freq;
  int convert;
  short *convBuf;
  int convSize;
#endif

#ifdef WIN
  int curr;
  int freq;
  int shortRead;
  int convert;

  PCMWAVEFORMAT pcmwf;
  DSBUFFERDESC dsbdesc;
  DSCBUFFERDESC dscbdesc;
  LPDIRECTSOUNDBUFFER lplpDsb;
  LPDIRECTSOUNDCAPTUREBUFFER lplpDscb;
  PCMWAVEFORMAT pcmwfPB;
  DSBUFFERDESC dsbdescPB;
  LPDIRECTSOUNDBUFFER lplpDsPB;
  unsigned int BufPos;
  int BufLen;
  long written;
  long lastWritten;
#endif

#ifdef IRIX
  ALport   port;
  ALconfig config;
  unsigned long long startfn;
  int count;
#endif

#if defined(MAC)/* || defined(OS_X_CORE_AUDIO)*/
  /* Fields for handling output */
  SndChannelPtr schn;
  SndCommand	  scmd;
  SndDoubleBufferHeader2  dbh;
  SndDoubleBufferPtr	   bufs[NBUFS]; /* the two double buffers */
  int currentBuf;	/* our own track of which buf is current */
  int bufsIssued;	/* For record: how many bufs have been set going */
  int bufsCompleted;	/* For record: how many bufs have completed */
  int bufFull[NBUFS];
  long     bufFrames;	    /* number of frames allocated per buffer */
  int running;	/* flag as to whether we have started yet */
  int pause;    /* flag that we are paused (used on input only?) */
  /* data for the callbacks */
  void     *data;	    /* pointer to the base of the sampled data */
  long     totalFrames;   /* how many frames there are */
  long     doneFrames;    /* how many we have already copied */
  /* Fields for input */
  long inRefNum;	    /* MacOS reference to input channel */
  SPBPtr spb[NBUFS];	    /* ptr to the parameter blocks for recording */
  /* debug stats */
  int completedblocks;
  int underruns;
#endif /* MAC */

#ifdef OS_X_CORE_AUDIO
  AudioDeviceID	device;
  UInt32 deviceBufferSize;
  AudioStreamBasicDescription deviceFormat;
  int rpos, wpos;
  double time;
  int tot;
  int encoding;
#endif /* OS_X_CORE_AUDIO */

  int bytesPerSample;
  int nChannels;
  int mode;
  int debug;

} ADesc;

extern int SnackGetInputDevices(char **arr, int n);
extern int SnackGetOutputDevices(char **arr, int n);
extern int SnackGetMixerDevices(char **arr, int n);

extern void SnackAudioInit();
extern void SnackAudioFree();
extern int  SnackAudioOpen(ADesc *A, Tcl_Interp *interp, char *device,
			   int mode, int freq, int channels,
			   int encoding);
extern int  SnackAudioClose(ADesc *A);
extern long SnackAudioPause(ADesc *A);
extern void SnackAudioResume(ADesc *A);
extern void SnackAudioFlush(ADesc *A);
extern void SnackAudioPost(ADesc *A);
extern int  SnackAudioRead(ADesc *A, void *buf, int nSamples);
extern int  SnackAudioWrite(ADesc *A, void *buf, int nSamples);
extern int  SnackAudioReadable(ADesc *A);
extern long SnackAudioPlayed(ADesc *A);
extern int  SnackAudioWriteable(ADesc *A);

extern int SnackAudioGetEncodings(char *device);
extern void SnackAudioGetRates(char *device, char *buf, int n);
extern int SnackAudioMaxNumberChannels(char *device);
extern int SnackAudioMinNumberChannels(char *device);

extern void ASetRecGain(int gain);
extern void ASetPlayGain(int gain);
extern int  AGetRecGain();
extern int  AGetPlayGain();

extern void SnackMixerGetInputJackLabels(char *buf, int n);
extern void SnackMixerGetOutputJackLabels(char *buf, int n);
extern void SnackMixerGetInputJack(char *buf, int n);
extern int  SnackMixerSetInputJack(Tcl_Interp *interp, char *jack,
				   CONST84 char *status);
extern void SnackMixerGetOutputJack(char *buf, int n);
extern void SnackMixerSetOutputJack(char *jack, char *status);
extern void SnackMixerGetChannelLabels(char *mixer, char *buf, int n);
extern void SnackMixerGetVolume(char *mixer, int channel, char *buf, int n);
extern void SnackMixerSetVolume(char *mixer, int channel, int volume);
extern void SnackMixerGetLineLabels(char *buf, int n);
extern void SnackMixerLinkJacks(Tcl_Interp *interp, char *jack, Tcl_Obj *var);
extern void SnackMixerLinkVolume(Tcl_Interp *interp, char *mixer, int n,
			Tcl_Obj *CONST objv[]);
extern void SnackMixerUpdateVars(Tcl_Interp *interp);
extern int  SnackGetInDevices(char **arr, int n);
extern int  SnackGetOutDevices(char **arr, int n);

#define RECORD 1
#define PLAY   2

#define SNACK_MONO   1
#define SNACK_STEREO 2
#define SNACK_QUAD   4

#define LIN16        1
#define ALAW         2
#define MULAW        3
#define LIN8OFFSET   4
#define LIN8         5
#define LIN24        6
#define LIN32        7
#define SNACK_FLOAT  8
#define SNACK_DOUBLE 9
#define LIN24PACKED 10

#define CAPABLEN 100

/*#ifdef OSS
extern short Snack_Alaw2Lin(unsigned char a_val);
extern short Snack_Mulaw2Lin(unsigned char u_val);
extern unsigned char Snack_Lin2Alaw(short pcm_val);
extern unsigned char Snack_Lin2Mulaw(short pcm_val);
#endif*/
extern double SnackCurrentTime();

typedef struct MixerLink {
  char *mixer;
  char *mixerVar;
  char *jack;
  CONST84 char *jackVar;
  int channel;
} MixerLink;

#define VOLBUFSIZE 20
#define JACKBUFSIZE 40

extern char *SnackStrDup(const char *str);

#define QUERYBUFSIZE 1000
#define MAX_DEVICE_NAME_LENGTH 100
#define MAX_NUM_DEVICES 20

extern int strncasecmp(const char *s1, const char *s2, size_t n);

#ifdef __cplusplus
}
#endif

#endif /* _SNACK_AUDIO */