-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnit1.pas
90 lines (63 loc) · 2.05 KB
/
Unit1.pas
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
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, Buttons, al_lib, VirtualOpenAL, smallvectorlib;
type
TForm1 = class(TForm)
BitBtn4: TBitBtn;
Timer1: TTimer;
procedure BitBtn4Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
fazer: longword;
dofunstuff: boolean = false;
implementation
{$R *.DFM}
procedure notifydeletion(src: Longword; userdata: pointer);
begin
showmessage('A source was deleted: ' + inttostr(src));
end;
procedure TForm1.BitBtn4Click(Sender: TObject);
begin
VirtualOpenDevice(nil);
// create as much openal sources as you want now, to reserve them for your own use!
// like music streaming, etc.. the rest will be used by Virtual OpenAL.
VirtualInitialize;
// send some wave data to the buffer
setlength(WaveBuffers, length(WaveBuffers) +1);
with WaveBuffers[high(WaveBuffers)] do begin
ID:= 1;
XALLoadWave(buffer, pchar('warpbreachsooner.wav'));
end;
setlength(WaveBuffers, length(WaveBuffers) +1);
with WaveBuffers[high(WaveBuffers)] do begin
ID:= 2;
XALLoadWave(buffer, pchar('Phaser.wav'));
end;
// make some sounds!
VirtualModifyListener(makevector(0.0, 0.0, 0.0), makevector(0.0, 0.0, 0.0), virtualopenal.ListenerOrientationarray);
SourceCreate(WaveBuffers[FindBuffer(1)].buffer, makevector(0, 0, 0), true , nil , nil);
fazer:= SourceCreate(WaveBuffers[FindBuffer(2)].buffer, makevector(1, 0, 0), false, notifydeletion, nil);
VirtualSwapInSwapOut;
dofunstuff:= true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
virtualopenal.ClockMS:= gettickcount; // very important! unit relies on your own external timer (whatever you want to use)
VirtualProcess;
if dofunstuff = false then exit;
{SourceModify(
fazer,
makevector(sin(gettickcount div 100), cos(gettickcount div 100), 0),
makevector(0, 0, 0),
false,
1);}
end;
end.