Import 2.3.18pre1
[davej-history.git] / drivers / sound / softoss.h
blob42dab13dcd56f5aacf69335eb2db0746c44c968a
1 /*
2 * softoss.h - Definitions for Software MIDI Synthesizer.
3 */
4 /*
5 * Copyright (C) by Hannu Savolainen 1993-1997
7 * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
8 * Version 2 (June 1991). See the "COPYING" file distributed with this software
9 * for more info.
14 * Sequencer mode1 timer calls made by sequencer.c
16 extern int (*softsynthp) (int cmd, int parm1, int parm2, unsigned long parm3);
18 #define SSYN_START 1
19 #define SSYN_REQUEST 2 /* parm1 = time */
20 #define SSYN_STOP 3
21 #define SSYN_GETTIME 4 /* Returns number of ticks since reset */
23 #define MAX_PATCH 256
24 #define MAX_SAMPLE 512
25 #define MAX_VOICE 32
26 #define DEFAULT_VOICES 16
28 typedef struct voice_info
31 * Don't change anything in the beginning of this struct. These fields are used
32 * by the resampling loop which may have been written in assembly for some
33 * architectures. Any change may make the resampling code incompatible
35 int instr;
36 short *wave;
37 struct patch_info *sample;
39 unsigned int ptr; int step; /* Pointer to the wave data and pointer increment */
41 int mode;
42 int startloop, startbackloop, endloop, looplen;
44 unsigned int leftvol, rightvol;
45 /***** Don't change anything above this */
47 volatile unsigned long orig_freq, current_freq;
48 volatile int bender, bender_range, panning;
49 volatile int main_vol, expression_vol, patch_vol, velocity;
51 /* Envelope parameters */
53 int envelope_phase;
54 volatile int envelope_vol;
55 volatile int envelope_volstep;
56 int envelope_time; /* Number of remaining envelope steps */
57 unsigned int envelope_target;
58 int percussive_voice;
59 int sustain_mode; /* 0=off, 1=sustain on, 2=sustain on+key released */
61 /* Vibrato */
62 int vibrato_rate;
63 int vibrato_depth;
64 int vibrato_phase;
65 int vibrato_step;
66 int vibrato_level;
68 /* Tremolo */
69 int tremolo_rate;
70 int tremolo_depth;
71 int tremolo_phase;
72 int tremolo_step;
73 int tremolo_level;
74 } voice_info;
76 extern voice_info softoss_voices[MAX_VOICE]; /* Voice spesific info */
78 typedef struct softsyn_devc
81 * Don't change anything in the beginning of this struct. These fields are used
82 * by the resampling loop which may have been written in assembly for some
83 * architectures. Any change may make the resampling code incompatible
85 int maxvoice; /* # of voices to be processed */
86 int afterscale;
87 int delay_size;
88 int control_rate, control_counter;
89 /***** Don't change anything above this */
91 int ram_size;
92 int ram_used;
94 int synthdev;
95 int timerdev;
96 int sequencer_mode;
98 * Audio parameters
101 int audiodev;
102 int audio_opened;
103 int speed;
104 int channels;
105 int bits;
106 int default_max_voices;
107 int max_playahead;
108 struct file finfo;
109 int fragsize;
110 int samples_per_fragment;
113 * Sample storage
115 int nrsamples;
116 struct patch_info *samples[MAX_SAMPLE];
117 short *wave[MAX_SAMPLE];
120 * Programs
122 int programs[MAX_PATCH];
125 * Timer parameters
127 volatile unsigned long usecs;
128 volatile unsigned long usecs_per_frag;
129 volatile unsigned long next_event_usecs;
132 * Engine state
135 volatile int engine_state;
136 #define ES_STOPPED 0
137 #define ES_STARTED 1
139 /* Voice spesific bitmaps */
140 volatile int tremolomap;
141 volatile int vibratomap;
143 } softsyn_devc;
145 void softsynth_resample_loop(short *buf, int loops);
146 extern void softsyn_control_loop(void);
148 #define DELAY_SIZE 4096
150 #ifdef SOFTSYN_MAIN
151 short voice_active[MAX_VOICE] = {0};
152 voice_info softoss_voices[MAX_VOICE] = {{0}}; /* Voice spesific info */
153 int left_delay[DELAY_SIZE]={0}, right_delay[DELAY_SIZE]={0};
154 int delayp=0;
155 #else
156 extern softsyn_devc *devc;
158 extern int left_delay[DELAY_SIZE], right_delay[DELAY_SIZE];
159 extern int delayp;
160 extern short voice_active[MAX_VOICE];
161 #endif