Use the local OSS headers

This commit is contained in:
dhewg 2011-12-08 01:53:34 +01:00
parent 1b8777a008
commit 82aaccc1ad
7 changed files with 2 additions and 2261 deletions

View file

@ -1,310 +0,0 @@
#ifndef AUDIO_CORE_H
#define AUDIO_CORE_H
/*
* Copyright by 4Front Technologies 1993-2004
*
* All rights reserved.
*/
/*
* IMPORTANT NOTICE!
*
* This file contains internal structures used by Open Sound Systems.
* They will change without any notice between OSS versions. Care must be taken
* to make sure any software using this header gets properly re-compiled before
* use.
*
* 4Front Technologies (or anybody else) takes no responsibility of damages
* caused by use of this file.
*/
/* Max number of audio channels currently supported */
#define OSS_MAX_AUDIO_CHANNELS 8
struct audio_operations;
typedef struct
{
int fmt, speed, channels;
int convert;
}
sample_parms;
typedef struct audio_operations audio_operations, adev_t, *adev_p;
typedef struct dma_buffparms dma_buffparms, *dmap_p;
typedef int (*cnv_func_t) (adev_p adev, dmap_p dmap, void **srcp, int *srcl,
void **tgtp, sample_parms * source,
sample_parms * target);
struct dma_buffparms
{
/*
* Static fields (not to be cleared during open)
*/
#ifndef CONFIGURE_C
oss_mutex mutex;
#endif
sound_os_info *osp;
char *raw_buf;
oss_native_ulong raw_buf_phys;
int buffsize;
unsigned char *tmpbuf1, *tmpbuf2;
int dma; /* DMA channel */
void *driver_use_ptr;
long driver_use_value;
/* Interrupt callback stuff */
void (*audio_callback) (int dev, int parm);
int callback_parm;
#ifdef OS_DMA_PARMS
OS_DMA_PARMS
#endif
/*
* Dynamic fields (will be zeroed during open)
* Don't add anything before flags.
*/
void *srcstate[OSS_MAX_AUDIO_CHANNELS];
oss_native_ulong flags;
#define DMAP_NOTIMEOUT 0x00000001
#define DMAP_POST 0x00000002
#define DMAP_PREPARED 0x00000004
#define DMAP_FRAGFIXED 0x00000008 /* Fragment size fixed */
#define DMAP_STARTED 0x00000010
#define DMAP_COOKED 0x00000020
#define DMAP_ACTIVE 0x00000040 /* ISA DMA is running */
int dma_mode; /* DMODE_INPUT, DMODE_OUTPUT or DMODE_NONE */
#define DMODE_NONE 0
#define DMODE_OUTPUT PCM_ENABLE_OUTPUT
#define DMODE_INPUT PCM_ENABLE_INPUT
/*
* Queue parameters.
*/
int nbufs;
int frag_used;
int fragment_size;
int bytes_in_use;
int data_rate; /* Bytes/second */
int frame_size;
int fragsize_rq;
int low_water;
volatile oss_native_ulonglong byte_counter;
volatile oss_native_ulonglong user_counter;
int write_count;
int interrupt_count;
int fragment_counter;
int expand_factor;
int mapping_flags;
#define DMA_MAP_MAPPED 0x00000001
char neutral_byte;
#ifdef SPARCAUDIO_EMU
#define EOFLIST_SIZE 16
void *devaudio_sigproc; /* A pref to which send a SIGPOLL signal */
int devaudio_sigmask;
int eof_head, eof_tail;
int eof_list[EOFLIST_SIZE], eof_counts[EOFLIST_SIZE];
#endif
int error;
int play_underruns, rec_overruns;
int underrun_flag;
int play_error, num_play_errors;
int rec_error, num_rec_errors;
unsigned char *leftover_buf;
int leftover_bytes;
int tmpbuf_len, tmpbuf_ptr;
cnv_func_t convert_func;
unsigned int convert_mode;
struct audio_buffer *(*user_import) (struct audio_operations * adev,
struct dma_buffparms * dmap,
sample_parms * parms,
unsigned char *cbuf, int len);
int (*user_export) (struct audio_operations * adev,
struct dma_buffparms * dmap, sample_parms * parms,
struct audio_buffer * buf, unsigned char *cbuf,
int maxbytes);
struct audio_buffer *(*device_read) (struct audio_operations * adev,
struct dma_buffparms * dmap,
sample_parms * parms,
unsigned char *cbuf, int len);
int (*device_write) (struct audio_operations * adev,
struct dma_buffparms * dmap,
void *frombuf, void *tobuf,
int maxspace, int *fromlen, int *tolen);
};
extern int dmap_get_qlen (dma_buffparms * dmap);
extern int dmap_get_qhead (dma_buffparms * dmap);
extern int dmap_get_qtail (dma_buffparms * dmap);
struct audio_driver
{
int (*open) (int dev, int mode, int open_flags);
void (*close) (int dev, int mode);
void (*output_block) (int dev, oss_native_ulong buf,
int count, int fragsize, int intrflag);
void (*start_input) (int dev, oss_native_ulong buf,
int count, int fragsize, int intrflag);
int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg);
int (*prepare_for_input) (int dev, int bufsize, int nbufs);
int (*prepare_for_output) (int dev, int bufsize, int nbufs);
void (*halt_io) (int dev);
int (*local_qlen) (int dev);
int (*copy_user) (int dev, char *localbuf, int localoffs,
WR_BUF_CONST snd_rw_buf * userbuf, int useroffs,
int *len, int max_space);
void (*halt_input) (int dev);
void (*halt_output) (int dev);
void (*trigger) (int dev, int bits);
int (*set_speed) (int dev, int speed);
unsigned int (*set_bits) (int dev, unsigned int bits);
short (*set_channels) (int dev, short channels);
void (*postprocess_write) (int dev); /* Device spesific postprocessing for written data */
void (*preprocess_read) (int dev); /* Device spesific preprocessing for read data */
/* Timeout handlers for input and output */
int (*check_input) (int dev);
int (*check_output) (int dev);
int (*alloc_buffer) (int dev, struct dma_buffparms * dmap, int direction);
int (*free_buffer) (int dev, struct dma_buffparms * dmap, int direction);
void (*lock_buffer) (int dev, int direction);
void *dummy;
int (*get_buffer_pointer) (int dev, struct dma_buffparms * dmap,
int direction);
int (*calibrate_speed) (int dev, int nominal_rate, int true_rate);
#define SYNC_PREPARE 1
#define SYNC_TRIGGER 2
int (*sync_control) (int dev, int event, int mode);
void (*prepare_to_stop) (int dev);
int (*get_input_pointer) (int dev, struct dma_buffparms * dmap,
int direction);
int (*get_output_pointer) (int dev, struct dma_buffparms * dmap,
int direction);
int (*bind) (int dev, unsigned int cmd, ioctl_arg arg);
void (*setup_fragments) (int dev, dmap_p dmap, int direction);
};
struct audio_operations
{
char name[128];
char handle[32];
int dev; /* Device's own index */
int enabled;
struct audio_operations *next; /* Link to the next "shadow" device */
int flags;
int open_flags;
int caps;
int magic; /* Secret low level driver ID */
#define NOTHING_SPECIAL 0x00
#define NEEDS_RESTART 0x01
#define DMA_AUTOMODE 0x02
#define DMA_DUPLEX 0x04
#define DMA_COLD 0x08
#define DMA_UNUSED1 0x10
#define DMA_UNUSED2 0x40
#define DMA_UNUSED3 0x80
#define DMA_ISA 0x100 /* ISA DMA buffer placement restrictions */
#define DMA_VIRTUAL 0x400 /* Virtual audio device */
#define DMA_OPENED 0x800 /* Will be set when the device is open */
#define DMA_NOCONVERT 0x1000 /* No implicit format conversions */
#define DMA_DUALBUF 0x2000 /* Alloc separate bufs for rec and play */
#define DMA_USEPHYSADDR 0x4000 /* Use raw_buf_phys when mmap()ing */
#define DMA_DISABLED 0x8000
#define DMA_NOINPUT 0x10000
#define DMA_NOOUTPUT 0x20000
#define DMA_FIXEDRATE 0x40000 /* Fixed sampling rate */
#define DMA_16BITONLY 0x80000 /* Only 16 bit support */
#define DMA_STEREOONLY 0x100000 /* Only stereo (requires 16BITONLY) */
#define DMA_HUSHOUTPUT 0x200000 /* Do not permit use with O_WRONLY */
#define DMA_SHADOW 0x400000 /* "shadow" device */
#define DMA_ISABUS 0x800000 /* ISA device */
#define DMA_NODMA 0x1000000 /* For ISA devices only */
#define DMA_8BITONLY 0x2000000 /* Only 8 bits */
#define DMA_32BITONLY 0x4000000 /* Only 24 or 32 bits */
#define DMA_NOSOFTOSS 0x8000000 /* Don't install SoftOSS automatically for this device */
#define DMA_NOSRC 0x10000000 /* Don't do any kind of SRC */
#define DMA_SPECIAL 0x20000000 /* Multich or otherwise special dev */
#define DMA_NOMMAP 0x40000000 /* No MMAP capability */
#define DMA_SOFTOSS_DISABLE 0x80000000 /* Not compatible with SoftOSS */
/*
* Sampling parameters
*/
sample_parms user_parms, hw_parms;
int iformat_mask, oformat_mask; /* Bitmasks for supported audio formats */
int min_rate, max_rate; /* Sampling rate limits */
int min_channels, max_channels;
int xformat_mask; /* Format mask for current open mode */
int binding;
void *devc; /* Driver specific info */
struct audio_driver *d;
void *portc, *portc_play, *portc_record; /* Driver specific info */
struct dma_buffparms *dmap_in, *dmap_out;
int mixer_dev;
int open_mode;
int go;
int enable_bits;
int parent_dev; /* 0 -> no parent, 1 to n -> parent=parent_dev+1 */
int max_block; /* Maximum fragment size to be accepted */
int min_block; /* Minimum fragment size */
int max_intrate; /* Another form of min_block */
int fixed_rate;
int vmix_flags; /* special flags sent to virtual mixer */
#define VMIX_MULTIFRAG 0x00000001 /* More than 2 fragments required (causes longer latencies) */
int src_rate;
int src_ratio;
pid_t pid;
char cmd[16];
sound_os_info *osp;
int setfragment_warned;
int riff_warned;
int redirect_in, redirect_out;
int dmask; /* Open dmaps */
#define DMASK_OUT 0x01
#define DMASK_IN 0x02
int nonblock;
int forced_nonblock;
int ossd_registered;
int sync_flags;
#define SYNC_MASTER 0x01
#define SYNC_SLAVE 0x02
int sync_group;
int sync_mode;
struct audio_operations *sync_next; /* Next device in sync group */
int rate_source;
#define MAX_SAMPLE_RATES 20 /* Cannot be changed (see soundcard.h) */
int nrates, rates[MAX_SAMPLE_RATES];
#ifndef CONFIGURE_C
oss_mutex mutex;
#endif
int card_number;
int port_number;
int real_dev;
int cooked_enable;
int timeout_count;
void (*outputintr) (int dev, int xx);
void (*inputintr) (int dev);
};
typedef struct oss_card_desc
{
char shortname[16];
char longname[128];
} oss_card_desc_t, *oss_card_desc_p;
#define UNIT_EXPAND 1024
extern struct audio_operations **audio_devs;
extern int num_audiodevs;
extern oss_card_desc_p *oss_cardlist;
extern const char *oss_version_string;
extern const char *oss_checksum;
#endif

View file

@ -1,66 +0,0 @@
#ifndef MIDI_CORE_H
#define MIDI_CORE_H
/*
* Copyright by 4Front Technologies 1993-2004
*
* All rights reserved.
*/
/*
* IMPORTANT NOTICE!
*
* This file contains internal structures used by Open Sound Systems.
* They will change without any notice between OSS versions. Care must be taken
* to make sure any software using this header gets properly re-compiled before
* use.
*
* 4Front Technologies (or anybody else) takes no responsibility of damages
* caused by use of this file.
*/
struct midi_input_info
{ /* MIDI input scanner variables */
#define MI_MAX 32
int m_busy;
unsigned char m_buf[MI_MAX];
unsigned char m_prev_status; /* For running status */
int m_ptr;
#define MST_INIT 0
#define MST_DATA 1
#define MST_SYSEX 2
int m_state;
int m_left;
};
typedef struct midi_operations
{
struct midi_info info;
struct synth_operations *converter;
struct midi_input_info in_info;
int (*open) (int dev, int mode,
void (*inputintr) (int dev, unsigned char data),
void (*outputintr) (int dev));
void (*close) (int dev);
int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg);
int (*outputc) (int dev, unsigned char data);
int (*start_read) (int dev);
int (*end_read) (int dev);
void (*kick) (int dev);
int (*command) (int dev, unsigned char *data);
int (*buffer_status) (int dev);
int (*prefix_cmd) (int dev, unsigned char status);
void (*input_callback) (int dev, unsigned char midich);
struct coproc_operations *coproc;
void *devc;
sound_os_info *osp;
int card_number;
#ifndef CONFIGURE_C
oss_mutex mutex;
#endif
unsigned long flags;
#define MFLAG_NOSEQUENCER 0x00000001 /* Not to be used by the sequencer driver */
} mididev_t, *mididev_p;
extern struct midi_operations **midi_devs;
extern int num_mididevs;
#endif

View file

@ -1,61 +0,0 @@
#ifndef MIXER_CORE_H
#define MIXER_CORE_H
/*
* Copyright by 4Front Technologies 1993-2004
*
* All rights reserved.
*/
/*
* IMPORTANT NOTICE!
*
* This file contains internal structures used by Open Sound Systems.
* They will change without any notice between OSS versions. Care must be taken
* to make sure any software using this header gets properly re-compiled before
* use.
*
* 4Front Technologies (or anybody else) takes no responsibility of damages
* caused by use of this file.
*/
typedef int (*mixer_ext_fn) (int dev, int ctrl, unsigned int cmd, int value);
typedef int (*mixer_ext_init_fn) (int dev);
typedef struct
{
oss_mixext ext;
mixer_ext_fn handler;
oss_mixer_enuminfo *enum_info;
}
oss_mixext_desc;
struct mixer_operations
{
char id[16];
char name[64];
int (*ioctl) (int dev, int audiodev, unsigned int cmd, ioctl_arg arg);
void *devc;
void *hw_devc;
int modify_counter;
/* Mixer extension interface */
int nr_ext;
int max_ext;
int nr_extra_ext;
int timestamp;
oss_mixext_desc *extensions;
mixer_ext_init_fn ext_init_fn;
int ignore_mask; /* Controls ignored by mixer ext API */
int card_number;
int enabled;
};
typedef struct mixer_operations mixdev_t, *mixdev_p;
extern struct mixer_operations **mixer_devs;
extern int num_mixers;
extern void touch_mixer (int dev);
extern int oss_mixer_ext (int orig_dev, unsigned int cmd, ioctl_arg arg);
extern int mixer_ext_set_enum (oss_mixer_enuminfo * ent);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,96 +0,0 @@
#ifndef _ULTRASOUND_H_
#define _ULTRASOUND_H_
/*
* ultrasound.h - Macros for programming the Gravis Ultrasound
* These macros are extremely device dependent
* and not portable.
*/
#define COPYING2 Copyright (C) Hannu Savolainen and Dev Mazumdar 1997. All rights reserved.
/*
* Private events for Gravis Ultrasound (GUS)
*
* Format:
* byte 0 - SEQ_PRIVATE (0xfe)
* byte 1 - Synthesizer device number (0-N)
* byte 2 - Command (see below)
* byte 3 - Voice number (0-31)
* bytes 4 and 5 - parameter P1 (unsigned short)
* bytes 6 and 7 - parameter P2 (unsigned short)
*
* Commands:
* Each command affects one voice defined in byte 3.
* Unused parameters (P1 and/or P2 *MUST* be initialized to zero).
* _GUS_NUMVOICES - Sets max. number of concurrent voices (P1=14-31, default 16)
* _GUS_VOICESAMPLE- ************ OBSOLETE *************
* _GUS_VOICEON - Starts voice (P1=voice mode)
* _GUS_VOICEOFF - Stops voice (no parameters)
* _GUS_VOICEFADE - Stops the voice smoothly.
* _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode)
* _GUS_VOICEBALA - Sets voice balence (P1, 0=left, 7=middle and 15=right, default 7)
* _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz)
* _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
* _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
* (Like GUS_VOICEVOL but doesn't change the hw
* volume. It just updates volume in the voice table).
*
* _GUS_RAMPRANGE - Sets limits for volume ramping (P1=low volume, P2=high volume)
* _GUS_RAMPRATE - Sets the speed for volume ramping (P1=scale, P2=rate)
* _GUS_RAMPMODE - Sets the volume ramping mode (P1=ramping mode)
* _GUS_RAMPON - Starts volume ramping (no parameters)
* _GUS_RAMPOFF - Stops volume ramping (no parameters)
* _GUS_VOLUME_SCALE - Changes the volume calculation constants
* for all voices.
*/
#define _GUS_NUMVOICES 0x00
#define _GUS_VOICESAMPLE 0x01 /* OBSOLETE */
#define _GUS_VOICEON 0x02
#define _GUS_VOICEOFF 0x03
#define _GUS_VOICEMODE 0x04
#define _GUS_VOICEBALA 0x05
#define _GUS_VOICEFREQ 0x06
#define _GUS_VOICEVOL 0x07
#define _GUS_RAMPRANGE 0x08
#define _GUS_RAMPRATE 0x09
#define _GUS_RAMPMODE 0x0a
#define _GUS_RAMPON 0x0b
#define _GUS_RAMPOFF 0x0c
#define _GUS_VOICEFADE 0x0d
#define _GUS_VOLUME_SCALE 0x0e
#define _GUS_VOICEVOL2 0x0f
#define _GUS_VOICE_POS 0x10
/*
* GUS API macros
*/
#define _GUS_CMD(chn, voice, cmd, p1, p2) \
{_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_PRIVATE;\
_seqbuf[_seqbufptr+1] = (chn); _seqbuf[_seqbufptr+2] = cmd;\
_seqbuf[_seqbufptr+3] = voice;\
*(unsigned short*)&_seqbuf[_seqbufptr+4] = p1;\
*(unsigned short*)&_seqbuf[_seqbufptr+6] = p2;\
_SEQ_ADVBUF(8);}
#define GUS_NUMVOICES(chn, p1) _GUS_CMD(chn, 0, _GUS_NUMVOICES, (p1), 0)
#define GUS_VOICESAMPLE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICESAMPLE, (p1), 0) /* OBSOLETE */
#define GUS_VOICEON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEON, (p1), 0)
#define GUS_VOICEOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEOFF, 0, 0)
#define GUS_VOICEFADE(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEFADE, 0, 0)
#define GUS_VOICEMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEMODE, (p1), 0)
#define GUS_VOICEBALA(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEBALA, (p1), 0)
#define GUS_VOICEFREQ(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICEFREQ, \
(p) & 0xffff, ((p) >> 16) & 0xffff)
#define GUS_VOICEVOL(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL, (p1), 0)
#define GUS_VOICEVOL2(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL2, (p1), 0)
#define GUS_RAMPRANGE(chn, voice, low, high) _GUS_CMD(chn, voice, _GUS_RAMPRANGE, (low), (high))
#define GUS_RAMPRATE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_RAMPRATE, (p1), (p2))
#define GUS_RAMPMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPMODE, (p1), 0)
#define GUS_RAMPON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPON, (p1), 0)
#define GUS_RAMPOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_RAMPOFF, 0, 0)
#define GUS_VOLUME_SCALE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_VOLUME_SCALE, (p1), (p2))
#define GUS_VOICE_POS(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICE_POS, \
(p) & 0xffff, ((p) >> 16) & 0xffff)
#endif

View file

@ -184,6 +184,7 @@ bool idAudioHardwareOSS::Initialize( ) {
// verify capabilities -----------------------------------------
#if SOUND_VERSION >= 0x040000
// may only be available starting with OSS API v4.0
// http://www.fi.opensound.com/developer/SNDCTL_SYSINFO.html
// NOTE: at OSS API 4.0 headers, replace OSS_SYSINFO with SNDCTL_SYSINFO
@ -193,6 +194,7 @@ bool idAudioHardwareOSS::Initialize( ) {
} else {
common->Printf( "%s: %s %s\n", s_device.GetString(), si.product, si.version );
}
#endif
if ( ioctl( m_audio_fd, SNDCTL_DSP_GETCAPS, &caps ) == -1 ) {
common->Warning( "ioctl SNDCTL_DSP_GETCAPS failed - driver too old?" );

View file

@ -245,9 +245,6 @@ if ( local_curl == 0 ):
local_env.Append( CPPDEFINES = [ 'ID_ENABLE_CURL=0' ] )
sound_env = local_env.Clone()
sound_env.Append( CPPPATH = '/usr/local/lib/oss/include' )
# store a local copy of the include headers as well for holy build
sound_env.Append( CPPPATH = '../linux/oss/include' )
sound_list = [ '../linux/sound.cpp' ]
if ( g_os == "Linux" and ALSA != '0' ):
sound_list.append( '../../sys/linux/sound_alsa.cpp' )