/usr/include/SndObj/SndRTIO.h is in libsndobj-dev 2.6.7+ds1-1.
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 |
////////////////////////////////////////////////////////////////////////
// This file is part of the SndObj library
//
// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Copyright (c)Victor Lazzarini, 1997-2004
// See License.txt for a disclaimer of all warranties
// and licensing information
///////////////////////////////////////////////////
// SndRTIO.h: interface of the SndRTIO class
// realtime audio IO
// currently supported on Irix, Linux (with OSS), MAC OSX (CoreAudio)
// and Windows
//
#ifndef _SNDRTIO_H
#define _SNDRTIO_H
#ifndef NO_RTIO
#include "SndIO.h"
#ifdef MACOSX // Mac CoreAudio
#include <CoreAudio.h>
#include "SndCoreAudio.h"
#endif
#ifdef OSS // Open Sound System (Linux, etc...)
#include <sys/ioctl.h>
#include <sys/soundcard.h>
#include <fcntl.h>
typedef int AudioDeviceID;
#define DEF_DEV "/dev/dsp"
const int DEF_BSIZE = 512;
const int DEF_PERIOD = 512;
#endif
#ifdef ALSA
#include <alsa/asoundlib.h>
typedef snd_pcm_t * AudioDeviceID;
#define DEF_DEV "plughw:0,0"
const int DEF_BSIZE = 1024;
const int DEF_PERIOD = 2;
#endif
#ifdef SGI // SGI on Irix
#include <audio.h>
const int AL_DEFAULT = AL_DEFAULT_OUTPUT;
typedef int AudioDeviceID;
const int DEF_DEV = AL_DEFAULT;
const int DEF_BSIZE = 512;
const int DEF_PERIOD = 512;
#endif
#ifdef WIN // Windows MME
#include <Windows.h>
#include <Mmsystem.h>
typedef int AudioDeviceID;
void ListDevices();
char* InputDeviceName(int dev, char* name);
char* OutputDeviceName(int dev, char* name);
const int DEF_DEV = WAVE_MAPPER;
const int DEF_BSIZE = 1024;
const int DEF_PERIOD = 4;
#endif
#ifdef MACOSX
class SndRTIO : public SndCoreAudio {
#else
class SndRTIO : public SndIO {
protected:
char* m_cp;
short* m_sp; // pointers to the buffer
int m_count; // counter
int m_buffsize; // buffer size
int m_items; // items
int m_encoding; // encoding
AudioDeviceID m_dev; // device ID
int m_mode;
#endif
#if defined (SGI) || defined (OSS) || defined (ALSA)
void* m_buffer; // IO buffer
#endif // SGI or OSS or ALSA
#ifdef WIN
WAVEFORMATEX* m_wfx; // formatex structure
WAVEHDR** m_pwhdr; // header structures, one for each data block
HGLOBAL* m_hwhdr; // header strructures handles
HANDLE* m_hData; // data blocks handles
void** m_buffer; // buffers (data blocks)
int m_buffno; // number of buffers
int m_ndx; // buffer index
HWAVEOUT m_hwo; // output device handle
HWAVEIN m_hwi; // output device handle
int m_cur;
int m_status;
bool m_firsttime;
#endif
#ifdef SGI
long* m_lp; // long & float pointers
float* m_fp; // supported only on Irix
ALconfig m_config; // Audio Library config
ALport m_port; // AL IO port
void Writef(); // write functions for different sample formats;
void Writel();
void Readf(); // read functions for different sample formats
void Readl();
#endif
#ifdef ALSA
long* m_lp;
void Writel();
void Readl();
#endif
#ifndef MACOSX
void Writec(); // write functions for different sample formats;
void Writes();
void Reads(); // read functions
void Readc();
void SndRTIO_init(short, int, int=DEF_BSIZE, int=DEF_PERIOD,int=SHORTSAM,
SndObj** =0,int=DEF_VECSIZE, float=DEF_SR,
#if defined (OSS) || defined (ALSA)
char* = (char *)DEF_DEV);
#else
AudioDeviceID=DEF_DEV);
#endif
#endif // MACOSX
public:
SndRTIO(short ch, int mode, int bsize = DEF_BSIZE,
int period = DEF_PERIOD, int encoding = SHORTSAM,
SndObj** input=0, int vsize= DEF_VECSIZE, float sr=DEF_SR,
#if defined(OSS) || defined(ALSA)
char* dev = (char *)DEF_DEV)
#else
int dev = DEF_DEV)
#endif
#ifndef MACOSX
: SndIO(ch, encoding*8,input,vsize, sr)
{
SndRTIO_init(ch,mode,bsize,period,encoding,input,vsize,sr,dev);
}
#else
: SndCoreAudio((ch < 2 ? 2 : ch), bsize,
period, 32768.0,input, dev, vsize, sr) { };
#endif
SndRTIO()
#ifndef MACOSX
: SndIO(1,16,0,DEF_VECSIZE,DEF_SR){ SndRTIO_init(1, SND_OUTPUT); }
#else
: SndCoreAudio() { };
#endif
SndRTIO(short channels, SndObj** input=0)
#ifndef MACOSX
: SndIO(channels,16,input,DEF_VECSIZE,DEF_SR)
{
SndRTIO_init(channels,SND_OUTPUT,DEF_BSIZE,DEF_PERIOD,SHORTSAM,input);
}
#else
: SndCoreAudio((channels < 2 ? 2 : channels),DEF_BSIZE, DEF_PERIOD,
32768.0,input) { };
#endif
SndRTIO(SndObj *p)
#ifndef MACOSX
: SndIO(1,16,0,DEF_VECSIZE,DEF_SR)
{
SndRTIO_init(1, SND_OUTPUT);
SetOutput(1, p);
}
#else
: SndCoreAudio(){
SetOutput(1, p);
SetOutput(2, p);
}
#endif
SndRTIO(SndObj *pl, SndObj *pr)
#ifndef MACOSX
: SndIO(2,16,0,DEF_VECSIZE,DEF_SR)
{
SndRTIO_init(2, SND_OUTPUT);
SetOutput(1, pl);
SetOutput(2, pr);
}
#else
: SndCoreAudio(){
SetOutput(1, pl);
SetOutput(2, pr);
}
#endif
#ifndef MACOSX
~SndRTIO();
short Write();
short Read();
char* ErrorMessage();
#endif
};
#endif /* ifndef NO_RTIO */
#endif
|