forked from KS-Presto/Wolf4SDL
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathid_sd.h
199 lines (170 loc) · 4.44 KB
/
id_sd.h
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
/*
// ID Engine
// ID_SD.h - Sound Manager Header
// Version for Wolfenstein
// By Jason Blochowiak
*/
#ifndef __ID_SD_H_
#define __ID_SD_H_
#include "version.h"
#define TickBase 70 /* 70Hz per tick - used as a base for timer 0 */
typedef enum
{
sdm_Off,
sdm_PC,
#ifndef SEGA_SATURN
sdm_AdLib,
#endif
} SDMode;
typedef enum
{
smm_Off,
smm_AdLib
} SMMode;
typedef enum
{
sds_Off,
sds_PC,
sds_SoundBlaster
} SDSMode;
#ifndef SEGA_SATURN
typedef struct
{
unsigned int length;
unsigned short priority;
} SoundCommon;
#endif
#define ORIG_SOUNDCOMMON_SIZE 6
/* PC Sound stuff */
#define pcTimer 0x42
#define pcTAccess 0x43
#define pcSpeaker 0x61
#define pcSpkBits 3
#ifndef SEGA_SATURN
typedef struct
{
SoundCommon common;
unsigned char data[1];
} PCSound;
#endif
/* Register addresses */
/* Operator stuff */
#define alChar 0x20
#define alScale 0x40
#define alAttack 0x60
#define alSus 0x80
#define alWave 0xe0
/* Channel stuff */
#define alFreqL 0xa0
#define alFreqH 0xb0
#define alFeedCon 0xc0
/* Global stuff */
#define alEffects 0xbd
#ifndef SEGA_SATURN
typedef struct
{
unsigned char mChar,cChar,
mScale,cScale,
mAttack,cAttack,
mSus,cSus,
mWave,cWave,
nConn,
/* These are only for Muse - these bytes are really unused */
voice,
mode;
unsigned char unused[3];
} Instrument;
#endif
#define ORIG_INSTRUMENT_SIZE 16
#ifndef SEGA_SATURN
typedef struct
{
SoundCommon common;
Instrument inst;
unsigned char block;
unsigned char data[1];
} AdLibSound;
#define ORIG_ADLIBSOUND_SIZE (ORIG_SOUNDCOMMON_SIZE + ORIG_INSTRUMENT_SIZE + 2)
#endif
/*
** Sequencing stuff
*/
#define sqMaxTracks 10
#ifndef SEGA_SATURN
typedef struct
{
unsigned short length;
unsigned short values[1];
} MusicGroup;
typedef struct
{
int valid;
fixed globalsoundx, globalsoundy;
} globalsoundpos;
#endif
typedef struct
{
unsigned int startpage;
unsigned int length;
} digiinfo;
#ifndef SEGA_SATURN
extern globalsoundpos channelSoundPos[];
#endif
/* Global variables */
extern boolean
#ifndef SEGA_SATURN
AdLibPresent,
#endif
SoundBlasterPresent,
SoundPositioned;
extern SDMode SoundMode;
extern SDSMode DigiMode;
#ifndef SEGA_SATURN
extern SMMode MusicMode;
#endif
extern unsigned short NumDigi;
extern digiinfo *DigiList;
#if !defined(USE_ADX) && !defined(SEGA_SATURN)
extern int DigiMap[];
#endif
#ifndef SEGA_SATURN
extern int DigiChannel[];
#endif
/* Function prototypes */
extern wlinline void Delay (int wolfticks);
extern void SD_Startup(void),
SD_Shutdown(void);
extern int SD_GetChannelForDigi(int which);
#ifndef SEGA_SATURN
extern void SD_PositionSound(int leftvol,int rightvol);
#endif
extern boolean SD_PlaySound(soundnames sound);
#ifndef SEGA_SATURN
extern void SD_SetPosition(int channel, int leftvol,int rightvol);
#endif
extern void SD_StopSound(void),
SD_WaitSoundDone(void);
extern void SD_StartMusic(int chunk);
extern void SD_ContinueMusic(int chunk, int startoffs);
extern void SD_MusicOn(void),
SD_FadeOutMusic(void);
extern int SD_MusicOff(void);
extern boolean SD_MusicPlaying(void);
#ifndef SEGA_SATURN
extern boolean SD_SetSoundMode(SDMode mode);
extern boolean SD_SetMusicMode(SMMode mode);
#endif
extern unsigned short SD_SoundPlaying(void);
#ifndef SEGA_SATURN
extern void SD_SetDigiDevice(SDSMode);
#endif
extern void SD_PrepareSound(int which);
extern int SD_PlayDigitized(unsigned short which,int leftpos,int rightpos);
extern void SD_StopDigitized(void);
extern int SD_InitOPL(int numChips, int clock, int rate);
extern int SD_WriteOPL(int which, int a, int v);
extern void SD_UpdateOPL(int which, short* buffer, int length);
#ifndef VIEASM
#define alOut(n,b) SD_WriteOPL(oplChip, n, b)
#endif
#endif /* __ID_SD_H_ */