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
|
/*
* softoss.h - Definitions for Software MIDI Synthesizer.
*/
/*
* Copyright (C) by Hannu Savolainen 1993-1997
*
* OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
* Version 2 (June 1991). See the "COPYING" file distributed with this software
* for more info.
*/
/*
* Sequencer mode1 timer calls made by sequencer.c
*/
extern int (*softsynthp) (int cmd, int parm1, int parm2, unsigned long parm3);
#define SSYN_START 1
#define SSYN_REQUEST 2 /* parm1 = time */
#define SSYN_STOP 3
#define SSYN_GETTIME 4 /* Returns number of ticks since reset */
#define MAX_PATCH 256
#define MAX_SAMPLE 512
#define MAX_VOICE 32
#define DEFAULT_VOICES 16
typedef struct voice_info
{
/*
* Don't change anything in the beginning of this struct. These fields are used
* by the resampling loop which may have been written in assembly for some
* architectures. Any change may make the resampling code incompatible
*/
int instr;
short *wave;
struct patch_info *sample;
unsigned int ptr; int step; /* Pointer to the wave data and pointer increment */
int mode;
int startloop, startbackloop, endloop, looplen;
unsigned int leftvol, rightvol;
/***** Don't change anything above this */
volatile unsigned long orig_freq, current_freq;
volatile int bender, bender_range, panning;
volatile int main_vol, expression_vol, patch_vol, velocity;
/* Envelope parameters */
int envelope_phase;
volatile int envelope_vol;
volatile int envelope_volstep;
int envelope_time; /* Number of remaining envelope steps */
unsigned int envelope_target;
int percussive_voice;
int sustain_mode; /* 0=off, 1=sustain on, 2=sustain on+key released */
/* Vibrato */
int vibrato_rate;
int vibrato_depth;
int vibrato_phase;
int vibrato_step;
int vibrato_level;
/* Tremolo */
int tremolo_rate;
int tremolo_depth;
int tremolo_phase;
int tremolo_step;
int tremolo_level;
} voice_info;
extern voice_info softoss_voices[MAX_VOICE]; /* Voice spesific info */
typedef struct softsyn_devc
{
/*
* Don't change anything in the beginning of this struct. These fields are used
* by the resampling loop which may have been written in assembly for some
* architectures. Any change may make the resampling code incompatible
*/
int maxvoice; /* # of voices to be processed */
int afterscale;
int delay_size;
int control_rate, control_counter;
/***** Don't change anything above this */
int ram_size;
int ram_used;
int synthdev;
int timerdev;
int sequencer_mode;
/*
* Audio parameters
*/
int audiodev;
int audio_opened;
int speed;
int channels;
int bits;
int default_max_voices;
int max_playahead;
struct file finfo;
int fragsize;
int samples_per_fragment;
/*
* Sample storage
*/
int nrsamples;
struct patch_info *samples[MAX_SAMPLE];
short *wave[MAX_SAMPLE];
/*
* Programs
*/
int programs[MAX_PATCH];
/*
* Timer parameters
*/
volatile unsigned long usecs;
volatile unsigned long usecs_per_frag;
volatile unsigned long next_event_usecs;
/*
* Engine state
*/
volatile int engine_state;
#define ES_STOPPED 0
#define ES_STARTED 1
/* Voice spesific bitmaps */
volatile int tremolomap;
volatile int vibratomap;
} softsyn_devc;
void softsynth_resample_loop(short *buf, int loops);
extern void softsyn_control_loop(void);
#define DELAY_SIZE 4096
#ifdef SOFTSYN_MAIN
short voice_active[MAX_VOICE] = {0};
voice_info softoss_voices[MAX_VOICE] = {{0}}; /* Voice spesific info */
int left_delay[DELAY_SIZE]={0}, right_delay[DELAY_SIZE]={0};
int delayp=0;
#else
extern softsyn_devc *devc;
extern int left_delay[DELAY_SIZE], right_delay[DELAY_SIZE];
extern int delayp;
extern short voice_active[MAX_VOICE];
#endif
|