-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMIXTEST.PAS
More file actions
161 lines (127 loc) · 4.07 KB
/
Copy pathMIXTEST.PAS
File metadata and controls
161 lines (127 loc) · 4.07 KB
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
{ SMIX is Copyright 1995 by Ethan Brodsky. All rights reserved. }
program MixTest;
uses
CRT,
u_SMix;
const
XMSRequired = 200; {XMS memory required to load the sounds (KBytes) }
SharedEMB = true;
{TRUE: All sounds will be stored in a shared EMB}
{FALSE: Each sound will be stored in a separate EMB}
NumSounds = 6;
var
BaseIO: word; IRQ, DMA, DMA16: byte;
Sound: PSound;
OldExitProc: pointer;
ignore:boolean;
function HexW(W: word): string; {Word}
const
HexChars: array [0..$F] of Char = '0123456789ABCDEF';
begin
HexW :=
{ HexChars[(W and $F000) shr 12] +}
HexChars[(W and $0F00) shr 8] +
HexChars[(W and $00F0) shr 4] +
HexChars[(W and $000F)];
end;
procedure ReadySounds;
var
i: integer;
begin
if not(InitXMS)
then
begin
writeln('Error initializing extended memory');
Halt(3); {XMS driver not installed}
end
else
begin
writeln('Extended memory succesfully initialized');
write('Free XMS memory: ', GetFreeXMS, 'k ');
if GetFreeXMS < XMSRequired
then
begin
writeln('Insufficient extended memory');
Halt(4); {Insufficient XMS memory}
end
else
begin
writeln('Loading sounds');
if SharedEMB then InitSharing;
(*
if not(OpenSoundResourceFile('MIXTEST.SND'))
then
begin
writeln('Error loading sound resource file');
Halt(5); {Sound resource file does not exist}
end;
ignore:=LoadSound(Sound[0], 'JET');
ignore:=LoadSound(Sound[0], 'SINE');
ignore:=LoadSound(Sound[1], 'GUN');
ignore:=LoadSound(Sound[2], 'CRASH');
ignore:=LoadSound(Sound[3], 'CANNON');
ignore:=LoadSound(Sound[4], 'LASER');
ignore:=LoadSound(Sound[5], 'GLASS');
CloseSoundResourceFile;
OldExitProc := ExitProc;
ExitProc := @OurExitProc;
*)
end
end;
end;
procedure Init;
begin
writeln;
writeln('-------------------------------------------');
writeln('Sound Mixing Library v1.30 by Ethan Brodsky');
if not(GetSettings(BaseIO, IRQ, DMA, DMA16))
then
begin
writeln('Error initializing: Invalid or non-existant BLASTER environment variable');
Halt(1); {BLASTER environment variable invalid or non-existant}
end;
if not(InitSB(BaseIO, IRQ, DMA, 0))
then
begin
writeln('Error initializing sound card');
writeln('Incorrect base IO address, sound card not installed, or broken');
Halt(2); {Sound card could not be initialized}
end;
writeln('BaseIO=', HexW(BaseIO), 'h IRQ', IRQ, ' DMA8=', DMA, ' DMA16=', DMA16);
write('DSP version ', DSPVersion shr 8, '.', DSPVersion and $FF, ': ');
if SixteenBit
then write('16-bit, ')
else write('8-bit, ');
if AutoInit
then writeln('Auto-initialized')
else writeln('Single-cycle');
InitMixing;
writeln;
end;
procedure Shutdown;
begin
ShutdownMixing;
ShutdownSB;
writeln;
end;
var
Counter: LongInt;
InKey: char;
Stop: boolean;
Num: byte;
Temp: integer;
Jet: boolean;
RandSounds: boolean;
Rate: word;
begin
Randomize;
Init;
ReadySounds;
ignore:=LoadSound(Sound, 'TEST.RAW');
ignore:=StartSound(Sound, 1, false);
readln;
StopSound(0);
Shutdown;
FreeSound(Sound);
Shutdownsharing;
end.