2
* Purpose: Definitions for the vmix driver
6
* This file is part of Open Sound System.
8
* Copyright (C) 4Front Technologies 1996-2008.
10
* This this source file is released under GPL v2 license (no other versions).
11
* See the COPYING file included in the main directory of this source
12
* distribution for the license terms and conditions.
16
#define SUPPORTED_FORMATS (AFMT_S16_NE | AFMT_S16_OE | AFMT_S32_NE | AFMT_S32_OE)
19
* Maximum number of clients per "real" device is defined by MAX_CLIENTS. Limit of 4 would be good for 95% of systems.
20
* For each client there will be a mixer volume control and peak meter in the mixer interface. Raising the
21
* client limit will make the mixer interface larger and larger. Something like 8 is probably the practical limit
22
* for number of clients.
24
* Mixing more than 16 streams together doesn't make much sense since the result is likely to be
25
* just noise. Mixing a stream will cause some overhead so it's not a good idea to let large number of iddle
26
* applications running muted or playing silence.
31
#define MAX_LOOPDEVS 2 /* Maximum number of vmix loopback devices */
34
* 8 play channels and 2 rec channels might be OK for most devices. However envy24 requires 10 play and 12 rec
35
* channels for the "raw devices". Some professional (ADAT) cards like Digi96 requires 8+8 channels.
37
#define MAX_PLAY_CHANNELS 12
38
/* MAX_REC_CHANNELS must be less or equal than MAX_PLAY_CHANNELS */
39
#define MAX_REC_CHANNELS 12
41
#define CHBUF_SAMPLES 2048 /* Max samples (frames) per fragment */
43
typedef struct _vmix_mixer_t vmix_mixer_t;
44
typedef struct _vmix_portc_t vmix_portc_t;
45
typedef struct _vmix_engine_t vmix_engine_t;
46
typedef unsigned char vmix_channel_map_t[MAX_PLAY_CHANNELS];
48
struct _vmix_portc_t /* Audio device specific data */
52
vmix_portc_t *next; /* Linked list for all portc structures */
68
int open_pending; /* Set to 1 by vmix_create_client() and cleared by vmix_open() */
71
int play_choffs; /* Index of the first channel on multich play engines */
72
int rec_choffs; /* Index of the first channel on multich rec engines */
73
#ifdef CONFIG_OSS_VMIX_FLOAT
74
double play_dma_pointer_src;
77
int volume[2]; /* Left and right ch volumes */
80
void (*play_mixing_func) (vmix_portc_t * portc, int nsamples);
81
void (*rec_mixing_func) (vmix_portc_t * portc, int nsamples);
83
vmix_channel_map_t channel_order;
86
#ifdef CONFIG_OSS_VMIX_FLOAT
87
typedef float vmix_sample_t;
89
typedef int vmix_sample_t;
92
typedef void (*converter_t) (vmix_engine_t * engine, void *outbuf,
93
vmix_sample_t * chbufs[], int channels,
98
int rate, channels, fmt, bits;
101
int samples_per_frag;
103
converter_t converter;
104
vmix_sample_t *chbufs[MAX_PLAY_CHANNELS];
105
unsigned int limiter_statevar;
108
* Mixer volumes, etc.
112
int num_active_outputs;
113
vmix_channel_map_t channel_order;
116
struct _vmix_mixer_t /* Instance specific data */
118
vmix_mixer_t *next; /* Pointer to the next vmix instance */
122
oss_device_t *master_osdev;
124
unsigned int attach_flags;
128
int open_devices, open_inputs;
129
struct fileinfo master_finfo, input_finfo;
130
int masterdev_opened;
132
int vmix_flags; /* Copy of adev[master]->vmix_flags */
135
* Config options for this instance
141
int src_quality; /* Control panel setting */
142
int multich_enable; /* Enable multi channel mode */
145
vmix_engine_t play_engine, record_engine;
147
vmix_portc_t *client_portc[MAX_CLIENTS];
148
vmix_portc_t *loop_portc[MAX_LOOPDEVS];
149
int num_clientdevs, num_loopdevs;
154
* Mixer device numbers for the master audio devices
156
int output_mixer_dev;
158
int first_input_mixext;
159
int first_output_mixext;
160
int client_mixer_group; /* Create the client controls under this mixer group */
163
extern void vmix_setup_play_engine (vmix_mixer_t * mixer, adev_t * adev,
165
extern void vmix_setup_record_engine (vmix_mixer_t * mixer, adev_t * adev,
167
extern void finalize_record_engine (vmix_mixer_t * mixer, int fmt,
168
adev_t * adev, dmap_p dmap);
170
extern void vmix_outmix_16ne (vmix_portc_t * portc, int nsamples);
171
extern void vmix_outmix_16oe (vmix_portc_t * portc, int nsamples);
172
extern void vmix_outmix_32ne (vmix_portc_t * portc, int nsamples);
173
extern void vmix_outmix_32oe (vmix_portc_t * portc, int nsamples);
174
#ifdef CONFIG_OSS_VMIX_FLOAT
175
extern void vmix_outmix_float (vmix_portc_t * portc, int nsamples);
178
#ifdef CONFIG_OSS_VMIX_FLOAT
180
* For the time being these routines will only work in floating point.
182
extern void vmix_outmix_16ne_src (vmix_portc_t * portc, int nsamples);
183
extern void vmix_outmix_16oe_src (vmix_portc_t * portc, int nsamples);
184
extern void vmix_outmix_32ne_src (vmix_portc_t * portc, int nsamples);
185
extern void vmix_outmix_32oe_src (vmix_portc_t * portc, int nsamples);
186
extern void vmix_outmix_float_src (vmix_portc_t * portc, int nsamples);
189
extern void vmix_rec_export_16ne (vmix_portc_t * portc, int nsamples);
190
extern void vmix_rec_export_16oe (vmix_portc_t * portc, int nsamples);
191
extern void vmix_rec_export_32ne (vmix_portc_t * portc, int nsamples);
192
extern void vmix_rec_export_32oe (vmix_portc_t * portc, int nsamples);
193
#ifdef CONFIG_OSS_VMIX_FLOAT
194
extern void vmix_rec_export_float (vmix_portc_t * portc, int nsamples);
198
#define VMIX_VOL_SCALE 127
200
#ifdef CONFIG_OSS_VMIX_FLOAT
201
extern const float vmix_db_table[DB_SIZE + 1];
203
extern const int vmix_db_table[DB_SIZE + 1];
207
#include "db_scale.h"
212
* Endianess swapping functions
214
static __inline__ short
218
unsigned char *a = ((unsigned char *) &x) + 1;
219
unsigned char *b = (unsigned char *) &y;
227
static __inline__ int
232
unsigned char *a = ((unsigned char *) &x) + 3;
233
unsigned char *b = (unsigned char *) &y;