Rev 8645 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8645 | turbocat | 1 | // |
2 | // ID Engine |
||
3 | // ID_SD.h - Sound Manager Header |
||
4 | // Version for Wolfenstein |
||
5 | // By Jason Blochowiak |
||
6 | // |
||
7 | |||
8 | #ifndef __ID_SD__ |
||
9 | #define __ID_SD__ |
||
10 | |||
11 | #define alOut(n,b) YM3812Write(0, n, b) |
||
12 | |||
13 | #define TickBase 70 // 70Hz per tick - used as a base for timer 0 |
||
14 | |||
15 | typedef enum |
||
16 | { |
||
17 | sdm_Off, |
||
18 | sdm_PC,sdm_AdLib, |
||
19 | } SDMode; |
||
20 | |||
21 | typedef enum |
||
22 | { |
||
23 | smm_Off,smm_AdLib |
||
24 | } SMMode; |
||
25 | |||
26 | typedef enum |
||
27 | { |
||
28 | sds_Off,sds_PC,sds_SoundBlaster |
||
29 | } SDSMode; |
||
30 | |||
31 | typedef struct |
||
32 | { |
||
33 | longword length; |
||
34 | word priority; |
||
35 | } SoundCommon; |
||
36 | |||
37 | #define ORIG_SOUNDCOMMON_SIZE 6 |
||
38 | |||
39 | // PC Sound stuff |
||
40 | #define pcTimer 0x42 |
||
41 | #define pcTAccess 0x43 |
||
42 | #define pcSpeaker 0x61 |
||
43 | |||
44 | #define pcSpkBits 3 |
||
45 | |||
46 | typedef struct |
||
47 | { |
||
48 | SoundCommon common; |
||
49 | byte data[1]; |
||
50 | } PCSound; |
||
51 | |||
52 | // Register addresses |
||
53 | // Operator stuff |
||
54 | #define alChar 0x20 |
||
55 | #define alScale 0x40 |
||
56 | #define alAttack 0x60 |
||
57 | #define alSus 0x80 |
||
58 | #define alWave 0xe0 |
||
59 | // Channel stuff |
||
60 | #define alFreqL 0xa0 |
||
61 | #define alFreqH 0xb0 |
||
62 | #define alFeedCon 0xc0 |
||
63 | // Global stuff |
||
64 | #define alEffects 0xbd |
||
65 | |||
66 | typedef struct |
||
67 | { |
||
68 | byte mChar,cChar, |
||
69 | mScale,cScale, |
||
70 | mAttack,cAttack, |
||
71 | mSus,cSus, |
||
72 | mWave,cWave, |
||
73 | nConn, |
||
74 | |||
75 | // These are only for Muse - these bytes are really unused |
||
76 | voice, |
||
77 | mode; |
||
78 | byte unused[3]; |
||
79 | } Instrument; |
||
80 | |||
81 | #define ORIG_INSTRUMENT_SIZE 16 |
||
82 | |||
83 | typedef struct |
||
84 | { |
||
85 | SoundCommon common; |
||
86 | Instrument inst; |
||
87 | byte block; |
||
88 | byte data[1]; |
||
89 | } AdLibSound; |
||
90 | |||
91 | #define ORIG_ADLIBSOUND_SIZE (ORIG_SOUNDCOMMON_SIZE + ORIG_INSTRUMENT_SIZE + 2) |
||
92 | |||
93 | // |
||
94 | // Sequencing stuff |
||
95 | // |
||
96 | #define sqMaxTracks 10 |
||
97 | |||
98 | typedef struct |
||
99 | { |
||
100 | word length; |
||
101 | word values[1]; |
||
102 | } MusicGroup; |
||
103 | |||
104 | typedef struct |
||
105 | { |
||
106 | int valid; |
||
107 | fixed globalsoundx, globalsoundy; |
||
108 | } globalsoundpos; |
||
109 | |||
110 | extern globalsoundpos channelSoundPos[]; |
||
111 | |||
112 | // Global variables |
||
113 | extern boolean AdLibPresent, |
||
114 | SoundBlasterPresent, |
||
115 | SoundPositioned; |
||
116 | extern SDMode SoundMode; |
||
117 | extern SDSMode DigiMode; |
||
118 | extern SMMode MusicMode; |
||
119 | extern int DigiMap[]; |
||
120 | extern int DigiChannel[]; |
||
121 | |||
9097 | turbocat | 122 | #ifdef _KOLIBRI |
123 | extern void uSDL_Delay(unsigned time); |
||
124 | #else |
||
125 | #define uSDL_Delay SDL_Delay |
||
126 | #endif |
||
8645 | turbocat | 127 | |
9097 | turbocat | 128 | #define GetTimeCount() (( uSDL_GetTicks()*7)/100) |
129 | |||
8645 | turbocat | 130 | inline void Delay(int wolfticks) |
131 | { |
||
9097 | turbocat | 132 | if(wolfticks>0) uSDL_Delay(wolfticks * 100/ 7); |
8645 | turbocat | 133 | } |
134 | |||
135 | // Function prototypes |
||
136 | extern void SD_Startup(void), |
||
137 | SD_Shutdown(void); |
||
138 | |||
139 | extern int SD_GetChannelForDigi(int which); |
||
140 | extern void SD_PositionSound(int leftvol,int rightvol); |
||
141 | extern boolean SD_PlaySound(soundnames sound); |
||
142 | extern void SD_SetPosition(int channel, int leftvol,int rightvol); |
||
143 | extern void SD_StopSound(void), |
||
144 | SD_WaitSoundDone(void); |
||
145 | |||
146 | extern void SD_StartMusic(int chunk); |
||
147 | extern void SD_ContinueMusic(int chunk, int startoffs); |
||
148 | extern void SD_MusicOn(void), |
||
149 | SD_FadeOutMusic(void); |
||
150 | extern int SD_MusicOff(void); |
||
151 | |||
152 | extern boolean SD_MusicPlaying(void); |
||
153 | extern boolean SD_SetSoundMode(SDMode mode); |
||
154 | extern boolean SD_SetMusicMode(SMMode mode); |
||
155 | extern word SD_SoundPlaying(void); |
||
156 | |||
157 | extern void SD_SetDigiDevice(SDSMode); |
||
158 | extern void SD_PrepareSound(int which); |
||
159 | extern int SD_PlayDigitized(word which,int leftpos,int rightpos); |
||
160 | extern void SD_StopDigitized(void); |
||
161 | |||
162 | #endif |